Files
5.24BuYu/Assets/GG Camera Shake/Samples/Stompa/Scripts/Movement.cs
T
2026-04-21 23:02:51 +08:00

35 lines
571 B
C#

using UnityEngine;
public class Movement : MonoBehaviour
{
bool move;
int stomps;
int direction = 1;
// Called by animator
public void Move()
{
move = true;
}
// Called by animator
public void StopMove()
{
move = false;
stomps += 1;
if (stomps > 7)
{
stomps = 0;
direction = -direction;
}
}
void Update()
{
if (move)
{
transform.position += transform.forward * Time.deltaTime * direction * 10;
}
}
}