Example #1
0
    void searchPro()
    {
        _animations.SetBool("Range", false);

        Vector3 explosionPos = transform.position;

        Collider[] colliders = Physics.OverlapSphere(explosionPos, 50);

        foreach (Collider hit in colliders)
        {
            if (hit.gameObject.tag == "EnemyS")
            {
                troop = hit.gameObject.GetComponent <Infantry>();
                if (troop.status() < 30)
                {
                    troop.begin(0, this.gameObject);
                }
                _estado = estados.protect;
                break;
            }
        }
    }
Example #2
0
    void formUp()
    {
        Vector3 explosionPos = transform.position;

        Collider[] colliders = Physics.OverlapSphere(explosionPos, 50);

        _estado = estados.bajoOrdenes;

        foreach (Collider hit in colliders)
        {
            if (hit.gameObject.tag == "EnemyS")
            {
                troop = hit.gameObject.GetComponent <Infantry>();

                if (troop.begin(numeroSoldado, this.gameObject))
                {
                    unidades.Add(troop.gameObject);
                    numeroSoldado++;
                }
            }

            if (hit.gameObject.tag == "ArmoredE")
            {
                sTroop = hit.gameObject.GetComponent <Shield>();

                if (sTroop.begin(numeroEscudo, this.gameObject))
                {
                    unidades.Add(sTroop.gameObject);
                    numeroEscudo++;
                }
            }
        }

        onOrder = true;
        check();
    }