Example #1
0
    private UIPlayerScript uiPlayer;        //Acceso al UI del jugador

    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Player")                                                  //El collider detecto al jugador?
        {
            InventarioScript inventario = other.GetComponent <InventarioScript>();  //Se accede al inventario del jugador
            uiPlayer = other.GetComponent <UIPlayerScript>();                       //Se obtiene el UI

            if (inventario.currentItem != null)                                     //El jugador tiene un objeto en su inventario?
            {
                if (inventario.currentItem.CompareTag("Bidon"))                     //Dicho objeto es el bidon?
                {
                    boton.SetActive(true);                                          //Se muestra el boton de interaccion
                    bidon = inventario.currentItem.GetComponent <BidonScript>();    //Se obtiene el script del bidon
                }
            }
        }
    }
Example #2
0
 // Use this for initialization
 void Start()
 {
     gameObject.GetComponent<Button>().onClick.AddListener(delegate { clickFunction(); });
     uiScript = GameObject.FindGameObjectWithTag("Player").GetComponent<UIPlayerScript>();
 }
Example #3
0
 // intended to be on a object who's parent is player
 void Start()
 {
     resetToOffset();
     uiScript = transform.parent.gameObject.GetComponent<UIPlayerScript>();
     playerScript = GameObject.Find("CharacterRobotBoy").GetComponent<UserControl2D>();
 }