private void AddListeners() { countDown.OnCountdownFinished += FinishGame; foreach (Transform item in clusters) { TreeCluster cluster = item.GetComponent <TreeCluster> (); cluster.OnBurnt += DecreaseCount; cluster.OnBurningStart += OnFireStarted; cluster.OnBurningStop += OnFireStoped; } }
public TreeCluster GetIntersectedCluster() { TreeCluster cluster = null; if (isOn) { Vector3 origin = this.transform.position; Vector3 direction = this.transform.rotation * Vector3.up; RaycastHit hit; if (Physics.Raycast(origin, direction, out hit, 1000f, layerClusters)) { cluster = hit.transform.GetComponent <TreeCluster> (); } } return(cluster); }
private IEnumerator UpdateTemperataure() { while (true) { // heatup all clusters foreach (Transform obj in clusters) { TreeCluster cluster = obj.GetComponent <TreeCluster> (); cluster.Heatup(); } // cooldown intersected cluster TreeCluster intersectedCluster = showerTool.GetIntersectedCluster(); if (intersectedCluster != null) { intersectedCluster.Cooldown(showerTool.coolingPower); } yield return(new WaitForSeconds(0.3f)); } }