I Have a bool on a rocket that when false it will fire the rocket. Then I have a control script that will index all the rockets with a specific tag in to an array. The problem I am having is changing the value of the bool from the control .
This is what I have so far
using UnityEngine;
using System.Collections;
public class MissileFireSystem : MonoBehaviour
{
public GameObject[] rockets;
public string firingMethod;//what input axis is being used?
public int rocketToFire;
// Use this for initialization
void Start()
{
rockets = GameObject.FindGameObjectsWithTag("rocket#1");//getting all of the rockets, rocket#1 refers to the hydra 70 rockets
for (int i=0; i>rockets.Length; i++)
{
RocketPropulsion rocketComponent = rockets *.GetComponent<RocketPropulsion> ();*
-
}* -
}*
-
// Update is called once per frame*
-
void Update()*
-
{*
-
if (Input.GetButtonDown(firingMethod))* -
{* -
rockets[rocketToFire].rocketComponent.weaponSafe = false;//this will fire the rocket* -
print (rockets[rocketToFire]);* -
rocketToFire = rocketToFire + 1;* -
}* -
}*
}
On the second script is just
when weaponSafe = false fire the rocket.
Thanks ! Helps a ton
– SuperPurpleByteNot a problem, happy to help
– Symphony