Ejemplo n.º 1
0
 public void Launch(GameObject Source, ICAPTarget target)
 {
     Target = target.GetGameObject();
     Agent.Warp(CalculateClosest(Source.GetComponent <Collider>(), target.GetGameObject().transform));
     transform.LookAt(Target.transform.position);
     Agent.SetDestination(Target.transform.position);
     Agent.angularSpeed = .01f;
     Agent.speed        = 14f;
 }
Ejemplo n.º 2
0
 // Update is called once per frame
 public void Update()
 {
     ResetTarget();
     foreach (Turret t in turrets)
     {
         if (target != null && t.tType == TurretType.CAPITAL)
         {
             t.Target = target.GetGameObject();
         }
         try{
             if (pdtarget != null && t.tType == TurretType.PD)
             {
                 t.Target = pdtarget.GetGameObject();
             }
         }
         catch {
             Debug.Log("<color=red>Avoiding Target Lockup Error: Turret</color> This warning can be safely ignored.");
             t.Target = null;
         }
         pdTargetsCount = pdTargets.Count;
     }
 }
Ejemplo n.º 3
0
 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;
     }
 }
Ejemplo n.º 4
0
 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");
 }