This is an example of an enumenum being used in a switchswitch statement. I hope that this helps you.
using UnityEngine;
using System.Collections;
public class MyScriptFile : MonoBehaviour
{
// Define possible states for enemy using an enum
public enum EnemyState {CHASE, FLEE, FIGHT, HIDE};
// The current state of enemy
public EnemyState ActiveState = EnemyState.CHASE;
// Update is called once per frame
void Update ()
{
// Check the ActiveState variable
switch(ActiveState)
{
// Check one case
case EnemyState.FIGHT:
{
//Perform fight code here
Debug.Log ("Entered fight state");
}
break;
// Check multiple cases at once
case EnemyState.FLEE:
case EnemyState.HIDE:
{
//Flee and hide performs the same behaviour
Debug.Log ("Entered flee or hide state");
}
break;
// Default case when all other states fail
default:
{
//This is used for the chase state
Debug.Log ("Entered chase state");
}
break;
}
}
}