Пример #1
0
        public AICommand BuildCommand(Unit unit)
        {
            var direction = AICommand.SerializeDirection(MapDirections.RandomDirection());

            return(new AICommand {
                Command = AICommand.Move, Unit = unit.Id, Dir = direction
            });
        }
Пример #2
0
        public AICommand BuildCommand(Unit unit)
        {
            var direction    = AICommand.SerializeDirection(MapDirections.RandomDirection());
            var returnAction = new AICommand {
                Command = direction, Unit = unit.Id, Dir = direction
            };

            if (unit.IsScout)
            {
                returnAction = ScoutStrategy.GetStrategy(Map, unit);
            }

            if (unit.IsWorker)
            {
                returnAction = WorkerStrategy.GetStrategy(Map, unit);
            }

            if (unit.IsTank)
            {
                returnAction = TankStrategy.GetStrategy(Map, unit);
            }

            if (unit.IsBase)
            {
                returnAction = BaseStrategy.GetStrategy(Map, unit);
            }

            if (returnAction != null)
            {
                if (returnAction.Dir == "None")
                {
                    return(null);
                }
            }


            return(returnAction);
        }