Пример #1
0
 public MicroManager(AIController ai)
 {
     agents = new List<BaseAgent>();
     squads = new List<Squad>();
     this.ai = ai;
     AssistAgent assistAgent = new AssistAgent(ai, "Assist");
     AttackAgent aA = new AttackAgent(ai, assistAgent, "Atack");
     agents.Add(aA);
     AGENT_ATACK = 0;
     if (!ai.StoryMode)
     {
         AGENT_EXPLORER = 1;
         AGENT_RETREAT = 2;
         AGENT_ASSIST = 3;
         AGENT_STRATEGY = 4;
         agents.Add(new ExplorerAgent(ai, assistAgent, "Explorer"));
     }
     else
     {
         AGENT_RETREAT = 1;
         AGENT_ASSIST = 2;
         AGENT_STRATEGY = 3;
     }
     agents.Add(new RetreatAgent(ai, aA, assistAgent, "Retreat"));
     agents.Add(assistAgent);
     agents.Add(new StrategyAgent(ai, assistAgent, "Strategy"));
     squads.Add(new Squad(ai.race,ai.DifficultyLvl)); //Hero
     squads.Add(new Squad(ai.race, ai.DifficultyLvl));
 }
Пример #2
0
        public RetreatAgent(AIController ai, AttackAgent aA, AssistAgent assist, string name) : base(ai, name)
        {
            attackAgent           = aA;
            enemySquadBoundingBox = new Rect();
            ownSquadBoundingBox   = new Rect();

            assistAgent = assist;
        }
Пример #3
0
        public RetreatAgent(AIController ai, AttackAgent aA, AssistAgent assist, string name) : base(ai, name)
        {
            attackAgent = aA;
            enemySquadBoundingBox = new Rect();
            ownSquadBoundingBox = new Rect();

            assistAgent = assist;

        }
Пример #4
0
        public ExplorerAgent(AIController ai, AssistAgent assist, String name) : base(ai, name)
        {
            ActorSelector selector = new ActorSelector()
            {
                registerCondition = gameObject => gameObject.GetComponent <FOWEntity>().IsOwnedByPlayer,
                fireCondition     = gameObject => true
            };

            Subscriber <FOWEntity.Actions, FOWEntity> .get.registerForAll(FOWEntity.Actions.DISCOVERED, OnEntityFound, selector);

            Subscriber <FOWEntity.Actions, FOWEntity> .get.registerForAll(FOWEntity.Actions.HIDDEN, OnEntityLost, selector);

            // Setup difficulty levels
            switch (ai.DifficultyLvl)
            {
            case 0:
                isEnabled = false;
                break;

            case 1:
                RescheduleSightRange              = 0;
                ReschuduleDiceFaces               = 1000;
                RescheduleRandomPointValue        = 1000;
                RescheduleRandomAroundTargetValue = 990;
                RescheduleRandomDirectionValue    = 970;
                MaxExplorerSquads = 1;
                break;

            case 2:
                RescheduleSightRange              = 15;
                ReschuduleDiceFaces               = 1000;
                RescheduleRandomPointValue        = 1000;
                RescheduleRandomAroundTargetValue = 990;
                RescheduleRandomDirectionValue    = 970;
                MaxExplorerSquads = 2;
                break;

            case 3:
            default:
                RescheduleSightRange              = 30;
                ReschuduleDiceFaces               = 1000;
                RescheduleRandomPointValue        = 1000;
                RescheduleRandomAroundTargetValue = 990;
                RescheduleRandomDirectionValue    = 970;
                MaxExplorerSquads = 2;
                break;
            }


            heroVisible = false;
            terrain     = Terrain.activeTerrain;
            fowManager  = FOWManager.Instance;
            heroLastPos = Vector3.zero;
            assistAgent = assist;
        }
