public void SetFlock(Flock f) { flock = f; if (target == null) { target = f.target; } }
private void Evade(SteeringAI target) { float velocity_mod = Vector3.Magnitude(target.transform.position - transform.position) / target.maxSpeed; Vector3 future_position = target.transform.position + target.velocity * velocity_mod; desired_velocity -= Seek(future_position); #if UNITY_EDITOR if (Selection.activeGameObject == gameObject) { Debug.DrawLine(transform.position, future_position, Color.red); } #endif }