Exemplo n.º 1
0
        private void CreateAndAddBot(Player plr)
        {
            if (plr.Data.BotType == BotType.NONE || !plr.IsActivePlayer())
            {
                return;
            }

            // jinak budou provadet update na vice klientech - n-nasobek akci
            if (GameType == Gametype.TOURNAMENT_GAME && !GetCurrentPlayer().Data.LobbyLeader)
            {
                return;
            }

            switch (plr.Data.BotType)
            {
            case BotType.LEVEL1:
                StateMgr.AddGameState(new SimpleBot(this, objects, plr));
                break;

            case BotType.LEVEL2:
                StateMgr.AddGameState(new HookerBot(this, objects, plr));
                break;

            case BotType.LEVEL3:
                StateMgr.AddGameState(new MedicoreBot(this, objects, plr));
                break;

            case BotType.LEVEL4:
            case BotType.LEVEL5:
            default:
                break;
            }
        }
        /// <summary>
        /// vytvori hraci action bar, input manager a zbrane a bazi nebo mining module
        /// </summary>
        /// <param name="p">hrac kteremu se maji vytvorit objekty</param>
        private void CreateActiveObjectsOfPlayer(Player p)
        {
            if (p.IsActivePlayer())
            {
                p.CreateWeapons();

                p.Baze = SceneObjectFactory.CreateBase(this, p);

                BaseIntegrityBar ellipse = SceneObjectFactory.CreateBaseIntegrityBar(this, p);

                HpBarControl control = new HpBarControl(ellipse);
                p.Baze.AddControl(control);

                DelayedAttachToScene(ellipse);
                DelayedAttachToScene(p.Baze);
            }
            else
            {
                if (p.Device == null)
                {
                    MiningModule obj = SceneObjectFactory.CreateMiningModule(this, p.Data.MiningModuleStartPos, p);
                    DelayedAttachToScene(obj);
                    DelayedAttachToScene(SceneObjectFactory.CreateMiningModuleIntegrityBar(this, obj, p));

                    p.Device = obj;
                }
            }

            if (p.IsCurrentPlayer())
            {
                actionBarMgr = new ActionBarMgr(this);
                StateMgr.AddGameState(actionBarMgr);

                if (p.IsActivePlayer())
                {
                    inputMgr = new PlayerInputMgr(p, this, actionBarMgr);
                    actionBarMgr.CreateActionBarItems(p.GetActions <IPlayerAction>(), false);
                    InitAutomaticMineLauncher();
                }
                else
                {
                    if (p.Device.HasControlOfType <MiningModuleControl>())
                    {
                        return;
                    }

                    MiningModuleControl mc = new MiningModuleControl();
                    mc.Owner = p;
                    p.Device.AddControl(mc);

                    inputMgr = new SpectatorInputMgr(p, this, p.Device, actionBarMgr);
                    actionBarMgr.CreateActionBarItems(p.GetActions <ISpectatorAction>(), true);
                    SceneObjectFactory.CreateSpectatorActionReadinessIndicators(p);
                }
            }
        }
Exemplo n.º 3
0
        private void StopAndRequestScores(Action action)
        {
            playersRespondedScore = new List <int>();
            savedEndGameAction    = action;
            isInitialized         = false;
            NetOutgoingMessage msg = CreateNetMessage();

            msg.Write((int)PacketType.SCORE_QUERY);
            BroadcastMessage(msg);
            StateMgr.AddGameState(new DelayedActionInvoker(1, new Action(() => SkipWaitingForScoreQueryResponse())));
        }
Exemplo n.º 4
0
 private void AttachStateManagers()
 {
     StateMgr.AddGameState(currentPlayer);
     FloatingTextMgr = new FloatingTextManager(this);
     StateMgr.AddGameState(FloatingTextMgr);
     LevelEnv = new LevelEnvironment();
     StateMgr.AddGameState(LevelEnv);
     AlertMessageMgr = new AlertMessageManager(this, 0.5f);
     StateMgr.AddGameState(AlertMessageMgr);
     SpectatorActionMgr = new SpectatorActionsManager();
     StateMgr.AddGameState(SpectatorActionMgr);
     ScreenShakingMgr = new ScreenShakingManager(this);
     StateMgr.AddGameState(ScreenShakingMgr);
 }
Exemplo n.º 5
0
        private void ReceivedStartGameRequestMsg(NetIncomingMessage msg)
        {
            if (gameSession == null)
            {
                gameSession = new GameManager(this, players);
                StateMgr.AddGameState(gameSession);
            }

            if (gameSession.CheckTournamentFinished())
            {
                return;
            }

            gameSession.CreateNewMatch();
            isInitialized = true;

            if (gameSession.RequestStartMatch(GetPlayer(msg.SenderConnection.RemoteUniqueIdentifier)))
            {
                players.ForEach(p => p.Statistics.Reset());
            }
        }
Exemplo n.º 6
0
 public void InitAutomaticMineLauncher()
 {
     StateMgr.AddGameState(new AutomaticMineLauncher(GetCurrentPlayer()));
 }
Exemplo n.º 7
0
 public void InitStaticMouse()
 {
     StaticMouse.Init(this);
     StaticMouse.Enable(true);
     StateMgr.AddGameState(StaticMouse.Instance);
 }