//private bool isLighting; //I commented it because you don't need a duplicate since you can access the variable directly private void Start() { _lifeTime = lifetime; _playerLighter = FindObjectOfType <PlayerLighter>(); //Storing the Component in the variable //this work only because we know we have only one playerlighter in the scene, if there were more than one, this function will only return the first one it finds _graphsBounds = GetComponent <SphereCollider>().bounds; }
private void Awake() { if (instance == null) { instance = this; } if (instance != this) { Destroy(this); } }
private void Start() { playerLighter = player.GetComponent <PlayerLighter>(); torchLifetime = torches[0].lifetime; }
private void Start() { playerLighter = player.GetComponent <PlayerLighter>(); playerMovement = player.GetComponent <PlayerMovement>(); }