Example #1
0
    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;
        }
    }
Example #2
0
    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);
    }
Example #3
0
    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));
        }
    }