Ejemplo n.º 1
0
        public RTSWorld()
            : base()
        {
            // Add default, neutral team.
            Team neutral = new Team(0, "Neutral", Color.LightGray);
            this.Teams.Add(neutral);

            #if MULTIPLAYER
            // Get global session information.
            this.m_GlobalSession = new Distributed<GlobalSession>("rts-session");
            this.m_GlobalSession.LogEmitted += (sender, ev) => { this.UiManager.Log(ev.ToString()); };
            this.m_LocalPlayer = this.m_GlobalSession.Join();

            // Hook the game started event.
            if (LocalNode.Singleton.IsServer)
                this.m_GlobalSession.ServerGameStarted += this._HandleServerGameStart;
            else
                this.m_GlobalSession.ClientGameStarted += this._HandleClientGameStart;
            #else
            // Get global session information.
            this.m_GlobalSession = new GlobalSession();
            this.m_GlobalSession.LogEmitted += (sender, ev) => { this.UiManager.Log(ev.ToString()); };
            this.m_LocalPlayer = this.m_GlobalSession.Join();

            // Hook the game started event.
            this.m_GlobalSession.ServerGameStarted += (sender, ev) => { this.HandleServerGameStart(); };
            #endif
        }
Ejemplo n.º 2
0
 public void Leave(Player player)
 {
     this.Players.Remove(player);
 }
Ejemplo n.º 3
0
 public Player Join()
 {
     Player player = new Player();
     this.Players.Add(player);
     return player;
 }