Пример #1
0
    private void MakeFSM()
    {
        MovementState movement = new MovementState(path);

        movement.AddTransition(Transition.NearNPC, StateID.TrackNPC);
        movement.AddTransition(Transition.AngryNPC, StateID.AggroNPC);


        PlayerNearState track = new PlayerNearState();

        track.AddTransition(Transition.RoamNPC, StateID.MovementNPC);
        track.AddTransition(Transition.InteractNPC, StateID.InteractionNPC);
        track.AddDialogue(NPCDialogue);

        InteractionState interact = new InteractionState();

        interact.AddTransition(Transition.NearNPC, StateID.TrackNPC);

        AggroState aggro = new AggroState();

        aggro.AddTransition(Transition.RoamNPC, StateID.MovementNPC);
        aggro.AddTransition(Transition.AttackNPC, StateID.DamageNPC);

        AttackState attack = new AttackState();

        attack.AddTransition(Transition.AngryNPC, StateID.AggroNPC);


        sm = new FSMSystem();
        sm.AddState(movement);
        sm.AddState(track);
        sm.AddState(interact);
        sm.AddState(aggro);
        sm.AddState(attack);
    }