-
-
Save YutaKaseda/3c692f67badadfc5e98a8f8abd8480a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class Main{ | |
public class State{ | |
public State(); | |
public void Action(); | |
} | |
public State doState; | |
//どこかから呼ばれる | |
void Update(){ | |
CheckState(); | |
doState.Action(); | |
} | |
CheckState(){ | |
if(何か){ | |
doState = new State1(); | |
} | |
if(何か){ | |
doState = new State2(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class Main{ | |
public class State1 : State{ | |
public State1(); | |
public override void Action(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class Main{ | |
public class State2 : State{ | |
public State2(); | |
public override void Action(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment