30 lines
692 B
C#
30 lines
692 B
C#
using Code.Base;
|
|
using Code.Lab1;
|
|
using UnityEngine;
|
|
|
|
namespace Code.Lab3
|
|
{
|
|
public class PathFollower : Seek
|
|
{
|
|
public Path path;
|
|
public float pathOffset;
|
|
private float _currentParam;
|
|
|
|
public override void Awake()
|
|
{
|
|
base.Awake();
|
|
target = new GameObject();
|
|
_currentParam = 0;
|
|
}
|
|
|
|
public override Steering GetSteering()
|
|
{
|
|
_currentParam = path.GetParam(transform.position, _currentParam);
|
|
|
|
var targetParam = _currentParam + pathOffset;
|
|
target.transform.position = path.GetPosition(targetParam);
|
|
|
|
return base.GetSteering();
|
|
}
|
|
}
|
|
} |