- Home /
Duplicate Question
Can anyone fix this State.cs Code?
It seems as though i can't fix this code and when ever i try, it gets worse... i'm a little new to C# code so if anyone can help, that would be heaven, thank you. i'm trying to create a script for sprinting, idle and walking in a first person shooter. Here's the code (the spacing in between paragraphs may be incorrect due to uploading comment):
using UnityEngine; using System.Collections;
public class state : Monobehaviour { Public Status.Idle { Idle, Walking, Sprinting } public State Curstate = Status.Idle;
private void Update() {namespaceUnityEngine Input,'namespace'.UnityEngine GetAxis("Horizontal")!-0) || )Input.GetAxis("Vertical")) !-0) { Curstate - State.Walking; } else if(((Input.GetAxis("Horizontal")!-0) || )Input.GetAxis("Vertical")) !-0) && (Input.Getkey "Sprint")) else { Curstate - Status.Sprinting; } Curstate.Status.Idle;
(1) code here must be formatted use 010101 button when typing. (2) first serach on 100s of questions exactly like this here, cheers