private void EdgeOverlapBegin(Physics2DComponent thisComponent, Physics2DComponent otherComponent) { if (otherComponent.Owner is Ball ball) { if (thisComponent.Owner == LeftEdge) { Goal?.Invoke(ESide.Right); return; } if (thisComponent.Owner == RightEdge) { Goal?.Invoke(ESide.Left); return; } if (thisComponent.Owner == TopEdge) { ball.MovementDirection = VSEMath.MirrorPoint(ball.MovementDirection, Vector2.UnitY) * -1; return; } if (thisComponent.Owner == BottomEdge) { ball.MovementDirection = VSEMath.MirrorPoint(ball.MovementDirection, Vector2.UnitY) * -1; return; } } }
protected Vector2 GlobalToLocal(Vector2 point) { return(VSEMath.RotatePointOnAngle(point - Location, -Angle)); }