Esempio n. 1
0
        static void RPC_Respond_LoginAuth(Respond_LoginAuth rla)
        {
            GamePlayerInfo player = new GamePlayerInfo(rla.player.pid
                                                       , rla.token
                                                       , rla.player.name
                                                       , rla.player.playerType.ToGamePlayerType()
                                                       );

            player.Position = rla.player.movement.position.ToUV();
            player.Velocity = rla.player.movement.velocity.ToUV();

            if (PlayerManager.Instance.Current == null)
            {
                PlayerManager.Instance.SetCurrentPlayer(player);
                player.Login();
            }
            foreach (var p in rla.neighborhood)
            {
                GamePlayerInfo pc = new GamePlayerInfo(p.pid
                                                       , name: p.name
                                                       , type: p.playerType.ToGamePlayerType()
                                                       );
                pc.Position = p.movement.position.ToUV();
                pc.Velocity = p.movement.velocity.ToUV();
                PlayerManager.Instance.AddPlayer(pc);
                pc.Appear();
            }
        }
Esempio n. 2
0
 static void RPC_Respond_PlayerAppeared(Respond_PlayerAppeared rpa)
 {
     foreach (var m in rpa.neighborhood)
     {
         var player = PlayerManager.Instance.GetPlayer(m.pid);
         if (player == null)
         {
             player = new GamePlayerInfo(m.pid
                                         , name: m.name
                                         , type: m.playerType.ToGamePlayerType()
                                         );
             player.Position = m.movement.position.ToUV();
             player.Velocity = m.movement.velocity.ToUV();
             PlayerManager.Instance.AddPlayer(player);
             player.Appear();
         }
         player.Position = m.movement.position.ToUV();
         player.Velocity = m.movement.velocity.ToUV();
         player.RefreshMovment();
     }
 }
Esempio n. 3
0
 public void SetCurrentPlayer(GamePlayerInfo player)
 {
     Current = player;
     AddPlayer(Current);
 }
Esempio n. 4
0
 public void Drop(GamePlayerInfo player)
 {
     Drop(player.ID);
 }
Esempio n. 5
0
 public void AddPlayer(GamePlayerInfo player)
 {
     players.Add(player.ID, player);
     player.Attach();
 }
Esempio n. 6
0
 public GamePlayerProxy(GamePlayerInfo playerInfo)
 {
     this.PlayerInfo = playerInfo;
 }