Answers for "escalera de mano unity"

C#
0

escalera de mano unity

public float velocidadSubida = 5f;
     bool DentroEscalerilla = false;
 
     void OnTriggerEnter(Collider hit){
         //Si es el personaje el que esta en la escalerilla
         if (hit.gameObject.tag == "Escalerilla") {
             DentroEscalerilla = true;        
         }
     }
 
     void OnTriggerExit(Collider hit){
         if (hit.gameObject.tag == "Escalerilla") {
             DentroEscalerilla = false;
         }
     }
 
     void Update(){
             Vector3 movimiento = new Vector3 (0, velocidadSubida*Time.deltaTime, 0);
             if (DentroEscalerilla == true){                                 
                 if (Input.GetKey(KeyCode.W))
                 {
                     gameObject.transform.position += movimiento;                    
                 }
             }
     }
Posted by: Guest on August-24-2020

C# Answers by Framework

Browse Popular Code Answers by Language