public override void OnDraw() { base.OnDraw(); if (collider != null) { collider.Draw(); } }
// DrawLineEx(this.position, targets[0].position, 3, Color.BLUE); // Draws stuff public override void OnDraw() { base.OnDraw(); collider.Draw(); if (targets.Count > 0 && !onNewTarget) { DrawLineBezier(this.position, targets[0].position, 4, Color.BLUE); } UpdateList(); }
public void SetUpAI(Tank me, Tank target) { if (me != null && target != null) { this.AddChild(bulletSprite); bulletSprite.Load(bulletImage); this.SetPosition(me.position); collider = new BoxCollider(this, bulletSprite); point = target.position - me.position; pointNormalized = Vector3.Normalize(point); float angle = 0; float diff = CUtils.Distance(point + me.position, me.position, out angle); this.SetRotate(angle + 90); collider.Draw(); } }
// Setups the bullet so it will be ready to use. public void SetUp(Tank tank) { if (tank != null) { this.AddChild(bulletSprite); bulletSprite.Load(bulletImage); this.SetPosition(tank.position); collider = new BoxCollider(this, bulletSprite); point = GetMousePosition() - tank.position; pointNormalized = Vector3.Normalize(point); float angle = 0; float diff = CUtils.Distance(point + tank.position, tank.position, out angle); this.SetRotate(angle + 90); collider.Draw(); } }
// Draws the tank public void Draw() { if (tankObject != null) { // Vectors mouseVec1 = new Vector2(GetMouseX(), GetMouseY()); mouseVec2 = new Vector2(GetMouseX(), GetMouseY()); mousePoint = new BoxCollider(mouseVec1, mouseVec2); // Drawing the mouse collider mousePoint.Draw4(mouseVec1, mouseVec2); // Draw the other stuff tankObject.Draw(); collider.Draw(); DrawText(name, (int)position.x, (int)position.y - 40, 14, nameColor); if (drawAmmo) { DrawText($"Ammo: {ammo}", (int)position.x, (int)position.y - 60, 14, nameColor); } } }