示例#1
0
        public override LogicPart Initialize(LogicPart logicPart)
        {
            var rules = new PudgeRules();

            logicPart.CreateWorld           = () => new PudgeWorld(true);
            logicPart.CreateDefaultSettings = () => new GameSettings {
                OperationalTimeLimit = 5, TimeLimit = 90
            };

            logicPart.WorldStateType   = typeof(PudgeWorldState);
            logicPart.CreateWorldState = seed => new PudgeWorldState(int.Parse(seed));
            logicPart.PredefinedWorldStates.AddRange(Enumerable.Range(0, 5).Select(i => i.ToString()));

            var actorFactory = ActorFactory.FromRobot(new PudgeRobot(), rules);

            logicPart.Actors[TwoPlayersId.Left]  = actorFactory;
            logicPart.Actors[TwoPlayersId.Right] = actorFactory;

            var slardarFactory = ActorFactory.FromRobot(new Slardar(), new SlardarRules());

            logicPart.NPC.Add(Tuple.Create(SlardarId.LeftTop, slardarFactory, CreateStandingBot()));
            logicPart.NPC.Add(Tuple.Create(SlardarId.RightBottom, slardarFactory, CreateWalkingBot()));

            logicPart.Bots[PudgeRules.StandingBotName] = () => rules.CreateStandingBot();

            return(logicPart);
        }
示例#2
0
        public override LogicPart Initialize(LogicPart logicPart)
        {
            var rules = new PudgeRules();

            logicPart.CreateWorld           = () => new PudgeWorld();
            logicPart.CreateDefaultSettings = () => new GameSettings {
                OperationalTimeLimit = 5, TimeLimit = 90
            };

            logicPart.WorldStateType   = typeof(PudgeWorldState);
            logicPart.CreateWorldState = seed => new PudgeWorldState(int.Parse(seed));
            logicPart.PredefinedWorldStates.AddRange(Enumerable.Range(0, 5).Select(i => i.ToString()));

            var actorFactory = ActorFactory.FromRobot(new Player.PudgeRobot(), rules);

            logicPart.Actors[TwoPlayersId.Left] = actorFactory;

            if (playersCount == 2)
            {
                logicPart.Actors[TwoPlayersId.Right] = actorFactory;
            }

            var            slardarFactory    = ActorFactory.FromRobot(new Player.Slardar(), new SlardarRules());
            List <Frame3D> slardarTrajectory = GetSlardarTrajectory();

            logicPart.NPC.Add(new Tuple <string, ActorFactory, Func <IActor, IController> >(
                                  SlardarId.LeftTop, slardarFactory, CreateSlardarBot(slardarTrajectory, SlardarId.LeftTop)));
            logicPart.NPC.Add(new Tuple <string, ActorFactory, Func <IActor, IController> >(
                                  SlardarId.RightBottom, slardarFactory, CreateSlardarBot(slardarTrajectory, SlardarId.RightBottom)));

            logicPart.Bots[PudgeRules.StandingBotName] = () => rules.CreateStandingBot();

            return(logicPart);
        }