Exemplo n.º 1
0
		private void DestroyCoin(Coin coinToDestroy)
		{
			coins.Remove (coinToDestroy);
			gameplayLayer.RemoveChild (coinToDestroy);
			coinToDestroy.Dispose ();
		}
Exemplo n.º 2
0
		private bool TryCreateEntity(string entityType, float worldX, float worldY)
		{
			CCNode entityAsNode = null;

			switch (entityType)
			{
			case "Player":
				player = new Player ();
				entityAsNode = player;
				break;
			case "Coin":
				Coin coin = new Coin ();
				entityAsNode = coin;
				coins.Add (coin);
				break;
			case "Door":
				door = new Door ();
				entityAsNode = door;
				break;
			case "Spikes":
				var spikes = new Spikes ();
				this.damageDealers.Add (spikes);
				entityAsNode = spikes;
				break;
			case "Enemy":
				var enemy = new Enemy ();
				this.damageDealers.Add (enemy);
				this.enemies.Add (enemy);
				entityAsNode = enemy;
				break;
			}

			if(entityAsNode != null)
			{
				entityAsNode.PositionX = worldX;
				entityAsNode.PositionY = worldY;
				gameplayLayer.AddChild (entityAsNode);
			}

			return entityAsNode != null;
		}