Пример #1
0
    private void InitializeFSM()
    {
        EmotionState neutral = new EmotionState(StateID.Neutral);
        neutral.High = 10f;
        neutral.Low = -10f;
        neutral.AddTransition(Transition.Interested, StateID.Interested);
        neutral.AddTransition(Transition.Annoyed, StateID.Annoyed);

        EmotionState interested = new EmotionState(StateID.Interested);
        interested.High = 10f;
        interested.Low = -10f;
        interested.AddTransition(Transition.Happy, StateID.Happy);
        interested.AddTransition(Transition.Annoyed, StateID.Annoyed);

        EmotionState annoyed = new EmotionState(StateID.Annoyed);
        annoyed.High = 10f;
        annoyed.Low = -10f;
        annoyed.AddTransition(Transition.Interested, StateID.Interested);
        annoyed.AddTransition(Transition.Angry, StateID.Angry);

        EmotionState angry = new EmotionState(StateID.Angry);
        angry.High = 12f;
        angry.Low = -8f;
        angry.AddTransition(Transition.Annoyed, StateID.Annoyed);
        angry.AddTransition(Transition.Lose, StateID.Lose);

        EmotionState happy = new EmotionState(StateID.Happy);
        happy.High = 10f;
        happy.AddTransition(Transition.Win, StateID.Win);

        EmotionState win = new EmotionState(StateID.Win);
        EmotionState lose = new EmotionState(StateID.Lose);

        fsm = new FSMSystem();

        fsm.AddState(neutral);
        fsm.AddState(annoyed);
        fsm.AddState(angry);
        fsm.AddState(happy);
        fsm.AddState(interested);
        fsm.AddState(lose);
        fsm.AddState(win);

        Debug.Log("Imouto FSM successfully Initialized");
    }