public void Check(string tag) { if (isAttacking) { Collider2D blockTest = Physics2D.OverlapCircle(handTransform.position + handOffset, radius, layerMask, -Mathf.Infinity); if (blockTest != null) { if (blockTest.gameObject.tag == tag && canDealDamage) { targetStats.TakeDamage(agentStats.damage.GetValue()); canDealDamage = false; if (fxManager != null) { fxManager.Shake(); } if (audioManager != null) { audioManager.Hit(); } } } } }
private void Update() { if (TFOG_GameManager.Instance.isGameOver) { return; } if (isAttacking) { Collider2D blockTest = Physics2D.OverlapCircle(handTransform.position + handOffset, radius, layerMask, -Mathf.Infinity); if (blockTest != null) { if (blockTest.gameObject.tag == StringsInGame.EnemyTag && canDealDamage) { targetStats.TakeDamage(agentStats.damage.GetValue()); canDealDamage = false; if (fxManager != null) { fxManager.Shake(); } if (audioManager != null) { audioManager.Hit(); } } } } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == StringsInGame.PlayerTag) { CharacterStats characterStats = collision.gameObject.GetComponent <CharacterStats>(); if (characterStats != null && aradisStats != null) { characterStats.TakeDamage(aradisStats.castDamage.GetValue()); impactParticles.PlayParticles(); } Deactivate(); if (fxManager != null) { fxManager.Shake(); } } else if (collision.tag == StringsInGame.TerrainTag) { Deactivate(); } }