예제 #1
0
    // Use this for initialization
    void Start()
    {
        NPCStateMachine = new NpcStateMachineMgr();
        NPCStateMachine.currentStateName = NpcStateMachineMgr.NPCStates.NONE;

        int startDir = Random.Range(0, 2);

        if (startDir == 0)
        {
            NPCStateMachine.ChangeState(new WalkLeft(this.gameObject, NPCStateMachine));               //call a new state to switch to in the beginning
            //Debug.Log("Starting left!");
        }
        else if (startDir == 1)
        {
            NPCStateMachine.ChangeState(new WalkRight(this.gameObject, NPCStateMachine));               //call a new state to switch to in the beginning
            //Debug.Log("Starting right!");
        }
        speed = Random.Range(0.1f, 0.5f);
    }
예제 #2
0
 public WalkLeft(GameObject g, NpcStateMachineMgr mgr)
 {
     this.npcObj = g;
     this.mgr    = mgr;
 }