Пример #1
0
        protected virtual NPCInst SpawnCharacter(ArenaClient client, WorldInst world, PosAng spawnPoint)
        {
            // only spawn if player has joined the game mode and chosen a class
            if (client == null || !client.GMJoined || client.GMClass == null)
            {
                return(null);
            }

            // get rid of old character if there is one
            client.KillCharacter();

            NPCInst npc = CreateNPC(client.GMClass, (int)client.GMTeamID, client.CharInfo);

            npc.Spawn(world, spawnPoint.Position, spawnPoint.Angles);
            client.SetControl(npc);

            // start the warm up phase as soon as the first player joins
            if (Phase == GamePhase.None && players.Count(p => p.IsCharacter) == 1)
            {
                SetPhase(GamePhase.WarmUp);
                phaseTimer.SetInterval(Scenario.WarmUpDuration);
                phaseTimer.SetCallback(Fight);
                phaseTimer.Restart();
            }
            return(npc);
        }