コード例 #1
0
        public override void OnMapRotation(MapRotationEventArgs e)
        {
            stateMachine.GameMode   = GameMode;
            stateMachine.CurrentMap = Game.CurrentMap;
            stateMachine.State      = BotState.COMPLETE_OBJECTIVE;

            currentPath = null;
            targetNode  = null;

            string[] messages = new string[] {
                "Saved by the bell...",
                "Ding ding! Round 2!",
                "See you on " + e.MapName.Replace(".vtmap", "").Replace('-', ' ').Replace('_', ' ') + "."
            };
            int index = new Random().Next(0, 3);

            GameServer.SendChatMessage(messages[index]);

            RefreshStateMachine();

            alive = true;
            stateMachine.MicroState = MicroBotState.STILL;
            currentTarget           = null;
            lastNode        = null;
            elapsed         = 0;
            timeToNextPoint = 0;
        }
コード例 #2
0
        public void InvokeOnMapRotation()
        {
            buffer.PopAll();

            const int MAX_TRIES = 20;
            string    mapName   = null;

            for (int i = 0; i < MAX_TRIES; ++i)
            {
                mapName = GameServer.GetCurrentMapName();
                if (currentMapName != mapName)
                {
                    break;
                }

                Thread.Sleep(1000);
            }

            VTankObject.GameMode mode = GameServer.GetCurrentGameMode();

            MapRotationEventArgs args = new MapRotationEventArgs(mapName, mode);

            Game.Reset();
            if (Game.GameModeHandler != null)
            {
                Game.GameModeHandler.Dispose();
            }

            DownloadAndLoadMap();
            Game.GameModeHandler = CreateGameHandler(mode);

            RefreshPlayerList();

            OnMapRotation(args);

            GameServer.Ready();
        }
コード例 #3
0
 public virtual void OnMapRotation(MapRotationEventArgs e)
 {
 }