Example #1
0
        } // MakeDecision

        public void AddPath(UnitType unitType, List <NodeEntity> newList)
        {
            IntelligentList intelligentList = new IntelligentList();

            intelligentList.unitType = unitType;
            intelligentList.nodeList.AddRange(newList);
            this.NewPaths.Add(intelligentList);
        }
Example #2
0
        public void MakeDecision(GameTime gameTime)
        {
            IntelligentList intelligentList = null;

            if (this.Resources.BuyUnit())
            {
                if (this.NewPaths.Count > 0)
                {
                    intelligentList = this.NewPaths[0];
                    this.NewPaths.Remove(this.NewPaths[0]);
                }
                DynamicEntity NewEntity = new DynamicEntity();
                if (intelligentList == null)
                {
                    int unit = this.Game.Random.Next(3);
                    switch (unit)
                    {
                    case 0:
                        NewEntity = EntityFactory.GetInfantryEntity(
                            this.Game, Owners.ENEMY, this.Town);
                        break;

                    case 1:
                        NewEntity = EntityFactory.GetArcherEntity(
                            this.Game, Owners.ENEMY, this.Town);
                        break;

                    case 2:
                        NewEntity = EntityFactory.GetKnightEntity(
                            this.Game, Owners.ENEMY, this.Town);
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    switch (intelligentList.unitType)
                    {
                    case UnitType.ARCHER:
                        NewEntity = EntityFactory.GetInfantryEntity(
                            this.Game, Owners.ENEMY, this.Town);
                        break;

                    case UnitType.KNIGHT:
                        NewEntity = EntityFactory.GetArcherEntity(
                            this.Game, Owners.ENEMY, this.Town);
                        break;

                    case UnitType.INFANTRY:
                        NewEntity = EntityFactory.GetKnightEntity(
                            this.Game, Owners.ENEMY, this.Town);
                        break;

                    default:
                        break;
                    }
                    NewEntity.ToVisitPath.AddRange(intelligentList.nodeList);
                }
            }
        } // MakeDecision