コード例 #1
0
 public override void Fire(FirstPersonController player)
 {
     foreach (Transform child in firePositions)
     {
         SeekerMissile clone = (SeekerMissile)Instantiate(projectile);
         clone.transform.position = child.position;
         clone.transform.rotation = child.rotation;
         clone.target             = GetComponent <WeaponLockOn>().lockedShip.transform;
         clone.owner = player;
     }
 }
コード例 #2
0
 //Fire at any Rocket objects within the "vision radius"
 void OnTriggerStay(Collider other)
 {
     Debug.Log("other: " + other.tag);
     if (other.tag == "Rocket" && Time.fixedTime >= nextShot)
     {
         //create missile at current position, headed along the spawner's axis
         GameObject    o = Instantiate(Enemy, transform.position, Quaternion.identity) as GameObject;
         SeekerMissile e = o.GetComponent <SeekerMissile>();
         //Fire a shot along the y-axis of the spawner, at speed speed
         e.InitEnemy(transform.up, speed, missileTimeOut, other.transform.parent.gameObject);
         //update time of next shot
         nextShot = Time.fixedTime + interval;
     }
 }