Ejemplo 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();
            }
        }
Ejemplo 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();
     }
 }
Ejemplo n.º 3
0
 public void SetCurrentPlayer(GamePlayerInfo player)
 {
     Current = player;
     AddPlayer(Current);
 }
Ejemplo n.º 4
0
 public void Drop(GamePlayerInfo player)
 {
     Drop(player.ID);
 }
Ejemplo n.º 5
0
 public void AddPlayer(GamePlayerInfo player)
 {
     players.Add(player.ID, player);
     player.Attach();
 }
Ejemplo n.º 6
0
 public GamePlayerProxy(GamePlayerInfo playerInfo)
 {
     this.PlayerInfo = playerInfo;
 }