Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetPortalOutingPoint()

static Vector2 Terraria.GameContent.PortalHelper.GetPortalOutingPoint ( Vector2 objectSize,
Vector2 portalPosition,
float portalAngle,
out int bonusX,
out int bonusY )
inlinestaticprivate

Definition at line 400 of file PortalHelper.cs.

401 {
402 int num = (int)Math.Round(MathHelper.WrapAngle(portalAngle) / ((float)Math.PI / 4f));
403 switch (num)
404 {
405 case -2:
406 case 2:
407 bonusX = ((num != 2) ? 1 : (-1));
408 bonusY = 0;
409 return portalPosition + new Vector2((num == 2) ? (0f - objectSize.X) : 0f, (0f - objectSize.Y) / 2f);
410 case 0:
411 case 4:
412 bonusX = 0;
413 bonusY = ((num == 0) ? 1 : (-1));
414 return portalPosition + new Vector2((0f - objectSize.X) / 2f, (num == 0) ? 0f : (0f - objectSize.Y));
415 case -3:
416 case 3:
417 bonusX = ((num == -3) ? 1 : (-1));
418 bonusY = -1;
419 return portalPosition + new Vector2((num == -3) ? 0f : (0f - objectSize.X), 0f - objectSize.Y);
420 case -1:
421 case 1:
422 bonusX = ((num == -1) ? 1 : (-1));
423 bonusY = 1;
424 return portalPosition + new Vector2((num == -1) ? 0f : (0f - objectSize.X), 0f);
425 default:
426 bonusX = 0;
427 bonusY = 0;
428 return portalPosition;
429 }
430 }
static float WrapAngle(float angle)
Definition MathHelper.cs:87
static decimal Round(decimal d)
Definition Math.cs:1096
const double PI
Definition Math.cs:16

References System.Math.PI, System.Math.Round(), and Microsoft.Xna.Framework.MathHelper.WrapAngle().

Referenced by Terraria.GameContent.PortalHelper.TryGoingThroughPortals().