// // 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(); } } }
public void IncreaseAmmo(EGunType ammoGun) { if (_gun.currentGun == ammoGun) { this.ammo.gameObject.GetComponent <Animator>().SetTrigger("Increase"); } CrossPlay(); }
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); } }
public void DecreaseAmmo(EGunType itemType) { switch (itemType) { case EGunType.PISTOL: _pistolAmmo--; break; case EGunType.SHOTGUN: _shotgunAmmo--; break; case EGunType.ROCKET_LAUNCHER: _rocketLauncherAmmo--; break; } UpdateHUD(); }
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); }
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(); }
public void HeadHit(Vector3 location, Vector3 normal, EGunType gun, int damage, Transform parent) { BloodHit(location, normal, _smallFleshKeyHeadKey, parent); ApplyDamage(damage); }