Ejemplo n.º 1
0
    void OnTriggerStay(Collider other) // will be called as long as we are standing w/ in trigger zone
    {
        if (other.tag == "Player")
        {
            int playerCoinCount = other.GetComponent <Player>().CoinCount();

            if (Input.GetKeyDown(KeyCode.E) && playerCoinCount >= _liftCoinGoal)
            {
                if (_liftCalled == true)
                {
                    _callButton.GetComponent <MeshRenderer>().material.color = Color.red;
                    // _callButton.material.color = Color.green;
                }
                else
                {
                    _callButton.GetComponent <MeshRenderer>().material.color = Color.green;
                    _liftCalled = true;
                }

                _lift.CallLift(); // call lift
            }
        }
    }