Пример #5
0
		public ExplorerAgent(AIController ai, AssistAgent assist, String name) : base(ai, name)
        {
            ActorSelector selector = new ActorSelector()
            {
                registerCondition = gameObject => gameObject.GetComponent<FOWEntity>().IsOwnedByPlayer,
                fireCondition = gameObject => true
            };
            Subscriber<FOWEntity.Actions, FOWEntity>.get.registerForAll(FOWEntity.Actions.DISCOVERED, OnEntityFound, selector);
            Subscriber<FOWEntity.Actions, FOWEntity>.get.registerForAll(FOWEntity.Actions.HIDDEN, OnEntityLost, selector);

            // Setup difficulty levels
            switch (ai.DifficultyLvl)
            {
                case 0:
                    isEnabled = false;
                    break;

                case 1:
                    RescheduleSightRange = 0;
                    ReschuduleDiceFaces = 1000;
                    RescheduleRandomPointValue = 1000;
                    RescheduleRandomAroundTargetValue = 990;
                    RescheduleRandomDirectionValue = 970;
                    MaxExplorerSquads = 1;
                    break;

                case 2:
                    RescheduleSightRange = 15;
                    ReschuduleDiceFaces = 1000;
                    RescheduleRandomPointValue = 1000;
                    RescheduleRandomAroundTargetValue = 990;
                    RescheduleRandomDirectionValue = 970;
                    MaxExplorerSquads = 2;
                    break;
                    
                case 3:
                default:
                    RescheduleSightRange = 30;
                    ReschuduleDiceFaces = 1000;
                    RescheduleRandomPointValue = 1000;
                    RescheduleRandomAroundTargetValue = 990;
                    RescheduleRandomDirectionValue = 970;
                    MaxExplorerSquads = 2;
                    break;
            }
            

            heroVisible = false;
            terrain = Terrain.activeTerrain;
            fowManager = FOWManager.Instance;
            heroLastPos = Vector3.zero;
            assistAgent = assist;
        }
Пример #6
0
        public AttackAgent(AIController ai, AssistAgent assist, string name) : base(ai, name)
        {
			if (ai.race == Storage.Races.ELVES)
			{
				_maxUnitRange = Storage.Info.get.of(Storage.Races.MEN, Storage.UnitTypes.THROWN).unitAttributes.rangedAttackFurthest;
				_enemyRace = Storage.Races.MEN;
			}
			else
			{
				_maxUnitRange = Storage.Info.get.of(Storage.Races.ELVES, Storage.UnitTypes.THROWN).unitAttributes.rangedAttackFurthest;
				_enemyRace = Storage.Races.ELVES;
			}

            assistAgent = assist;
        }
Пример #7
0
        public AttackAgent(AIController ai, AssistAgent assist, string name) : base(ai, name)
        {
            if (ai.race == Storage.Races.ELVES)
            {
                _maxUnitRange = Storage.Info.get.of(Storage.Races.MEN, Storage.UnitTypes.THROWN).unitAttributes.rangedAttackFurthest;
                _enemyRace    = Storage.Races.MEN;
            }
            else
            {
                _maxUnitRange = Storage.Info.get.of(Storage.Races.ELVES, Storage.UnitTypes.THROWN).unitAttributes.rangedAttackFurthest;
                _enemyRace    = Storage.Races.ELVES;
            }

            assistAgent = assist;
        }
Пример #8
0
 public StrategyAgent(AIController ai, AssistAgent assist, string name) : base(ai, name)
 {
     rnd = new System.Random();
     //Until we have a better way to mix it we will just keep it random
     timings = new Stack<int>();
     if (!ai.StoryMode)
     {
         timings.Push(rnd.Next(1300, 1700));
         timings.Push(rnd.Next(400, 600));
         if (rnd.Next(0, 9) < 3) //add a rush
             timings.Push(rnd.Next(60, 100));
     }
     else
     {
         timings.Push(rnd.Next(10000, 13000));
     }
     patrolPoints = ai.Macro.architect.baseCriticPoints;
     attacking = false;
     FIND_PLAYER_RATE = FIND_PLAYER_RATE - 60 * ai.DifficultyLvl;
     lastTarget = null;
     target = null;
 }
Пример #9
0
 public StrategyAgent(AIController ai, AssistAgent assist, string name) : base(ai, name)
 {
     rnd = new System.Random();
     //Until we have a better way to mix it we will just keep it random
     timings = new Stack <int>();
     if (!ai.StoryMode)
     {
         timings.Push(rnd.Next(1300, 1700));
         timings.Push(rnd.Next(400, 600));
         if (rnd.Next(0, 9) < 3) //add a rush
         {
             timings.Push(rnd.Next(60, 100));
         }
     }
     else
     {
         timings.Push(rnd.Next(10000, 13000));
     }
     patrolPoints     = ai.Macro.architect.baseCriticPoints;
     attacking        = false;
     FIND_PLAYER_RATE = FIND_PLAYER_RATE - 60 * ai.DifficultyLvl;
     lastTarget       = null;
     target           = null;
 }