コード例 #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!");
                    }
                }
            }
        }
    }
コード例 #2
0
    void Start()
    {
        controles = GetComponent <CharacterController>();

        Cursor.visible = false;

        Cursor.lockState = CursorLockMode.Locked;

        municaoAtual = municaoMaxima;

        controladorUI = GameObject.Find("Canvas").GetComponent <ControladorUI>();
    }
コード例 #3
0
ファイル: Generador.cs プロジェクト: rickymoli/flappyFire
	void Awake()
	{
		camara = GameObject.FindWithTag ("MainCamera").GetComponent<Camara> ();
		controladorUI = GameObject.FindWithTag ("UI").GetComponent<ControladorUI> ();
		rbPersonaje = personaje.GetComponent<Rigidbody2D> ();
	}