Exemplo n.º 1
0
    //This is called by the behaviour manager, which is called by the state machine
    public void BehaviourCall(string stateName, BaseState.StateFunction state)
    {
        if (!stateDict.ContainsKey(stateName))
        {
            Debug.LogError("StateDict does not contain state: " + stateName);
            return;
        }

        BaseState bs = stateDict[stateName];

        switch (state)
        {
        case BaseState.StateFunction.Enter:
            bs.EnterState();
            break;

        case BaseState.StateFunction.Update:
            bs.StayState(Time.deltaTime);     //This is called by state machine, it is outside our flow
            break;

        case BaseState.StateFunction.Exit:
            bs.ExitState();
            break;

        default:
            Debug.LogError("Unhandled state: " + state.ToString());
            break;
        }
    }
Exemplo n.º 2
0
    public void BehaviourOutput(BaseState.StateFunction state, int hash)
    {
        string name = GetName(hash);

        monsterAI.BehaviourCall(name, state);


        //Debug.Log ("State Name: " + name + ". Current phase: " + state.ToString());
    }