Beispiel #1
0
    private void OnTriggerStay(Collider other)
    {
        if (other.tag == "Player")
        {
            if (Input.GetKeyDown(KeyCode.E))
            {
                Player player = other.GetComponent <Player>();

                if (player != null)
                {
                    if (player.temMoeda == true)
                    {
                        player.temMoeda = false;
                        ControladorUI controladorUI = GameObject.Find("Canvas").GetComponent <ControladorUI>();
                        if (controladorUI != null)
                        {
                            controladorUI.RemoverMoeda();
                        }

                        AudioSource audio = GetComponent <AudioSource>();
                        audio.Play();
                        player.AtivarArmas();
                    }

                    else
                    {
                        Debug.Log("Sai fora e vai buscar uma moeda, zé roela!");
                    }
                }
            }
        }
    }
Beispiel #2
0
    void Start()
    {
        controles = GetComponent <CharacterController>();

        Cursor.visible = false;

        Cursor.lockState = CursorLockMode.Locked;

        municaoAtual = municaoMaxima;

        controladorUI = GameObject.Find("Canvas").GetComponent <ControladorUI>();
    }
Beispiel #3
0
	void Awake()
	{
		camara = GameObject.FindWithTag ("MainCamera").GetComponent<Camara> ();
		controladorUI = GameObject.FindWithTag ("UI").GetComponent<ControladorUI> ();
		rbPersonaje = personaje.GetComponent<Rigidbody2D> ();
	}