Exemplo n.º 1
0
    void Update()
    {
        transform.Rotate(0, 0, 20 * Time.deltaTime);

        foreach (Transform player in master.players.transform)
        {
            if (Vector3.Distance(player.transform.position, transform.position) < 0.4f)
            {
                if (player.GetComponent <Health>().healthPoints == 0)
                {
                    Destroy(gameObject);
                }
                else
                {
                    GameObject vfx = Instantiate(SpawnVFX, transform.position, Quaternion.identity);
                    vfx.GetComponent <AudioSource>().enabled = true;
                    vfx.GetComponent <AudioSource>().PlayOneShot(PwUpSFX);
                    player.GetComponent <PwUpEffect>().X2PwUpCounter = 2;
                    player.GetComponent <PwUpEffect>().IKPwUpCounter = 0;
                    master.StartCoroutine(master.CleanSpawnVFX(vfx, 3f));
                    master.GetComponent <MasterScript>().DisplayPowerUp();
                    Destroy(gameObject);
                }
            }
        }
    }
Exemplo n.º 2
0
    void Update()
    {
        transform.GetChild(1).transform.Rotate(0, 20 * Time.deltaTime, 0);

        foreach (Transform player in master.players.transform)
        {
            if (Vector3.Distance(player.transform.position, transform.position) < 0.4f)
            {
                GameObject vfx = Instantiate(SpawnVFX, transform.position, Quaternion.identity);
                vfx.GetComponent <AudioSource>().enabled = true;
                vfx.GetComponent <AudioSource>().Play();
                player.GetComponent <Points>().addPoints(150);
                master.StartCoroutine(master.CleanSpawnVFX(vfx, 1));
                master.icoins.Remove(gameObject);
                Destroy(gameObject);
            }
        }
    }