Exemplo n.º 1
0
		public World()
		{
			this.InputManager = new InputManager();
			this.player = new Player(PlayerStartX, PlayerStartY, this.InputManager);
			const double ratioX = 0.0390625;
			const double ratioY = 0.0390625;
			var obstacles = new RectCollider[]
			{
				new RectCollider(0 * ratioX, 512 * ratioY, 768 * ratioX, 256 * ratioY),
				new RectCollider(16 * ratioX, 256 * ratioY, 16 * ratioX, 256 * ratioY),
				new RectCollider(384 * ratioX, 448 * ratioY, 96 * ratioX, 16 * ratioY),
				new RectCollider(128 * ratioX, 416 * ratioY, 96 * ratioX, 16 * ratioY),
				new RectCollider(256 * ratioX, 368 * ratioY, 96 * ratioX, 16 * ratioY),
				new RectCollider(384 * ratioX, 320 * ratioY, 96 * ratioX, 16 * ratioY),
				new RectCollider(512 * ratioX, 320 * ratioY, 96 * ratioX, 16 * ratioY),
				new RectCollider(512 * ratioX, 240 * ratioY, 96 * ratioX, 16 * ratioY),
				new RectCollider(256 * ratioX, 112 * ratioY, 96 * ratioX, 16 * ratioY),
				new RectCollider(160 * ratioX, 112 * ratioY, 96 * ratioX, 16 * ratioY)
			};

			this.updatables = new List<IUpdatable>();
			this.updatables.Add(this.player);

			this.drawables = new List<IDrawable>();
			this.drawables.Add(this.player);
			foreach (var obstacle in obstacles)
			{
				this.drawables.Add(obstacle);
			}

			this.collidables = new List<ICollidable>();
			this.collidables.Add(this.player);
			foreach (var obstacle in obstacles)
			{
				this.collidables.Add(obstacle);
			}

			this.player.AddCollidables(this.collidables);
		}
Exemplo n.º 2
0
		public Player(double x, double y, InputManager inputManager)
		{
			this.inputManager = inputManager;
			this.Reset(x, y);
		}