Source

Twisted Potions Double Trouble / Assets / Scripts / Button.cs

using UnityEngine;
using System.Collections;

public class Button : MonoBehaviour
{

	//Storing the reference to RagePixelSprite -component
	private IRagePixel ragePixel;

	// Enum that manages the button status.
	public enum ButtonStatus
	{
		Normal=0,
		Pressed
	};

	void Awake ()
	{
		ragePixel = GetComponent<RagePixelSprite> ();
	}
	
	public void Press (ButtonStatus status)
	{
		if (status == ButtonStatus.Normal)
			ragePixel.PlayNamedAnimation ("Normal", false);
		else
			ragePixel.PlayNamedAnimation ("Pressed", false);									
	}
	
}