Ejemplo n.º 1
0
    IEnumerator Pickup(Collider player)
    {
        Instantiate(pickupEffect, transform.position, transform.rotation);

        GetComponent <MeshRenderer> ().enabled = false;
        GetComponent <Collider> ().enabled     = false;

        ghost = GameObject.Find("GhostRed").GetComponent <GhostScript> ();
        ghost.makeGhostBlue();
        ghost = GameObject.Find("GhostYellow").GetComponent <GhostScript> ();
        ghost.makeGhostBlue();
        ghost = GameObject.Find("GhostGreen").GetComponent <GhostScript> ();
        ghost.makeGhostBlue();
        ghost = GameObject.Find("GhostCyan").GetComponent <GhostScript> ();
        ghost.makeGhostBlue();

        yield return(new WaitForSeconds(duration));

        ghost = GameObject.Find("GhostRed").GetComponent <GhostScript> ();
        ghost.getDefaultColorback();
        ghost = GameObject.Find("GhostYellow").GetComponent <GhostScript> ();
        ghost.getDefaultColorback();
        ghost = GameObject.Find("GhostGreen").GetComponent <GhostScript> ();
        ghost.getDefaultColorback();
        ghost = GameObject.Find("GhostCyan").GetComponent <GhostScript> ();
        ghost.getDefaultColorback();

        Destroy(gameObject);
    }