private void OnTriggerEnter2D(Collider2D other) { Bullet bullet = other.gameObject.GetComponent <Bullet>(); Machete machete = other.gameObject.GetComponent <Machete>(); SlideKick slideKick = other.gameObject.GetComponent <SlideKick>(); Pipe pipe = other.gameObject.GetComponent <Pipe>(); if (!bullet && !machete && !slideKick && !pipe) { return; } if (bullet) { ProcessBulletHit(bullet); } if (machete) { ProcessMacheteHit(machete); } if (slideKick) { ProcessSlideKick(slideKick); } if (pipe) { PipeThrust(pipe); } }
private void ProcessMacheteHit(Machete machete) { //AudioSource.PlayClipAtPoint(hitSound, Camera.main.transform.position, hitSoundVolume); machete.CreateMacheteHitFX(); Vector2 macheteVelocity = machete.GetMacheteDeathHitVelocty() * new Vector2(DirectionOfPlayer(), 1); bodyPartRigidBody.velocity = macheteVelocity; }
private void ProcessMacheteHit(Machete machete) { //AudioSource.PlayClipAtPoint(hitSound, Camera.main.transform.position, hitSoundVolume); //add dust effect or somthing here Vector2 macheteVelocity = machete.GetMacheteDeathHitVelocty() * new Vector2(DirectionOfPlayer(), 1); rigidBody.velocity = macheteVelocity; }
private void ProcessMacheteHit(Machete machete) { health -= machete.GetDamage(); machete.CreateMacheteHitFX(); zombieMovement.zombieRigidBody.velocity += machete.GetMacheteHitVelocity() * new Vector2(-playerPosition.DirectionOfPlayer() * machetteHitVelocityMulitplier, 1); zombie.zombieAnimator.SetTrigger("TakingDamage"); zombie.zombieAnimator.SetBool("Biting", false); zombie.zombieAnimator.SetBool("Running", true); CheckIfDead(); }