Example #1
0
        /// <summary>
        /// Update is called once per frame.
        /// Check timer and change airQuality. Reset timer afterwards.
        /// Only affects airQuality if tree has water and is able to spend the costs.
        /// </summary>
        protected override void Update()
        {
            base.Update();
            timer -= Time.deltaTime;
            if (timer <= 0)
            {
                if (GetInteractableType() == InteractableType.SPROUT && amountWater >= 1)
                {
                    ChangeAirQuality(airQualityImpactAsSprout);
                }
                else if (GetInteractableType() == InteractableType.TREE && amountWater >= 1)
                {
                    ChangeAirQuality(airQualityImpactAsTree);
                }

                ResetTimer(CountdownTimer.GetCountdownInSec());
            }

            ChangeScaleOfTree();
            DistinguishSproutOrTree();
        }
Example #2
0
 /// <summary>
 /// Start timer with central CountdownTimer value.
 /// </summary>
 void Start()
 {
     ResetTimer(CountdownTimer.GetCountdownInSec());
     SetInteractableType(InteractableType.SPROUT);
 }
Example #3
0
        /// <summary>
        /// Start timer with central CountdownTimer value.
        /// Spawns villagers of the house.
        /// </summary>
        void Start()
        {
            ResetTimer(CountdownTimer.GetCountdownInSec());

            SpawnVillagers();
        }