public void Execute() { switch (collision.GetFirstEntityRelativePosition()) { case CollisionConstants.Direction.Up: firstEntity.SetLocation(new Vector2(firstEntity.GetLocation().X, firstEntity.GetLocation().Y - collision.GetOverlap().Height)); break; case CollisionConstants.Direction.Down: firstEntity.SetLocation(new Vector2(firstEntity.GetLocation().X, firstEntity.GetLocation().Y + collision.GetOverlap().Height)); break; case CollisionConstants.Direction.Left: firstEntity.SetLocation(new Vector2(firstEntity.GetLocation().X - collision.GetOverlap().Width, firstEntity.GetLocation().Y)); break; case CollisionConstants.Direction.Right: firstEntity.SetLocation(new Vector2(firstEntity.GetLocation().X + collision.GetOverlap().Width, firstEntity.GetLocation().Y)); break; } }
public void Execute() { if (secondEntity.GetBlockState() is NotActivatedBlockState) { switch (collision.GetFirstEntityRelativePosition()) { case CollisionConstants.Direction.Up: firstEntity.SetLocation(new Vector2(firstEntity.GetLocation().X, firstEntity.GetLocation().Y + collision.GetOverlap().Height)); break; case CollisionConstants.Direction.Down: if (firstEntity.GetMovementState() is MarioLeftJumpState || firstEntity.GetMovementState() is MarioRightJumpState) { secondEntity.Activate(); } else { firstEntity.SetLocation(new Vector2(firstEntity.GetLocation().X, firstEntity.GetLocation().Y - collision.GetOverlap().Height)); } break; case CollisionConstants.Direction.Left: firstEntity.SetLocation(new Vector2(firstEntity.GetLocation().X + collision.GetOverlap().Width, firstEntity.GetLocation().Y)); break; case CollisionConstants.Direction.Right: firstEntity.SetLocation(new Vector2(firstEntity.GetLocation().X - collision.GetOverlap().Width, firstEntity.GetLocation().Y)); break; } } }
public void Execute() { if (collision.GetFirstEntityRelativePosition() is CollisionConstants.Direction.Up && !(secondEntity.GetConditionState() is EnemyDefeatedState) && collision.GetOverlap().Height < 4) { firstEntity.SetLocation(new Vector2(firstEntity.GetLocation().X, firstEntity.GetLocation().Y - collision.GetOverlap().Height)); secondEntity.TakeDamage(); } else if (!(secondEntity.GetConditionState() is EnemyDefeatedState)) { firstEntity.TakeDamage(); } }