i am trying to write a script for treasure chest in Javascript. Basically a Player will be able to open a chest and loot stuff from it. First thing first, i want to create an Enum state for chest being open/close or something inbetween.
I have this piece of code and i am having an error in Console
#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 () {
var chestState = ChestState.Close;
}
function Update () {
}
function onmouseenter() {
Debug.Log("Enter");
}
function OnMouseExit() {
Debug.Log("Exit");
}
function onmouseup() {
Debug.Log("Up");
}
private function Open() {
if(chestState === ChestState.Close) {
animation.Play();
}
}
private function Close() {
animation.Play();
}
my error "Assets/Scripts/interactiveGameObjects/Chest.js(37,12): BCE0005: Unknown identifier: 'chestState'."
why do i have this error and how can i fix it please

New Topic/Question
Reply



MultiQuote








|