Hello,
i would like to create an Enum state for treasure chest, Default state will be Close since all chest’s are being closed at the begining. Could u please tell me if i am heading the right direction and what is wrong in my code
#pragma strict
//Chest script
enum ChestState { Open, Close, InBetween } //Enum for tri-state values.
var stateOpen = ChestState.Open; //Chest Open
var stateClose = ChestState.Close; //Chest Close - set as default
var stateInBetween = ChestState.InBetween; //Somewhere in the process of open or close
function Start () {
//chestState = Chest.ChestState.Close;
}
function Update () {
}
function OnMouseEnter() {
Debug.Log("Enter");
}
function OnMouseExit() {
Debug.Log("Exit");
}
function OnMouseUp() {
Debug.Log("Up");
if(ChestState.Close)
Open();
else
Close();
}
private function Open() {
animation.Play();
ChestState.Open;
}
private function Close() {
animation.Play();
ChestState.Close;
}