void Shoot() { muzzle.Play(); currentAmmo -= 1; RaycastHit hit; if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range)) { //Debug.Log(hit.transform.name); HitEnemy hitEnemy = hit.transform.GetComponent <HitEnemy>(); if (hitEnemy != null) { if (hit.transform.name.Equals("HeadHitMarker")) { hitEnemy.Damage(headDamage); } else { hitEnemy.Damage(torsoArmDamage); } GameObject go1 = Instantiate(enemyHit, hit.point, Quaternion.LookRotation(hit.normal)); Destroy(go1, 2f); } else { GameObject go2 = Instantiate(impact, hit.point, Quaternion.LookRotation(hit.normal)); Destroy(go2, 2f); } } }
// Start is called before the first frame update void Start() { animator = GetComponent <Animator>(); enemyScript = GetComponentInChildren <HitEnemy>(); if (enemyScript != null) { enemyScript.isKicking = false; } }
public void Init(Player player, HitEnemy onHitEnemyCallback) { base.Init(player); movement.Init(player); effect.Init(player); OnHitEnemy = onHitEnemyCallback; sound = SoundManager.instance; collision.OnTriggerStay += HandleCollideWithEnemy; }
// Start is called before the first frame update void Start() { combat = GetComponent <PlayerCombat>(); shotgunShells = GameObject.FindGameObjectsWithTag("ShotgunShell"); maxAmmo = shotgunShells.Length; enemyHealth = GameObject.FindGameObjectWithTag("Enemy").GetComponent <EnemyHealth>(); currentAmmo = maxAmmo; source = GetComponent <AudioSource>(); anim = GetComponent <Animator>(); hitEnemy = pellets.GetComponent <HitEnemy>(); hitEnemy.SetDamage(damage); }
protected override void OnCollisionEnter(Collision collision) { Debug.Log("OnHit"); if (collision.collider.CompareTag("Enemy")) { HitEnemy.Invoke(); } else { HitDown.Invoke(); } }
public void Destroy() { foreach (BattleUnitModel unit in BattleObjectManager.instance.GetAliveList()) { if (unit.bufListDetail.GetActivatedBufList().Find((Predicate <BattleUnitBuf>)(x => x is HitDebuff)) is HitDebuff Hit) { Hit.Destroy(); } if (unit.bufListDetail.GetActivatedBufList().Find((Predicate <BattleUnitBuf>)(x => x is HitDebuffEnemy)) is HitDebuffEnemy HitEnemy) { HitEnemy.Destroy(); } } }
public void Init(Player player, HitEnemy onHitEnemyCallback) { base.Init(player); OnHitEnemy = onHitEnemyCallback; sound = SoundManager.instance; }