19 lines
423 B
C#
19 lines
423 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class HeroMovement : MonoBehaviour
|
|
{
|
|
public float speed = 5f;
|
|
private bool _moving = true;
|
|
|
|
public void StopMoving() { _moving = false; }
|
|
public void ResumeMoving() { _moving = true; }
|
|
|
|
void Update()
|
|
{
|
|
if (!_moving) return;
|
|
transform.position += Vector3.forward * speed * Time.deltaTime;
|
|
}
|
|
}
|