Код
public NavMeshAgent agent;
float power = -10;
float offset;
void OnEnable() {
agent.updatePosition = false;
}
void Update() {
power = Mathf.Clamp(power - 10 * Time.deltaTime, -10, 1000);
offset = Mathf.Clamp(offset + power * Time.deltaTime, 0, 10);
transform.position = agent.nextPosition + Vector3.up * offset;
}
public void Boom(float power) {
this.power += power;
}
как-то так