コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (lantern == true && currentOil > 0)      // if player has oil and uses the lantern, the oil fuel starts to be used
        {
            currentOil = Mathf.Max(currentOil - (setOil * Time.deltaTime), 0);
        }

        if (currentOil <= 0)    // when the player runs out of oil the lantern turns off
        {
            lantern = false;
            playerStates.SetLanternState(false);
        }
    }