Example #1
0
        public static Dictionary <string, Dictionary <Token.Sequence_State, CoreEvent> > initStrategyEvents()
        {
            Dictionary <string, Dictionary <Token.Sequence_State, CoreEvent> > strategyEvents =
                new Dictionary <string, Dictionary <Token.Sequence_State, CoreEvent> >()
            {
                /////////////////////////////////////////////////////////////////////////////////////
                // DIPLOMATICS
                { "test1", new Dictionary <Token.Sequence_State, CoreEvent>()
                  {
                      { Token.Sequence_State.Success, EventBank.generateHappinessEvent(2) },
                      { Token.Sequence_State.Background, EventBank.generateHappinessEvent(1) },
                      { Token.Sequence_State.Fail, EventBank.generateHappinessEvent(-1) }
                  } },
                /////////////////////////////////////////////////////////////////////////////////////
                // GROWTH
                { "farm", new Dictionary <Token.Sequence_State, CoreEvent>()
                  {
                      { Token.Sequence_State.Success, EventBank.generateFoodEvent(2) },
                      { Token.Sequence_State.Background, EventBank.generateFoodEvent(1) },
                      { Token.Sequence_State.Fail, EventBank.generateFoodEvent(-1) }
                  } },
                /////////////////////////////////////////////////////////////////////////////////////
                // MILITARY
                { "defense", new Dictionary <Token.Sequence_State, CoreEvent>()
                  {
                      { Token.Sequence_State.Success, EventBank.generateMilitaryEvent(2) },
                      { Token.Sequence_State.Background, EventBank.generateMilitaryEvent(1) },
                      { Token.Sequence_State.Fail, EventBank.generateMilitaryEvent(-1) }
                  } }
                /////////////////////////////////////////////////////////////////////////////////////
            };//! strategyEvents declaration

            return(strategyEvents);
        }
Example #2
0
        void Update()
        {
            if (currentState == STATE.FREE)
            {
                if (transform.position != _spawner.transform.position)
                {
                    if (!!_spawner)
                    {
                        teleportToPOI(_spawner);
                    }
                }

                // ======= OCCUPY ==============
                // > GIVE ORDERS LOGIC HERE

                // DUMMY STRATEGY
                int randomStrategy = UnityEngine.Random.Range(0, 4);
                if (randomStrategy == 0)
                {
                    seekWood();
                }
                if (randomStrategy == 1)
                {
                    seekStone();
                }
                if (randomStrategy == 2)
                {
                    seekFood();
                }
                if (randomStrategy == 3)
                {
                    seekIron();
                }

                // ==============================
            }

            // EATS
            eat_counter++;
            if (eat_counter > hungry_threshold)
            {
                eat_counter = 0; attachedWorld.events.AddLast(EventBank.generateFoodEvent(-unit_ressource_consumption));
            }
        }