Ejemplo n.º 1
0
 void FixedUpdate()
 {
     if (wep.target != null && !isDisabled && (pc == null || !pc.isManControl()))
     {
         targetRb      = wep.target.GetComponent <Rigidbody> ();
         targetLeadPos = FirstOrderIntercept
                         (
             transform.position,
             rb.velocity,
             wep.primarySpeed,
             wep.target.gameObject.transform.position,
             targetRb.velocity
                         );
         LookTowardsTarget(targetLeadPos);
         if ((transform.position - targetLeadPos).magnitude < wep.primaryRange)
         {
             if (Vector3.Angle(transform.forward, (targetLeadPos - transform.position)) <= 0.5f)
             {
                 if (!playerControl)
                 {
                     wep.Fire1();
                 }
             }
         }
     }
     else if (playerControl && !isDisabled)
     {
         PlayerWepController pwc = GetComponentInParent <PlayerWepController> ();
         LookTowardsTarget(pwc.dir.position + pwc.dir.forward * 1000f);
     }
 }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     bs = GetComponentInParent <BaseShip> ();
     pw = GetComponentInParent <PlayerWepController> ();
     pc = GetComponentInParent <PlayerControls> ();
 }