void Start() { tf = GetComponent <Transform>(); rb = GetComponent <Rigidbody>(); inputHandler = GetComponent <ShipInputHandler>(); ship = GetComponent <ShipController>(); }
void Awake() { GameObject player = GameObject.FindGameObjectWithTag("Player"); shipFuelHandler = player.GetComponent <ShipFuelHandler>(); hpHandler = player.GetComponent <HPHandler>(); shipInputHandler = player.GetComponent <ShipInputHandler>(); }
public void FindShip() { // When a player starts the game this grabs an open ship foreach (GameObject ship in GameObject.FindGameObjectsWithTag("Player")) { if (ship.TryGetComponent(out ShipInputHandler shipController)) { Controller = shipController; Controller.JoinShip(this); break; } } }
void Awake() { lineRenderer = GetComponent <LineRenderer>(); laserHitParticleSystem = GetComponentInChildren <ParticleSystem>(); laserParticleSystemEmissionModule = laserHitParticleSystem.emission; //Detach the laser particle system from the object it's attached to. laserHitParticleSystem.transform.parent = null; if (transform.root.CompareTag("Player")) { isPlayer = true; } shipInputHandler = GetComponentInParent <ShipInputHandler>(); }