private void BattleHandler() { if (PreconditionCheck() == false) { return; } mGamePhase = GAME_PHASE.ATTACKING_PHASE; BlockerPhase(); int attackerPower = mTargetingCard.GetPower(); int attackedPower = mTargetedCard.GetPower(); if (attackerPower == attackedPower) { //Destroy(mTargetingCard.GetGameObject()); //Destroy(mTargetedCard.GetGameObject()); mTargetingCard.GetGameObject().GetComponent <Card>().Defeated(); mTargetedCard.GetGameObject().GetComponent <Card>().Defeated(); } else if (attackerPower > attackedPower) { //Destroy(mTargetedCard.GetGameObject()); mTargetedCard.GetGameObject().GetComponent <Card>().Defeated(); } else { //Destroy(mTargetingCard.GetGameObject()); mTargetingCard.GetGameObject().GetComponent <Card>().Defeated(); } }
public void EndTurn() { mActivePlayer = mActivePlayer == PLAYER_ID.ONE ? PLAYER_ID.TWO : PLAYER_ID.ONE; ChangeUI(); if (mActivePlayer == PLAYER_ID.ONE) { mZoneList = mZoneList_P1; mActveManazone = mManazone_One; mActiveDeck = mDeck_One; mActiveBattlezone = mBattlezone_One; mActiveHand = mHand_One; } else { mZoneList = mZoneList_P2; mActveManazone = mManazone_Two; mActiveDeck = mDeck_Two; mActiveBattlezone = mBattlezone_Two; mActiveHand = mHand_Two; } mActiveHand.Draw(); mActveManazone.NewTurn(); mActiveBattlezone.NewTurn(); mGamePhase = GAME_PHASE.MANA_PHASE; }
void Awake() { ++mTurnCount; mActivePlayer = PLAYER_ID.ONE; mGamePhase = GAME_PHASE.MANA_PHASE; mActveManazone = mManazone_One; mActiveDeck = mDeck_One; mActiveHand = mHand_One; mHand_One.SetDeck(mDeck_One); mHand_Two.SetDeck(mDeck_Two); mDeck_One.SetOwner(PLAYER_ID.ONE); mDeck_Two.SetOwner(PLAYER_ID.TWO); mShieldzone_One.SetDeck(mDeck_One); mBattlezone_One.SetOwner(PLAYER_ID.ONE); mBattlezone_Two.SetOwner(PLAYER_ID.TWO); if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
public void PhaseEnd() { var go = new GameObject(); // create a WARGame object to store the game phase var game = go.AddComponent <WARGame>() as WARGame; WARGame.Instance = game; // and out gameplay controller to step through the phases var gameplay = new GameObject().AddComponent <WARControlGameplay>() as WARControlGameplay; WARControlGameplay.Instance = gameplay; gameplay.Start(); // create players to add to our game WARGame.Players.Add(new WARPlayer(1)); WARGame.Players.Add(new WARPlayer(2)); // the phase we are starting in GAME_PHASE startPhase = GAME_PHASE.morale; // the phase we expect to transition to GAME_PHASE expectedPhase = GAME_PHASE.movement; // set the phase to our start phase WARGame.SetPhase(startPhase); // move to the next phase gameplay.nextPhase(); // make sure we got the desired phase transition Assert.AreEqual(expectedPhase, WARGame.Phase.Value.current); // destroy the gameplay controller to clean up subscriptions gameplay.OnDestroy(); }
/** シーンの初期化処理*/ void procInit() { switch (nowScene) { case SCENE.TITLE: flyingVMCamera.SetActive(false); targetVMCamera.SetActive(false); timelineTitleDisp.Stop(); timelineTitleDisp.time = 0; timelineTitleDisp.Play(); Player.transform.position = playerStartPosition; SoundController.PlayBGM(SoundController.BGM.TITLE); Duck.SetAnim(Duck.ANIM.IDLE); Duck.SetTitleRotate(); break; case SCENE.GAME: targetVMCamera.SetActive(true); nextPhase = GAME_PHASE.START_WAIT; timelineTitleStart.Stop(); timelineTitleStart.time = 0; timelineTitleStart.Play(); StartCoroutine(updateGame()); SoundController.PlayBGM(SoundController.BGM.BGM); break; } }
//Change the phase of the game //and reset the timer private void PhaseChange() { Debug.Log(current_Phase); previous_Phase = current_Phase; current_Phase = GAME_PHASE.CHANGE; phase_Timer = 0; }
public void SetGamePhase(GAME_PHASE _gamePhase) { if (_gamePhase <= mGamePhase) { return; } mGamePhase = _gamePhase; }
public void nextPhase() { // move to the next phase of the game GAME_PHASE nextPhase = WARGame.Phase.Value.current + 1; var phase = GAME_PHASE.GetValues(typeof(GAME_PHASE)).Cast <GAME_PHASE>().Last(); phase = nextPhase > phase ? default(GAME_PHASE) + 1 : nextPhase; WARGame.SetPhase(phase); }
// Start is called before the first frame update public override void Start() { base.Start(); players = new List <Player>(); combat = new List <CombatManager>(); for (int i = 0; i < 1; i++) { combat.Add(new CombatManager()); } current_Phase = GAME_PHASE.PREPARATION; //poop }
protected override void OnInit() { GI = this; GamePhase = GAME_PHASE.Loading; }
public static void SetPhase(GAME_PHASE newPhase) { // set the current game phase Phase.SetValueAndForceNotify(new Epoch <GAME_PHASE>(Phase.Value.current, newPhase)); }
/** ゲームシーンの更新処理*/ IEnumerator updateGame() { // ゲーム開始待ち yield return(new WaitForSeconds(START_WAIT_TIME)); nextPhase = GAME_PHASE.SET_TARGET; procInitPhase(); // 各状態の完了を待つ while ( NowPhase == GAME_PHASE.SET_TARGET || NowPhase == GAME_PHASE.POWER || NowPhase == GAME_PHASE.FLYING || NowPhase == GAME_PHASE.RESULT) { procInitPhase(); yield return(null); } // 結果を表示 int ikiroku = (int)((Player.transform.position - playerStartPosition).magnitude * 100f + 0.5f); float kiroku = ikiroku / 100f; for (float x = 0f; x <= kiroku; x += COUNTUP_RATE * Time.deltaTime) { textKirokuNum.text = x.ToString("F2") + "m"; yield return(null); } textKirokuNum.text = kiroku.ToString("F2") + "m"; SoundController.Stop(); SoundController.Play(SoundController.SE.RESULT); yield return(null); // ハイスコアか bool isHighscore = ikiroku > highScore; if (isHighscore) { highScore = ikiroku; SoundController.Play(SoundController.SE.HIGHSCORE); Duck.SetAnim(Duck.ANIM.JUMP); // ハイスコア処理 while (true) { if (Input.GetButton("Jump")) { naichilab.RankingLoader.Instance.SendScoreAndShowRanking(ikiroku); break; } yield return(null); } // 消えるのを待つ while (true) { // シーンが消えたら、タイトルへ戻す if (!SceneManager.GetSceneByName("Ranking").IsValid()) { ChangePhase(GAME_PHASE.RESULT_DONE); procInitPhase(); yield break; } yield return(null); } } // クリックされるのを待つ while (true) { if (Input.GetButtonDown("Jump")) { ChangePhase(GAME_PHASE.RESULT_DONE); procInitPhase(); SoundController.Play(SoundController.SE.START); break; } yield return(null); } }
/** フェーズの初期化*/ void procInitPhase() { // フェーズの切り替え if (nextPhase != GAME_PHASE.NONE) { _nowPhase = nextPhase; nextPhase = GAME_PHASE.NONE; switch (NowPhase) { case GAME_PHASE.SET_TARGET: uiTarget.SetActive(true); SoundController.Stop(); Duck.SetAnim(Duck.ANIM.IDLE); ManualController.Page(0); break; // case GAME_PHASE.POWER: uiTarget.SetActive(false); Player.SendMessage("StartPower", mouseTarget.position); Duck.SetAnim(Duck.ANIM.RUN); ManualController.Page(1); break; case GAME_PHASE.FLYING: // Duckに速度設定 Vector3 dir = (mouseTarget.transform.position - Player.transform.position).normalized; Vector3 add = dir * MAX_SPEED * (float)PlayerPower.power / 100f; Player.GetComponent <Rigidbody>().velocity = add; // カメラのターゲットをDuckに変更 flyingVMCamera.SetActive(true); // 飛翔 Duck.SetAnim(Duck.ANIM.WALK); // 飛翔音 SoundController.Play(SoundController.SE.SHOOT); ManualController.Page(-1); break; case GAME_PHASE.RESULT: // タイトルカメラに戻す flyingVMCamera.SetActive(false); targetVMCamera.SetActive(false); SoundController.StopBGM(); Duck.SetTitleRotate(); // キロク表示 KirokuAnime.SetTrigger("In"); // アイドル Duck.SetAnim(Duck.ANIM.IDLE); break; // カウント開始 case GAME_PHASE.RESULT_COUNT: KirokuNumAnime.SetTrigger("In"); SoundController.Play(SoundController.SE.RESULT_ROLL); break; case GAME_PHASE.RESULT_DONE: // 終了アニメ KirokuAnime.SetTrigger("Out"); KirokuNumAnime.SetTrigger("Out"); break; } } }
/** 次のフェーズを設定する*/ public static void ChangePhase(GAME_PHASE ph) { instance.nextPhase = ph; }