Exemple #1
0
    private void Update()
    {
        SteeringBehavior.MaxSpeed    = MaxSpeed;
        SteeringBehavior.MaxVelocity = MaxVel;
        FollowingBehavior.Radius     = FollowManager.GetPointRadius();

        Vector2 sourcePos = new Vector2(transform.position.x, transform.position.y);

        Steer = FollowingBehavior.Follow(sourcePos, FollowManager.Path);

        Velocity = Steer * Time.deltaTime;
        Velocity = Vector3.ClampMagnitude(Velocity, MaxVel);

        this.transform.position += Velocity;
        Rotate();
    }