Example #1
0
 private void UpdateAngle()
 {
     if (npcAction == enumNPCActions.patrol)
     {
         if (target == null)
         {
             Debug.Log("Here: " + transform.parent.name);
         }
         target = patrol.GetTarget();
         angle  = Mathf.Atan2(transform.position.y - target.position.y, transform.position.x - target.position.x) * 180 / Mathf.PI * -1;
     }
 }
Example #2
0
    private void UpdateAngle()
    {
        if (enemyAction == enumEnemyActions.patrol)
        {
            target = patrol.GetTarget();
            angle  = Mathf.Atan2(transform.position.y - target.position.y, transform.position.x - target.position.x) * 180 / Mathf.PI * -1;
        }

        if (enemyAction == enumEnemyActions.chase || enemyAction == enumEnemyActions.healAlly ||
            enemyAction == enumEnemyActions.chaseDecoy)
        {
            angle = Mathf.Atan2(transform.position.y - target.position.y, transform.position.x - target.position.x) * 180 / Mathf.PI * -1;
        }
    }