Ejemplo n.º 1
0
 void Update()
 {
     if ((player.transform.position - transform.position).sqrMagnitude < awarenessRange * awarenessRange)
     {
         seekAgent.SetTarget(player.transform.position);
     }
 }
Ejemplo n.º 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;
    }
Ejemplo n.º 3
0
 public void Detection()
 {
     seekAgent.SetTarget(player.transform.position);
 }