Skip to content

Instantly share code, notes, and snippets.

@robotron2084
Created July 6, 2021 00:57
Show Gist options
  • Save robotron2084/e99f0987d26b8a7170b1c36580e47949 to your computer and use it in GitHub Desktop.
Save robotron2084/e99f0987d26b8a7170b1c36580e47949 to your computer and use it in GitHub Desktop.
public enum States
{
Idle,
Walking,
Running
}
public float speed = 0.0f;
public void SetState(States newState)
{
switch(newState)
{
case States.Idle:
speed = 0.0f;
break;
case States.Walking:
speed = 1.0f;
break;
case States.Running:
speed = 2.0f;
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment