Skip to content

Instantly share code, notes, and snippets.

@LordNed
LordNed / polish_notes.txt
Created March 2, 2015 05:22
Some notes on polish from a flash game (Kingdom Rush?) I took while developing Slime Slider.
Instruction Menu: http://i.imgur.com/vcyOh1O.png
Next/Skip This Buttons:
OnHoverStart: Both buttons pull down from the background slightly.
The background of the Blue button gets slightly lighter, the brown one darker red.
OnClick: Dark Blue and Dark Red backgrounds. The "Next/Skip This" text color remains unchanged.
Background of Instructions Menu warps between the two sizes (9-slice?) for transition between pages of instructions.
Content fades out, new content fades in faster
public void AddMinutes(int numMinutes)
{
m_currentMinutes += numMinutes;
if(m_currentMinutes >= 60)
{
m_currentMinutes -= 60;
m_currentHours++;
}
}
using UnityEngine;
using System.Collections;
using System;
using UnityEngine.Events;
using UnityEngine.UI;
using System.Collections.Generic;
public class Pigeons : MonoBehaviour
{
public class PigeonEvent<T> : UnityEvent<T>{}
using UnityEngine;
using System.Collections;
using System;
[RequireComponent(typeof(CharacterController2D))]
public class CreatureGarfunkel : StatelyMachine, IDamageable
{
public enum MoveDirection
{
None, Left, Right
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(AudioSource))]
public class DawnAudioNotification : MonoBehaviour
{
private AudioSource m_audioClip;
private void Awake()
{
using OpenTK;
using OpenTK.Graphics.OpenGL4;
using System;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
using WEditor;
namespace TestEditor
{
@LordNed
LordNed / Character.cs
Created March 30, 2015 02:09
Wrapping input for use in FixedUpdate.
using UnityEngine;
using System.Collections;
/// <summary>
/// What the problem is:
/// In Unity, the only way to get input from the user's keyboard/joysticks/etc. is to poll the Input
/// system in the Update() function. However, there are often times where you need to actually get
/// their input in the FixedUpdate() function (such as when dealing with the physics engine).
///
/// Why is this a problem?
@LordNed
LordNed / DiffuseSpriteFlash.shader
Last active November 23, 2020 14:08
2D Sprite Blinking
Shader "Sprites/Diffuse Flash"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_SelfIllum ("Self Illumination",Range(0.0,1.0)) = 0.0
_FlashAmount ("Flash Amount",Range(0.0,1.0)) = 0.0
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
}
using UnityEngine;
public interface IDamageable
{
void OnTakeDamage(GameObject attacker, float damageAmount);
}
// See if it's something that takes damage, if so we're going to kill the velocity and its ability to hurt.
IDamageable damageable = (IDamageable)col.gameObject.GetComponent(typeof(IDamageable));
if (damageable != null)
{
damageable.OnTakeDamage(Owner, m_arrowDamage);
}