Пример #1
0
        public void ProcessInputs(int whichOne)
        {
            List <string> tmpPlayerList;

            switch (whichOne)
            {
            case 1:
                tmpPlayerList = Messenger.GetNewPlayers();
                foreach (string s in tmpPlayerList)
                {
                    ServerSpace.AddPlayer(s);
                    howManyToRenderOn++;
                    renderFinishedOn++;
                }
                break;

            case 2:
                tmpPlayerList = Messenger.GetDcdPlayers();
                foreach (string s in tmpPlayerList)
                {
                    howManyToRenderOn--;
                    ServerSpace.RemovePlayer(s);
                }

                break;

            case 3:
                List <DataPacket> newData = Messenger.GetNewData();
                foreach (DataPacket data in newData)
                {
                    switch (data.TheStatus)
                    {
                    case StatusMessage.MovementUpdate:
                        if (data.Facing == Direction.Fire)
                        {
                            ServerSpace.Fire(data.PlayerID);
                        }
                        else
                        {
                            ServerSpace.SendNewDirection(data.PlayerID, data.Facing);
                        }
                        break;

                    case StatusMessage.RenderFinished:
                        renderFinishedOn++;
                        break;
                    }
                }
                break;
            }
        }