void FireMissile(GameObject target) { missile = (GameObject)Instantiate(weaponSystem.currentSlot.weapon, weaponSystem.weaponBay.position, weaponSystem.weaponBay.rotation); missileControl = missile.GetComponent <MissileControl> (); missileControl.host = this.gameObject; missileControl.target = target; }
//Collects the specs of the currently loaded missile void UpdateCurrentWeapon() { if (weaponLoadout.Count() > 0) { currentSlot = weaponLoadout.GetAt(slotIndex); missileControl = currentSlot.weapon.GetComponent <MissileControl> (); weaponRange = missileControl.effectiveRange; weaponAngle = missileControl.effectiveAngle; } }
void FireWeapon() { int count = targetSystemUI.lockedTargets.Count > 1 ? targetSystemUI.lockedTargets.Count : 1; for (int i = 0; i < count; i++) { GameObject missileClone = (GameObject)Instantiate(currentSlot.weapon, weaponBay.position, weaponBay.rotation); MissileControl mc = missileClone.GetComponent <MissileControl> (); mc.host = gameObject; mc.target = targetSystemUI.lockedTargets.Count > 0 ? targetSystemUI.lockedTargets [i].targetObject : null; currentSlot.capacity--; } }