private void AddNewPhysicsBody(Physics physics, Rectangle area, Vector2D impulse)
		{
			var physicsBody = physics.CreateRectangle(area.Size);
			physicsBody.Position = area.Center;
			physicsBody.Rotation = impulse.RotationTo(Vector2D.UnitX);
			physicsBody.IsStatic = false;
			physicsBody.ApplyLinearImpulse(impulse);
			Add(physicsBody);
		}
		public PhysicalEntity2D(Physics physics, Rectangle drawArea, Vector2D impulse,
			float lifeTime = 0)
			: base(drawArea)
		{
			LifeTime = lifeTime;
			ElapsedTime = 0;
			AddNewPhysicsBody(physics, drawArea, impulse);
			Start<AffixToPhysics2D>();
		}
Beispiel #3
0
		public Game(Physics physics)
		{
			this.physics = physics;
			Rectangle viewport = ScreenSpace.Current.Viewport;
			physics.CreateEdge(viewport.BottomLeft, viewport.BottomRight);
			physics.CreateEdge(viewport.BottomLeft, viewport.TopLeft);
			physics.CreateEdge(viewport.TopRight, viewport.BottomRight);
			physics.CreateEdge(viewport.TopLeft, viewport.TopRight);
			CreateTowerOfBoxes();
			new Command(AddCircleOnClick).Add(new MouseButtonTrigger());
		}
Beispiel #4
0
		public Projectile2D(Physics physics, Vector2D impulse, Rectangle area, int damage)
			: base(physics, area, impulse)
		{
			Damage = damage;
		}