Ejemplo n.º 1
0
        //
        // Organizar melhor sistema decal-animação-partícula
        //
        //(outra classe)

        public void BodyHit(Vector3 location, Vector3 normal, EGunType gun, int damage, Transform t)
        {
            ApplyDamage(damage);

            if (gun == EGunType.PISTOL)
            {
                BloodHit(location, normal, _smallBloodHitKey, t);
                if (_dead)
                {
                    t.GetComponent <Rigidbody>().AddForceAtPosition(-normal * damage * 80f, location);
                }
            }
            else if (gun == EGunType.SHOTGUN)
            {
                BloodHit(location, normal, _bigBloodHitKey, t);
                _effects.SpawnParticlesFromBack(location, normal);
                if (_dead)
                {
                    t.GetComponent <Rigidbody>().AddForceAtPosition(-normal * damage * 140f, location);
                }
            }
            else if (gun == EGunType.ROCKET_LAUNCHER)
            {
                if (damage >= 100)
                {
                    ExplodeBody();
                }
            }
        }
Ejemplo n.º 2
0
 public void IncreaseAmmo(EGunType ammoGun)
 {
     if (_gun.currentGun == ammoGun)
     {
         this.ammo.gameObject.GetComponent <Animator>().SetTrigger("Increase");
     }
     CrossPlay();
 }
Ejemplo n.º 3
0
 protected void HitEnemy(RaycastHit hit, EGunType gun, int damage)
 {
     if (hit.collider.gameObject.tag == "Enemy")
     {
         hit.collider.gameObject.GetComponentInParent <PAIEnemy>().BodyHit(hit.point, hit.normal, gun, damage, hit.collider.gameObject.transform);
     }
     else if (hit.collider.gameObject.tag == "EnemyHead")
     {
         hit.collider.gameObject.GetComponentInParent <PAIEnemy>().HeadHit(hit.point, hit.normal, gun, damage * 3, hit.collider.gameObject.transform);
     }
 }
Ejemplo n.º 4
0
        public void DecreaseAmmo(EGunType itemType)
        {
            switch (itemType)
            {
            case EGunType.PISTOL: _pistolAmmo--; break;

            case EGunType.SHOTGUN: _shotgunAmmo--; break;

            case EGunType.ROCKET_LAUNCHER: _rocketLauncherAmmo--; break;
            }
            UpdateHUD();
        }
Ejemplo n.º 5
0
        public bool HasAmmo(EGunType _currentGun)
        {
            switch (_currentGun)
            {
            case EGunType.PISTOL: return(_pistolAmmo > 0);

            case EGunType.SHOTGUN: return(_shotgunAmmo > 0);

            case EGunType.ROCKET_LAUNCHER: return(_rocketLauncherAmmo > 0);
            }
            return(false);
        }
Ejemplo n.º 6
0
        private void ChangeGun()
        {
            _guns[(int)currentGun].gameObject.SetActive(false);

            if (_choosedGun < 0) //se for arma escolhida pelo scroll
            {
                if (_gunChanged > 0)
                {
                    while (true)
                    {
                        currentGun = (int)currentGun == (TOTAL_GUNS - 1) ? currentGun = 0 : ++currentGun;
                        if (_inventory.availableGuns [(int)currentGun])
                        {
                            break;
                        }
                    }
                }
                else
                {
                    while (true)
                    {
                        currentGun = currentGun == 0 ? currentGun = (EGunType)(TOTAL_GUNS - 1) : --currentGun;
                        if (_inventory.availableGuns [(int)currentGun])
                        {
                            break;
                        }
                    }
                }
            }
            else //se for arma escolhida pelo teclado
            {
                //se não tiver nas armas disponívies, não faça mais nada
                if (!_inventory.availableGuns[_choosedGun])
                {
                    return;
                }

                currentGun  = (EGunType)_choosedGun;
                _choosedGun = -1;
            }

            _guns[(int)currentGun].gameObject.SetActive(true);

            Inventory.Instance.RequestUpdateHUD();
        }
Ejemplo n.º 7
0
        public void HeadHit(Vector3 location, Vector3 normal, EGunType gun, int damage, Transform parent)
        {
            BloodHit(location, normal, _smallFleshKeyHeadKey, parent);

            ApplyDamage(damage);
        }