public void PlayerCreated(object sender, PlayerCreatedEventArgs pcea) { Peer peer1 = (Peer)sender; int playerID = pcea.Message.PlayerID; PlayerInformation playerInfo = peer1.GetPeerInformation(playerID); if (playerInfo.Local) { ID = playerID; Name = playerInfo.Name; } else { Heli.Helicopter h = new Heli.Helicopter(playerInfo.Name + playerID, @"dane\heliData.xml", true); RemotePlayer newPlayer = new RemotePlayer(playerID, playerInfo.Name, h); curLevel.AddObject(h); factory.InsertObject(h); lock (otherPlayers) { otherPlayers.Add(playerID, newPlayer); } } }
public void Execute() { foreach (GameObjectPart part in _objectToAdd) { if (part.Sprites[0].Texture == null) { throw new NullReferenceException("Texture cannot be null."); } } _addedObject = _objectToAdd.CopyObjectToWorld(_level.World, ConvertUnits.ToSimUnits(_position)); _addedObject.Camera = _level.Camera; _level.AddObject(_addedObject); _level.World.ProcessChanges(); }
public void Unexecute() { _level.AddObject(_deletedObject.CopyObjectToWorld(_level.World, Vector2.Zero)); _level.World.ProcessChanges(); }