void OnEndGame() { BGM.Stop(); MessageText.transform.localScale = new Vector3(1, 1, 1); string text = ""; var diff = Mathf.Abs(Player1.SongenPointValue - Player2.SongenPointValue); if (diff < 0.5f) { text = "両者、敗北"; GameResultData.Result = PlayerID.Unknown; GameResultData.Reason = EndReason.SongenIsZero; GameResultData.P1.SongenValue = 0.0f; GameResultData.P2.SongenValue = 0.0f; } else if (Player1.SongenPointValue < Player2.SongenPointValue) { text = "勝者、右の者"; GameResultData.Result = PlayerID.P2; if (Player2.KillYou) { GameResultData.Reason = EndReason.Killed; } else { GameResultData.Reason = EndReason.SongenIsZero; } GameResultData.P1.SongenValue = Player1.SongenPointValue; GameResultData.P2.SongenValue = Player2.SongenPointValue; Player1.Unko(); } else if (Player1.SongenPointValue > Player2.SongenPointValue) { text = "勝者、左の者"; GameResultData.Result = PlayerID.P1; if (Player1.KillYou) { GameResultData.Reason = EndReason.Killed; } else { GameResultData.Reason = EndReason.SongenIsZero; } GameResultData.P1.SongenValue = Player1.SongenPointValue; GameResultData.P2.SongenValue = Player2.SongenPointValue; Player2.Unko(); } MessageText.text = text; MessageText.frontColor = new Color(1, 0, 0, 1); AudioSource.PlayOneShot(AudioGameEnd); isEnd = true; }
private void InitInGame() { CurrentState = State.InGame; Debug.Log("Go to InGame."); BGM.Play(); AudioSource.PlayOneShot(AudioGameStart); StateRoot.BroadcastMessage("OnStartGame"); CanvasRoot.BroadcastMessage("OnStartGame"); SetMessageText("始め!"); SetMessageScale(1.0f); MessageText.StartAlphaUpdate(); }