Exemplo n.º 1
0
    public override void Execute(Steerable steerable)
    {
        base.Execute(steerable);

        if (targetFlare)
        {
            // Override the steerable's min/max speed
            if (overrideSteerableSpeed)
            {
                steerable.MinSpeed = minSpeed;
                steerable.MaxSpeed = maxSpeed;
            }
            // Override the steerable's max force
            if (overrideMaxForce)
            {
                steerable.MaxForce = maxForce;
            }

            // Seek the light source
            arrivalForce.Execute(steerable);
        }
        else
        {
            // If the flare has been destroyed, stop seeking it
            ActionCompleted();
        }

        wallAvoidance.Execute(steerable);
    }