void OnTriggerStay2D(Collider2D collider) { if (collider.tag == "Player") { Debug.Log("Enemy can see player"); RaycastHit2D[] detectChecks = Physics2D.RaycastAll(enemyCollider.transform.position, (Vector2)collider.transform.position - (Vector2)enemyCollider.transform.position, detectRange); bool canSeePlayer = false; foreach (RaycastHit2D check in detectChecks) { if (check.collider != null && check.collider.gameObject.tag == "Player") { canSeePlayer = true; } } if (canSeePlayer) { WerewolfStateController wolfController = collider.gameObject.GetComponent <WerewolfStateController>(); if (wolfController.wolfForm) { stateController.detectedPlayer = collider.gameObject; stateController.GoToAttackState(); } if (seeingEnemy == false) { SpottedEnemy(); } } } }