public override void Calculate(RoamingNPC t) { if (t.rootDuration > 0) { t.rootDuration--; } else if (t.rooted) { t.rooted = false; } if (t.sleeping) { return; } if (!t.gameObject.transform.parent.gameObject.activeSelf) { return; } t.CurrentTarget = t.playerStats; t.LastKnownTargetPos = t.playerStats.pos; t.TriggerEffectTasks(); if (t.CurrentTarget != null && t.CurrentTarget.currHp == 0) { t.CurrentTarget = null; } if (t.CurrentTarget != null) { if (t.runCounter > 0) { Vector2Int runCell = t.__position + t.runDirection; t.runCounter--; MoveTo(t, runCell.x, runCell.y); } else { t.path = null; t.path = AStar.CalculatePathNoCollisions(t.__position, t.CurrentTarget.pos); MoveTo(t, t.path[0].x, t.path[0].y); } } }