Esempio n. 1
0
    void Start()
    {
        FSMManager manager = GetComponent <FSMManager>();

        RandomState search = new RandomState();
        FollowState follow = new FollowState();
        EatState    eat    = new EatState();

        /**
         *  Search for "food"
         *      when locate -> follow it
         *          When arrive -> eat it;
         */
        manager.GetBasicState()
        .configure("Food",
                   o => follow.whenArrive((e) => eat.setToEat(e).setAfterEat((s) => search), o), (o) => {
            Debug.LogError("GOTCHA");
            return(null);
        });

        /**
         *  Search for "player"
         *      when locate -> follow it
         *          When arrive -> attack it;
         */
        //        search.config("Player", o => follow.config((e) => attack.setTarget(e), o));

        manager.setCurrentState(search);
    }
Esempio n. 2
0
    private EatState()
    {
        if (_instance != null)
        {
            return;
        }

        _instance = this;
    }