Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
NPCAimedTarget.cs
Go to the documentation of this file.
3
5
6public struct NPCAimedTarget
7{
9
11
12 public int Width;
13
14 public int Height;
15
17
19
20 public bool Invalid => Type == NPCTargetType.None;
21
22 public Vector2 Center => Position + Size / 2f;
23
24 public Vector2 Size => new Vector2(Width, Height);
25
26 public NPCAimedTarget(NPC npc)
27 {
28 Type = NPCTargetType.NPC;
29 Hitbox = npc.Hitbox;
30 Width = npc.width;
31 Height = npc.height;
32 Position = npc.position;
33 Velocity = npc.velocity;
34 }
35
36 public NPCAimedTarget(Player player, bool ignoreTank = true)
37 {
38 Type = NPCTargetType.Player;
39 Hitbox = player.Hitbox;
40 Width = player.width;
41 Height = player.height;
42 Position = player.position;
43 Velocity = player.velocity;
44 if (!ignoreTank && player.tankPet > -1)
45 {
46 Projectile projectile = Main.projectile[player.tankPet];
47 Type = NPCTargetType.PlayerTankPet;
48 Hitbox = projectile.Hitbox;
49 Width = projectile.width;
50 Height = projectile.height;
51 Position = projectile.position;
52 Velocity = projectile.velocity;
53 }
54 }
55}
Vector2 velocity
Definition Entity.cs:16
Rectangle Hitbox
Definition Entity.cs:164
Vector2 position
Definition Entity.cs:14
static Projectile[] projectile
Definition Main.cs:1691
NPCAimedTarget(Player player, bool ignoreTank=true)