AngryTanks.Server.Player.Spawn C# (CSharp) Method

Spawn() public method

Spawns the Player and notifies all other Players about it.
public Spawn ( ) : void
return void
        public void Spawn()
        {
            // create our spawn message and packet
            NetOutgoingMessage spawnMessage = gameKeeper.Server.CreateMessage();

            MsgSpawnPacket spawnPacket = new MsgSpawnPacket(this.Slot, Vector2.Zero, 0);

            // write to the message
            spawnMessage.Write((Byte)spawnPacket.MsgType);
            spawnPacket.Write(spawnMessage);

            // send the spawn message to everyone
            gameKeeper.Server.SendToAll(spawnMessage, null, NetDeliveryMethod.ReliableOrdered, 0);

            // they're now alive as far as we're concerned
            state = PlayerState.Alive;
        }