//Attacks public void HandleAttack() { //attackAction.NormalAttack(TauntRadius, this.transform); List <Collider> enemiesInRange = attackAction.ConeAttack(); countAttacks++; //add reputation foreach (Collider enemy in enemiesInRange) { MonsterAI monster = enemy.GetComponent <MonsterAI>(); if (monster.GetType() == typeof(SheepAI)) { if (GameDialogUI != null && countTime > globalCooldown && !hasHitSheep) { globalCooldown += 30; GameDialogUI.StartCoroutine("YouHitSheep"); hasHitSheep = true; } } else { countAttackedMonstr++; if (countAttackedMonstr > 2 && countAttacks > 2 && GameDialogUI != null && countTime > globalCooldown && !hasAttacked3) { GameDialogUI.StartCoroutine("StopAttacking"); globalCooldown += 30; countAttackedMonstr = 0; countAttacks = 0; hasAttacked3 = true; } } Vector3 midVec = Vector3.Normalize(transform.position - monster.transform.position); Vector3 hitPoint = monster.transform.position + (midVec * 0.2f); GameObject hP = Instantiate(hitParticle) as GameObject; hP.transform.position = hitPoint; //EditorApplication.isPaused = true; pb.ChangeRepScore(monster.PlayerAttackReputation()); pb.Invoke(); } }