Exemplo n.º 1
0
        private void UpdateRotation()
        {
            Func <CollisionData, bool> onCollision = collisionData =>
            {
                if (collisionData.OtherCollider.Body.GameObject is Player)
                {
                    Level.Reset();
                }
                return(false);
            };

            if (rotation == 0)
            {
                body.AddCollider(new RectangleCollider(body, CollisionGroup.Ground, new Vector2(0, BlockWidth - height), new Vector2(BlockWidth, height), onCollision));
            }
            else if (rotation == 1)
            {
                body.AddCollider(new RectangleCollider(body, CollisionGroup.Ground, new Vector2(0, 0), new Vector2(height, BlockWidth), onCollision));
            }
            else if (rotation == 2)
            {
                body.AddCollider(new RectangleCollider(body, CollisionGroup.Ground, new Vector2(0, 0), new Vector2(BlockWidth, height), onCollision));
            }
            else if (rotation == 3)
            {
                body.AddCollider(new RectangleCollider(body, CollisionGroup.Ground, new Vector2(BlockWidth - height, 0), new Vector2(height, BlockWidth), onCollision));
            }
        }
Exemplo n.º 2
0
 public void Die()
 {
     Level.Reset();
 }