public void InitializeItem(Item newItem) { NewObjectCommand newDBoost = new NewObjectCommand(newItem); game.getWorldObjects().Add(newItem); SendCommandsToObservers(newDBoost); }
/// <summary> /// initialize the first player /// </summary> /// <param name="newPlayer"></param> public void InitializePlayer(Player newPlayer) { //new player krijgt zn guid en game guid InitializePlayerCommand cmd = new InitializePlayerCommand(newPlayer.guid, game.gameId, newPlayer.x, newPlayer.y, newPlayer.z); observers[observers.Count - 1].OnNext(cmd); //alle andere spelers krijgen die nieuwe speler NewObjectCommand cmd2 = new NewObjectCommand(newPlayer); SendCommandsToObservers(cmd2); //de nieuwe speler krijgt alle worldobjects List <Object3D> worldObjects = game.getWorldObjects(); foreach (Object3D obj in worldObjects) { NewObjectCommand cmd3 = new NewObjectCommand(obj); observers[observers.Count() - 1].OnNext(cmd3); } }