Exemplo n.º 1
0
 public void Invocation(progetile progetile, Vector3 pos)
 {
     this.progetile     = progetile;
     pos.z             -= 1f;
     transform.position = pos;
     gameObject.SetActive(true);
 }
Exemplo n.º 2
0
    public static progetile GetBullets(progetile which)
    {
        GameObject obj = null;

        while (!obj)
        {
            List<GameObject> list = repositoryNow.progetilesList.FindAll(x => x.GetComponent<progetile>().NameId() == which.NameId());
            obj = GetObjInList(list, typesObjs.progetiles, which.gameObject);
        }

        return obj.GetComponent<progetile>();
    }
Exemplo n.º 3
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        playerControll pct = collision.GetComponentInParent <playerControll>();
        progetile      prt = collision.GetComponent <progetile>();

        if (pct || prt && prt.GetAtbOwner().GetActions().GetPlayerControll())
        {
            if (!pct)
            {
                pct = prt.GetAtbOwner().GetActions().GetPlayerControll();
            }
        }

        BoxDisable(pct);
    }
Exemplo n.º 4
0
    public void InocationBullet()
    {
        if (weaponNow1)
        {
            weaponInfs wpInf = GetWeaponInfs();
            progetile  p     = wpInf.GetBullet();
            p = repository.GetBullets(p);
            //Posição da saida da bala
            Vector3 pos = hand1.position + transform.rotation * wpInf.GetPosExitBullet();
            //Posição da mira do personagem
            Vector3 targetPos = transform.up * (wpInf.GetReach() + hand1.localPosition.y + wpInf.GetPosExitBullet().y) + transform.position;
            //Calculando direção do tiro
            Vector3 dire = targetPos - pos;
            dire.z = 0f;
            p.Inocation(wpInf, pos, dire.normalized, atb);
            //Consumo de balas
            int n = 1;
            //É uma arma dupla?
            if (wpInf.IsDual())
            {
                n = 2;
                p = wpInf.GetBullet();
                p = repository.GetBullets(p);
                //Posição da saida da bala
                pos = hand2.position + transform.rotation * wpInf.GetPosExitBullet();
                //Posição da mira do personagem
                targetPos = transform.up * (wpInf.GetReach() + hand2.localPosition.y + wpInf.GetPosExitBullet().y) + transform.position;
                //Calculando direção do tiro
                dire   = targetPos - pos;
                dire.z = 0f;
                p.Inocation(wpInf, pos, dire.normalized, atb);
            }

            if (playerControll)
            {
                playerControll.AddAmmunition(-n);
            }
        }
    }