Пример #1
0
 void Update()
 {
     if ((player.transform.position - transform.position).sqrMagnitude < awarenessRange * awarenessRange)
     {
         seekAgent.SetTarget(player.transform.position);
     }
 }
Пример #2
0
    // Update is called once per frame
    protected override void Update()
    {
        base.Update();

        if (Avoided)
        {
            wander.WanderAngle = spline.Orientation;
        }

        SteeringParameters parameters = new SteeringParameters();

        parameters.position       = spline.TopNodeWorld;
        parameters.linearVelocity = spline.LinearVelocity;
        parameters.Orientation    = spline.Orientation; //Also sets direction

        seek.SetTarget(player.TopNodeWorld);

        SteeringOutput newDirection = behaviour.CalculateSteering(Time.deltaTime, parameters);

        spline.GrowthDirection = newDirection.linearVelocity;
    }
Пример #3
0
 public void Detection()
 {
     seekAgent.SetTarget(player.transform.position);
 }