void FixedUpdate() { if (character.AttackContactWillLand()) { character.AttackContact(); } else { if (lastUpdateTime + updateRate + updateOffset < Time.time) { Transform closestTarget = character.GetClosestTargetTransformInVisionRange(); if (closestTarget != null) { target = closestTarget; } lastUpdateTime = Time.time; } if (target == null) { GetRandomTarget(); } if (target != null) { character.MoveToPosition(target.position); } } }
void FixedUpdate() { Transform target = character.GetClosestTargetTransformInVisionRange(); if (target != null) { character.ShootAt(target.position); } }