public void Shoot() { if (_reloadTimer <= 0) { StartCoroutine(_slowMotion.SlowMo(1f)); _muzzleFlash.Emit(1); _screenShake.Shake(0.1f, 0.1f); _knockback.AddKnockback(10f); _timer = _reloadTime; CreateBullet(); if (_bulletShell != null) { CreateBulletShell(); } AddSpread(); GunFX(); //increase spread for each bullet shot in the last x seconds with x min/max value. _reloadTimer = _reloadTime; _reload = true; } }
public void OnPlayerAttacked(float _x, float _y, float _z, float _time) { if (this.IsInvicible) { //Debug.Log(gameObject + " is invincible"); return; } if (PlayerKnockback != null) { PlayerKnockback.AddKnockback(new Vector3(_x, _y, _z)); } else { //Debug.LogWarning("PlayerKnockback is null!!!"); } }