void OnTriggerEnter2D(Collider2D other) { if (gameObject.name == "HitCollider" && other.gameObject.CompareTag("Player")) { PlayerMovement_v2 playerControl = other.GetComponent <PlayerMovement_v2>(); playerControl.SpawnHitEffect(); playerControl.isInInvincible = true; playerControl.hitAudio.Play(); playerControl.playerHealth -= 1f; } }
void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("Player")) { PlayerMovement_v2 playerControl = other.GetComponent <PlayerMovement_v2>(); playerControl.SpawnHitEffect(); playerControl.hitAudio.Play(); playerControl.GetComponent <BoxCollider2D>().enabled = false; playerControl.isInInvincible = true; playerControl.playerHealth -= 1; Destroy(gameObject); } }
public void SetDirection(Vector3 _direction, PlayerMovement_v2 incomingScript) { direction = _direction; playerMovement = incomingScript; }