Exemple #1
0
    private void OnTriggerStay(Collider other)
    {
        // detects trigger collision (this method)
        Player player = other.GetComponent <Player>();

        // if other tag is "Player"
        if (other.tag == "Player")
        {
            // if the "e" key is pressed and required collectables met
            if (Input.GetKeyDown(KeyCode.E) && (player.CoinsCollected() >= _requiredCoins))
            {
                // toggle the panel call button
                if (_elevatorCalled == true)
                {
                    _callButton.material.color = Color.red;
                }
                else
                {
                    _callButton.material.color = Color.green;
                    _elevatorCalled            = true;
                }

                // play success audio


                // call and lower the elevator
                _elevator.CallElevator();
            }
            else
            {
                // play fail audio
                //Debug.LogError("Insufficient Coins " + player.CoinsCollected() + ": " + _requiredCoins + " coins are required to call the elevetor.");
            }
        }
    }
    private void OnTriggerStay(Collider other)
    {
        if (other.tag.Equals("Player"))
        {
            Player player = other.GetComponent <Player>();

            if (player != null)
            {
                if (Input.GetKeyDown(KeyCode.E) && (player.GetCoinCount() >= _coinsRequired))
                {
                    if (_elevatorCall == true)
                    {
                        _callButton.material.color = Color.red;
                    }
                    else
                    {
                        _callButton.material.color = Color.green;
                        _elevatorCall = true;
                    }

                    _elevator.CallElevator();
                }
            }
        }
    }
Exemple #3
0
 /// <summary>
 /// Called when the elevator arrives on the floor. (for stepping into the elevator)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void Person_ElevatorArrival(object sender, EventArgs e)
 {
     if (!_isDead)
     {
         _elevator = sender as Elevator;
         _elevator.CallElevator(TargetShaft.RoomPosition.Y, ElevatorDirection.Both);
         StartShaft.ElevatorArrival  -= Person_ElevatorArrival;
         TargetShaft.ElevatorArrival += TargetShaft_ElevatorArrival;
     }
 }
Exemple #4
0
    //----OR----

    private void OnTriggerStay(Collider other)
    {
        if (other.tag == "Player")
        {
            if (Input.GetKeyDown(KeyCode.E) && (_player.coins >= coincost || other.GetComponent <Player>().CoinCount() >= coincost))
            {
                _Call_Button_Mesh.material.color = Color.green;
                //elevatorCall = true;
                _elevator.CallElevator();
            }
        }
    }
Exemple #5
0
        public void CallElevatorFrom0To1()
        {
            Elevator elevator = new Elevator();

            elevator.CallElevator(1, ElevatorDirection.Both);

            for (int i = 0; i < 15; i++)
            {
                elevator.Update(1);
            }

            Assert.IsTrue(elevator.CurrentFloor == 1);
        }
Exemple #6
0
 private void OnTriggerStay(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         Player _player = other.GetComponentInParent <Player>();
         if (_player != null)
         {
             if (Input.GetKeyDown(KeyCode.E) && _player.CoinsCollected() >= _requiredCoins)
             {
                 _panelLight.material.color = _panelLight.material.color == Color.green ? Color.red : Color.green;
                 _elevator.CallElevator();
             }
         }
     }
 }
Exemple #7
0
    private void Update()
    {
        _numCoins = _player.GetCoins();

        if (Input.GetKeyDown(KeyCode.E) && _numCoins >= _coinsToCollect && _insideElevatorPanel)
        {
            if (_mr.material == _originalButtonMat)
            {
                _mr.material = _buttonMat;
            }
            else
            {
                _mr.material = _originalButtonMat;
            }

            _elevator.CallElevator();
        }
    }
 private void OnTriggerStay(Collider other)
 {
     if (other.tag == "Player")
     {
         Player player = other.GetComponent <Player>();
         if (Input.GetKeyDown(KeyCode.E) && player.CoinCount() >= _requiredCoins)
         {
             if (_elevatrorCalled)
             {
                 _callButton.material.color = Color.red;
             }
             else
             {
                 _callButton.material.color = Color.green;
                 _elevatrorCalled           = true;
             }
             _elevator.CallElevator();
         }
     }
 }
Exemple #9
0
    private void OnTriggerStay(Collider other)
    {
        if (other.tag == "Player")
        {
            Player player = other.GetComponent <Player>();
            _coins = player.GetCoinCount();

            if (Input.GetKeyDown(KeyCode.E))
            {
                if (_coins == _coinsReqd)
                {
                    _elevator.CallElevator(_thisFloor);
                    _calledToThisFloor = true;
                }
                else
                {
                    //play error sound
                }
            }
        }
    }
    private void OnTriggerStay(Collider other)
    {
        if (other.tag == "Player")
        {
            if (Input.GetKeyDown(KeyCode.E) && other.GetComponent <Player>().CoinCount() >= _requiredCoins)
            {
                if (_buttonColor == false)
                {
                    _callButton.material.color = Color.green;
                    _buttonColor = true;
                }
                else if (_buttonColor == true)
                {
                    _callButton.material.color = Color.red;
                    _buttonColor = false;
                }


                _elevator.CallElevator();
            }
        }
    }
Exemple #11
0
    private void OnTriggerStay(Collider other)
    {
        if (other.CompareTag("Player") && other.GetComponent <Player>().Getcoins() == _coinsRequired)
        {
            if (Input.GetKeyDown(KeyCode.E))
            {
                _mat = GameObject.Find("Call_Button").GetComponent <MeshRenderer>();

                if (_elevatorCalled == true)
                {
                    _mat.material.color = Color.red;
                }
                else
                {
                    _mat.material.color = Color.green;
                    _elevatorCalled     = true;
                }

                Elevator elevator = GameObject.Find("Elevator").GetComponent <Elevator>();
                elevator.CallElevator();
            }
        }
    }