本文整理汇总了C#中GameState.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# GameState.ToString方法的具体用法?C# GameState.ToString怎么用?C# GameState.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameState
的用法示例。
在下文中一共展示了GameState.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChangeStateTo
public void ChangeStateTo(GameState targetState)
{
string s = string.Concat ("Changing state from ", State.ToString (), " to ", targetState.ToString ());
Debug.Log (s);
State = GameState.WAITING;
StartCoroutine(DoChangeState(targetState));
}
示例2: DoChangeState
IEnumerator DoChangeState(GameState targetState)
{
yield return new WaitForSeconds(2f);
State = targetState;
string t = string.Concat("Switched state to ", State.ToString());
Debug.Log (t);
}
示例3: SetGameState
public static void SetGameState(GameState state)
{
previousGameState = gameState;
switch(state)
{
case GameState.MainMenu:
gameState = GameState.MainMenu;
BuildMenu.BuildStartMenu();
break;
case GameState.PlayMenu:
gameState = GameState.PlayMenu;
BuildMenu.BuildPlayMenu();
break;
case GameState.CreateMenu:
gameState = GameState.CreateMenu;
BuildMenu.BuildCreateMenu();
break;
case GameState.ConnectMenu:
gameState = GameState.ConnectMenu;
BuildMenu.BuildConnectMenu();
break;
default:
Debug.LogError("State not exist please change: " + state.ToString());
break;
}
return;
}
示例4: ChangeState
public void ChangeState(GameState newState)
{
currentState = newState;
StartCoroutine(newState.ToString() + "State");
}
示例5: StateChange
private static void StateChange(GameState old, GameState now)
{
Debug.Log("State has changed from " + old.ToString() + " to " + now.ToString());
foreach(StateChangeListener scl in stateChangeListeners) {
scl.gameStateChanged(old, now);
}
switch (now)
{
case(GameState.READY):
LevelController.main.resetLevel();
SpawnReadyCards();
if (go.GetComponent<ReadyManager>()==null)
go.AddComponent<ReadyManager>();
go.transform.position = spawnPos;
break;
case(GameState.PLAYING):
PlayerManager.PrepPlayers();
break;
case(GameState.RESTART):
PlayerManager.CleanUpAllPlayers();
eggLogic.Reset();
delayPlay = true;
break;
case(GameState.LOSE):
case(GameState.WIN):
TinderBox.TinderBoxAPI.GameOver();
break;
case(GameState.QUIT):
PlayerManager.CleanUpAllPlayers();
eggLogic.Reset();
delayReady = true;
break;
}
switch (old)
{
case(GameState.READY):
ReadyLogic[] scripts = FindObjectsOfType<ReadyLogic>();
foreach (ReadyLogic script in scripts)
{
script.RemoveReadyCard();
}
Destroy(go.GetComponent<ReadyManager>());
break;
case(GameState.PLAYING):
PlayerManager.CleanUpAllPlayers();
break;
case (GameState.LOSE):
go.GetComponent<GameEndManager>().despawnCards();
break;
}
}
示例6: ChangeGameState
public void ChangeGameState(GameState newState)
{
switch (CurrentGameState)
{
case GameState.PlayerConnect: PlayerConnectExit(); break;
case GameState.Play: PlayExit(); break;
case GameState.GameOver: GameOverExit(); break;
}
CurrentGameState = newState;
switch (CurrentGameState)
{
case GameState.PlayerConnect: PlayerConnectEnter(); break;
case GameState.Play: PlayEnter(); break;
case GameState.GameOver: GameOverEnter(); break;
}
print("new gamestate is " + CurrentGameState.ToString());
}
示例7: ChangeGameState
private void ChangeGameState(GameState newState){
Debug.Log (newState.ToString ());
gameState = newState;
if (gameState == GameState.nextlevel) {
DeleteAllCells ();
LoadNextLevelPanel();
}
if(gameState == GameState.showcards){
StartCoroutine(HideCells());}
if (gameState == GameState.gameover) {
sumAllGames ++;
sumAllScores += gameScore;
HandleTopScores();
}
}
示例8: SwitchToState
/// <summary>
/// Switches to a new state
/// </summary>
void SwitchToState(GameState state)
{
if((int)m_state >= (int)state)
{
return;
}
if(state == GameState.STAGE_2)
{
Debug.Log("Starting Stage 2");
m_state = GameState.STAGE_2;
m_countdownTimer.StartCountDown(m_stage2Countdown, m_stage2CountdownFinish);
m_fogOfWar.HideFog();
}
else
{
Debug.LogError("Tried to set an unsupported state: " + state.ToString());
}
}
示例9: SetState
public void SetState( GameState gs )
{
gameState = gs;
oscStringList.Clear ();
oscStringList.Add (gs.ToString ());
osc.SendOSC ("ControlPanel", "/setState", oscStringList);
switch (gameState)
{
case GameState.STANDBY:
osc.SendOSC("ExternalDisplay", "/playVideo");
oscIntList.Clear();
oscIntList.Add (0);
osc.SendOSC("ControlPanel", "/setTime", oscIntList);
spawner.PauseSpawner (true);
spawner.RemoveObjects();
Destroy(tutorialTarget);
calibrationObject.SetActive(false);
countDownText.gameObject.SetActive(false);
gameOverText.gameObject.SetActive(false);
gameOverBackground.gameObject.SetActive(false);
scoreText.gameObject.SetActive(false);
timeText.gameObject.SetActive(false);
dottedLine.SetActive(false);
ResetCombo();
foreach( Material mat in gridMats )
mat.SetFloat("_Opacity_Slider", 5 );
dottedLine.GetComponent<Renderer>().material.SetFloat("_Progress", 0);
dottedLineTimer = 0.0f;
dottedLineActive = false;
timer = 3f;
holoDeckSound.Play();
break;
case GameState.CONFIG:
calibrationObject.SetActive(true);
break;
case GameState.TUTORIAL:
//tm.StartTutorial();
osc.SendOSC("ExternalDisplay", "/stopVideo");
if( !IsLevelBackgroundActive() )
LoadLevelBackground( 0 );
audioDone = false;
eyeLevel = cameraHolder.transform.position.y;
tutorialCollumn.SetActive(true);
tutorialTarget = (GameObject)Instantiate(tutorialPrefab, new Vector3(0, -1f, 1), Quaternion.identity);
tutorialTarget.transform.parent = spawner.gameObject.transform;
tutorialTarget.GetComponent<Rigidbody>().useGravity = false;
tutorialTarget.GetComponent<Collider>().enabled = false;
targetTracker.tutorialTarget = tutorialTarget;
dottedLine.GetComponent<TrackCamera>().target = tutorialTarget;
StopAllTutorialAduio();
tutorailAudio[0].Play();
subtitleText.gameObject.SetActive(true);
subtitleText.text = "Greetings and Welcome to the Virtual Reality Cube, powered by Virsix";
timer = 30;
score = 0;
scoreText.text = "" + score;
break;
case GameState.COUNTDOWN:
StopAllTutorialAduio();
tutorailAudio[4].Play();
AddGameToLog();
dottedLine.SetActive(false);
Destroy(tutorialTarget);
timer = 5.5f;
countDownText.gameObject.SetActive(true);
subtitleText.gameObject.SetActive(false);
break;
case GameState.GAME:
timer = gameTime;
score = 0;
numSlices = 0;
tutorialCollumn.SetActive(false);
spawner.PauseSpawner (false);
countDownText.gameObject.SetActive(false);
scoreText.gameObject.SetActive(true);
timeText.gameObject.SetActive(true);
waitForSpawner = true;
ResetCombo();
foreach( Material mat in gridMats )
mat.SetFloat("_Opacity_Slider", 0 );
gameMusic.Play();
break;
case GameState.GAMEOVER:
if( numSlices >= 60 )
numStars = 3;
else if( numSlices >= 20 )
numStars = 2;
else
numStars = 1;
holoDeckSound.Play();
gameOverText.gameObject.SetActive (true);
gameOverBackground.gameObject.SetActive (true);
gameOverText.text = "Game Over!\nYour Score: " + score;// += score;
scoreText.gameObject.SetActive(false);
timeText.gameObject.SetActive(false);
countDownText.gameObject.SetActive(false);
//.........这里部分代码省略.........
示例10: Start
void Start()
{
previousDirection = currentDirection;
currentState = new ProfessorStandingState(this);
currentStateString = currentState.ToString();
previousState = new ProfessorStandingState(this);
previousStateString = previousState.ToString();
body = GetComponent<FSBodyComponent>().PhysicsBody;
body.FixedRotation = true;
body.FixtureList[0].UserData = "Player";
body.FixtureList[0].UserTag = "Player";
body.OnCollision += OnCollisionEvent;
body.OnSeparation += OnCollisionSeparation;
animator = GetComponent<tk2dSpriteAnimator>();
if (!animator) {
throw new Exception("No tk2dSpriteAnimator was attached to the Player!!!");
}
animator.AnimationCompleted = HandleAnimationCompleted;
nearVortex = false;
canMove = true;
handledWinningCamera = false;
sfxPlayer = GetComponent<AudioSource>();
dialogueGUI = GameObject.Find("Dialogue GUI").gameObject;
dialogueGUIExpandedScale = dialogueGUI.transform.localScale;
dialogueGUI.transform.localScale = Vector3.zero;
mainCamera = GameObject.FindWithTag("MainCamera").GetComponent<tk2dCamera>();
}
示例11: GoToState
void GoToState(GameState newState)
{
switch(newState) {
case GameState.Guessing:
if (state != GameState.Guessing && state != GameState.IncorrectAnswer)
VisualStateManager.GoToState(this, "Guessing", true);
VisualStateManager.GoToState(this, "FirstGuess", true);
break;
case GameState.IncorrectAnswer:
if (state != GameState.Guessing && state != GameState.IncorrectAnswer)
VisualStateManager.GoToState(this, "Guessing", true);
VisualStateManager.GoToState(this, "SecondGuess", true);
break;
case GameState.RoundOverview:
VisualStateManager.GoToState(this, "RoundOverview", true);
break;
case GameState.GameOverview:
VisualStateManager.GoToState(this, "GameOverview", true);
break;
default:
throw new ArgumentOutOfRangeException();
}
state = newState;
VisualStateManager.GoToState(this, state.ToString(), true);
}
示例12: SetGameState
public static void SetGameState(GameState state, string DirectoryName, string SceneName )
{
previousGameState = gameState;
switch(state)
{
case GameState.Play:
gameState = GameState.Play;
directoryName = DirectoryName;
sceneName = SceneName;
Application.LoadLevel("Play_Scene");
break;
default:
Debug.LogError("State not exist please change: " + state.ToString());
break;
}
return;
}
示例13: Update
void Update()
{
/* Update direction. */
previousDirection = currentDirection;
currentDirection = NextDirection();
/* Update game state. */
previousState = currentState;
currentStateString = currentState.ToString();
currentState = currentState.NextState();
previousStateString = previousState.ToString();
/* Let the current game state do what it needs to do. */
currentState.Logic();
HandleExtraLogic();
HandleVelocityCap();
HandleCamera();
//Debug.Log (body.LinearVelocity);
}
示例14: StateChange
public void StateChange(GameState toState)
{
Debug.LogWarning ("StateChange("+toState.ToString()+")");
switch(toState)
{
case GameState.PRESTART:
//Player starts/
globalTargetFoundHandler.SetTrackableMarkers (false);
castButton.gameObject.SetActive (false);
castButton.enabled = false;
startButton.gameObject.SetActive (true);
startButton.enabled = true;
break;
case GameState.CALCULATING_SPELL:
startButton.gameObject.SetActive (false);
startButton.enabled = false;
castButton.gameObject.SetActive (false);
castButton.enabled = false;
SpellSecret = CalculateCorrectSpell ();
if (debugGameLogic) {
debugLogicText.text = secertSpellStr;
}
break;
case GameState.INSTRUCT_PLAYER_ROLL_AND_POSITION_CAMERA:
castButton.gameObject.SetActive (false);
castButton.enabled = false;
//reset tracking timer
trackingTimer = 0f;
//display instructions//
InfoText.enabled = true;
InfoText.text = "Cast a spell by rolling the die. " +
"Put all the die in the camera frame.";
//turn on ar detection//
globalTargetFoundHandler.SetTrackableMarkers(true);
break;
case GameState.PLAYER_GUESS:
InfoText.text = "";
//reset tracking timer
trackingTimer = 0f;
cachedTrackedDice = null;
castButton.gameObject.SetActive (true);
castButton.enabled = true;
break;
case GameState.SHOW_GUESS_RESULTS_WRONG:
castButton.gameObject.SetActive (false);
castButton.enabled = false;
StartCoroutine (NextTurnTimer(4f));
break;
case GameState.SHOW_WINNING_GUESS:
castButton.gameObject.SetActive (false);
castButton.enabled = false;
InfoText.text = "Well cast! You Win!";
InfoText.enabled = true;
StartCoroutine (NextGameTimer(5f));
break;
case GameState.TURN_ENDS:
castButton.gameObject.SetActive (false);
castButton.enabled = false;
globalTargetFoundHandler.SetTrackableMarkers (false);
//display for a set amount of time
InfoText.text = "Pass the phone to the next player.";
InfoText.enabled = true;
StartCoroutine (PassPhoneTimer(5f));
break;
default:
Debug.LogWarning ("UNKOWN STATE "+toState.ToString());
break;
}
currentState = toState;
Debug.LogWarning ("currentState = toState ("+toState.ToString()+")");
}
示例15: InvalidStateException
public InvalidStateException(GameState gameState)
: base("Invalid game state: " + gameState.ToString())
{
}