Пример #1
0
    void Update()
    {
        if (fist)
        {
            tempoInimigo -= Time.deltaTime * 2;;
        }
        tempoInimigo -= Time.deltaTime;
        if (tempoInimigo < 0)
        {
            fist = false;
            switch (Random.Range(0, 3))
            {
            case 0:
                foxScript.NovoInimigo(new Vector3(0f, 0f, 0f), false);
                break;

            case 1:
                wolfScript.NovoInimigo(new Vector3(0f, 0f, 0f), false);
                break;

            default:
                crocScript.NovoInimigo(new Vector3(0f, 0f, 0f), false);
                break;
            }
            tempoInimigo = defTempoInimigo;
        }
    }
Пример #2
0
    void OnTriggerEnter2D(Collider2D coll)
    {
        if (coll.gameObject.tag == "dozeTiroDrop")
        {
            Destroy(coll.gameObject);
            if (tirosControllerScript.qntdDoze.text == "")
            {
                tirosControllerScript.qntdDoze.text = "20";
                tirosControllerScript.eggDozeInativo.SetActive(true);
            }
            else
            {
                tirosControllerScript.qntdDoze.text = int.Parse(tirosControllerScript.qntdDoze.text) + 20 + "";
            }
        }
        if (coll.gameObject.tag == "canonTiroDrop")
        {
            Destroy(coll.gameObject);
            if (tirosControllerScript.qntdCanon.text == "")
            {
                tirosControllerScript.qntdCanon.text = "10";
                tirosControllerScript.eggCanonInativo.SetActive(true);
            }
            else
            {
                tirosControllerScript.qntdCanon.text = int.Parse(tirosControllerScript.qntdCanon.text) + 10 + "";
            }
        }

        if (coll.gameObject.tag == "foxDrop")
        {
            foxScript.NovoInimigo(coll.gameObject.transform.position, true);
            Destroy(coll.gameObject);
        }
        if (coll.gameObject.tag == "wolfDrop")
        {
            wolfScript.NovoInimigo(coll.gameObject.transform.position, true);
            Destroy(coll.gameObject);
        }
        if (coll.gameObject.tag == "crocDrop")
        {
            crocScript.NovoInimigo(coll.gameObject.transform.position, true);
            Destroy(coll.gameObject);
        }
    }