Ejemplo n.º 1
0
        private void Update()
        {
            if (secondsTillSunrise < 0)
            {
                if (!sunRose)
                {
                    sunRose = true;
                    OnSunRise?.Invoke();
                }

                return;
            }

            secondsTillSunrise -= Time.deltaTime;

            if (!halfwaAlerted)
            {
                if (secondsTillSunrise < maxSecondsTillSunrise / 2)
                {
                    HUDController.Alert("I've made it halfway through the night.", 10f);
                    halfwaAlerted = true;
                }
            }

            if (!sunriseSoonAlerted)
            {
                if (secondsTillSunrise < sunriseSoonAlertSeconds)
                {
                    HUDController.Alert("Sunrise is soon, I have to keep the fire for a little longer.", 10f);
                    sunriseSoonAlerted = true;
                }
            }
        }
Ejemplo n.º 2
0
        public void TryTakeItem(GameObject item)
        {
            //safeguard so we won;t pick item twice accidentally
            //TODO: refactor: the item should have picked up property and it should have picking up logic, not inventory
            if (item == lastTakenItem)
            {
                return;
            }

            if (woodCarrying < maxCapacity)
            {
                //mark so we won't accidentally pick it up twice
                lastTakenItem = item;

                woodCarrying++;
                Destroy(item);
                print($"Picked up wood. Current wood: {woodCarrying}");
                HUDController.Alert("Picked up some wood. Can use it to light a torch or feed the campfire.",
                                    6f);

                pickupSourceSound.Play();

                if (woodCarrying >= maxCapacity)
                {
                    HUDController.Alert("Backpack is full, I have to find my way back to the campfire.", 10f);
                }
            }
            else
            {
                HUDController.Alert("Cannot carry any more wood. Have to find my way back to the campfire");
            }
        }
Ejemplo n.º 3
0
        public void Feed(int seconds)
        {
            secondsLeftToBurn += seconds;
            if (secondsLeftToBurn > maxSecondsToBurn)
            {
                secondsLeftToBurn = maxSecondsToBurn;
            }

            fadingLight.secondsToFadeOut = secondsLeftToBurn;
            fadingLight.Reignite();

            print($"Fed the fire. {secondsLeftToBurn} seconds left");
            HUDController.Alert("Fed the bonfire with all the wood I've found.", 6f);

            if (secondsLeftToBurn > alertAtSeconds)
            {
                //reset alert
                alertRaised = false;
            }
        }
Ejemplo n.º 4
0
        public void Update()
        {
            if (secondsLeftToBurn < 0)
            {
                if (!burnedDown)
                {
                    burnedDown = true;
                    onBurnedDown?.Invoke();
                }
            }
            else
            {
                secondsLeftToBurn -= Time.deltaTime;

                if (secondsLeftToBurn <= alertAtSeconds && !alertRaised)
                {
                    HUDController.Alert("Campfire will go out soon. I need to feed it with some wood.", 6f);
                    alertRaised = true;
                }
            }
        }
Ejemplo n.º 5
0
 private void Awake()
 {
     instance = this;
 }