public virtual void Fire() { if (tType == TurretType.CAPITAL) { if (!CanFire || target == null || !self.shipClass.Power.UsePower(powerCost)) { return; } // Debug.DrawLine (self.transform.position, target.GetGameObject().transform.position, lineC, .05f); lr.SetPositions(new Vector3[] { self.transform.position, target.GetGameObject().transform.position }); if (ForceMagnitude > 0f) { target.DealPhysicsDamage(Damage, self.transform.position, ForceMagnitude, self.transform, Pattern); } else { target.DealDamage(Damage, self.transform.position, self.transform, Pattern); } StartCoroutine("Reload"); CanFire = false; if (light) { StartCoroutine("MuzzleFlash"); } } if (tType == TurretType.PD) { if (!CanFire || pdTarget == null || !self.shipClass.Power.UsePower(powerCost)) { return; } // Debug.DrawLine (self.transform.position, pdTarget.GetGameObject().transform.position, lineC, .05f); pdTarget.HitByPD((int)Damage); StartCoroutine("Reload"); CanFire = false; } }
public void Detonate(ICAPTarget targ) { targ.DealDamage(12f - (2f * Vector3.Distance(targ.GetGameObject().transform.position, transform.position)), transform.position, transform, MissileWarhead.Pattern); MissileWarhead.armed = false; StartCoroutine("Destroy"); }