private static void HandleAlive(NetworkMessage msg) { MsgAlive alive = msg as MsgAlive; WriteLine("MsgAlive " + alive.PlayerID.ToString()); WriteLine(String.Format("\tPosition = X{0} Y{1} Z{2} Rotation = {3}", alive.Position.X, alive.Position.Y, alive.Position.Z, alive.Azimuth)); }
public void StartSpawn(ServerPlayer player, MsgAlive spawnRequest) { MsgAlive spawnPostion = new MsgAlive(); spawnPostion.IsSpawn = false; // TODO, run a thread task to find a spawn. bool ret = false; if (ComputeSpawn != null) { ret = ComputeSpawn(player, World, ref player.Info.LastSpawnState.Position, ref player.Info.LastSpawnState.Azimuth); } if (ret) { player.Info.Alive = true; PlayerSpawned?.Invoke(this, player); spawnPostion.PlayerID = player.PlayerID; spawnPostion.Position = player.Info.LastSpawnState.Position; spawnPostion.Azimuth = player.Info.LastSpawnState.Azimuth; SendToAll(spawnPostion, false); } }
public void HandleAlive(NetworkMessage msg) { MsgAlive alive = msg as MsgAlive; Player player = GetPlayerByID(alive.PlayerID); if (player == null) { return; } player.Active = true; player.PlayerSpawnTime = Clock.StepTime; player.SetTeleport(-1, null, null); player.Spawn(alive.Position, alive.Azimuth); if (alive.PlayerID == LocalPlayerID) { SelfSpawned?.Invoke(this, player); } PlayerSpawned?.Invoke(this, player); }