Esempio n. 1
0
        public void OnClickButton()
        {
            if (selectItem.canSelect)
            {
                SoundController.Instance.PlaySe(SoundController.Instance.buttonSe);
                EncryptedPlayerPrefs.SaveInt(Const.KEY_CHARA, int.Parse(selectItem.num));
                Retry();
                return;
            }

            if (selectItem.canBuy)
            {
                SoundController.Instance.PlaySe(SoundController.Instance.casher);

                int point = EncryptedPlayerPrefs.LoadInt(Const.KEY_POINT, 0);
                int diff  = point - selectItem.price;
                EncryptedPlayerPrefs.SaveInt(Const.KEY_POINT, diff);
                pointText.text = diff + "P";
                string enabledCharas = EncryptedPlayerPrefs.LoadString(Const.KEY_ENABLE_CHARAS, "0");
                enabledCharas = enabledCharas + "," + selectItem.num;
                EncryptedPlayerPrefs.SaveString(Const.KEY_ENABLE_CHARAS, enabledCharas);
                selectItem.canSelect = true;
                priceText.text       = ("PLAY");
            }
        }
Esempio n. 2
0
 // Use this for initialization
 void Start()
 {
     actionRate = ACTIONRATE_NOMAL;
     level      = Const.GAME_LEVEL_NOMAL;
     if (GameMaster.Instance.mode == GameMaster.GameMode.EndlessMode)
     {
         level = Const.GAME_LEVEL_NOMAL;
     }
     if (GameMaster.Instance.mode == GameMaster.GameMode.OnePlayerMode)
     {
         level = EncryptedPlayerPrefs.LoadInt(Const.KEY_LEVEL, Const.GAME_LEVEL_NOMAL);
     }
     prevAction = PlayerInfo.Action.None;
     if (level == Const.GAME_LEVEL_EASY)
     {
         actionRate = ACTIONRATE_EASY;
     }
     else if (level == Const.GAME_LEVEL_NOMAL)
     {
         actionRate = ACTIONRATE_NOMAL;
     }
     else if (level == Const.GAME_LEVEL_HEARD)
     {
         actionRate = ACTIONRATE_HEARD;
     }
 }
Esempio n. 3
0
 private void OnCoinRewrd(bool isReward)
 {
     if (isReward)
     {
         Sound.Instans.PlaySe(Sound.Instans.fixSound);
         int currentCoin = EncryptedPlayerPrefs.LoadInt(Const.KEY_COIN, 0);
         RewardCountUpCoin(currentCoin, gotCoins);
     }
 }
Esempio n. 4
0
    public void OnEnding()
    {
        int level = EncryptedPlayerPrefs.LoadInt(Const.KEY_LEVEL, 2);

        assigned.assignedDialogue = "Ending" + level;
        textArea.SetActive(true);
        DOVirtual.DelayedCall(1f, () => {
            diagUI.Begin(assigned, textArea, true);
        });
    }
Esempio n. 5
0
    // Use this for initialization
    void Start()
    {
        int playerPos = EncryptedPlayerPrefs.LoadInt(Const.KEY_PLAYERPOS, GameMaster.CtrRight);

        SetPlayerPosImage(playerPos);
        int gameLevel = EncryptedPlayerPrefs.LoadInt(Const.KEY_LEVEL, Const.GAME_LEVEL_NOMAL);

        SetLevelImage(gameLevel);

        bool bgm = EncryptedPlayerPrefs.LoadBool(Const.KEY_BGM_ON, true);

        SetBgmImage(bgm);
        bool se = EncryptedPlayerPrefs.LoadBool(Const.KEY_SE_ON, true);

        SetSeImage(se);
    }
Esempio n. 6
0
        private void SetCanvasText()
        {
            int totalPoint = EncryptedPlayerPrefs.LoadInt(Const.KEY_POINT, 0);

            pointText.text = totalPoint + "P";

            string num   = selectItem.num;
            int    price = selectItem.price;

            selectItem.canSelect = false;
            selectItem.canBuy    = false;

            string enabeledCharas = EncryptedPlayerPrefs.LoadString(Const.KEY_ENABLE_CHARAS, "0");

            string[] enables = enabeledCharas.Split(',');
            for (int i = 0; i < enables.Length; i++)
            {
                if (num == enables [i])
                {
                    selectItem.canSelect = true;
                }
            }

            if (totalPoint >= price)
            {
                selectItem.canBuy = true;
            }

            nameText.text = selectItem.charaName;
            if (selectItem.canSelect)
            {
                priceText.text      = ("PLAY");
                button.interactable = true;
            }
            else
            {
                priceText.text = (price + "P");
                if (selectItem.canBuy)
                {
                    button.interactable = true;
                }
                else
                {
                    button.interactable = false;
                }
            }
        }
Esempio n. 7
0
        void Awake()
        {
            if (!_instance)
            {
                _instance = this;
            }

            button = buttonObj.GetComponent <Button> ();

            pointText = pointTextObj.GetComponent <TextMeshProUGUI> ();

            nameText  = nameTextObj.GetComponent <TextMeshProUGUI> ();
            priceText = priceTextObj.GetComponent <TextMeshProUGUI> ();

            distanceBetweenMenus -= IsDivisble(distanceBetweenMenus, 0.5f);

            _maxMenuPosition = (menuItems.Length + 1) * distanceBetweenMenus;

            startingMenuItem = EncryptedPlayerPrefs.LoadInt(Const.KEY_CHARA, 0);

            selectItem = menuItems [startingMenuItem];

            SetCanvasText();

            startingMenuItem = Mathf.Clamp((startingMenuItem + 1), 1, menuItems.Length);

            _currentMenuPosition = ((1) * distanceBetweenMenus) * startingMenuItem;

            ParentMenuItems();
            UpdateMenuItemsPositionInWorldSpace();

            if (GetComponent <TouchHandler> () == null)
            {
                gameObject.AddComponent <TouchHandler> ();
            }

            _swipeHandler = GetComponent <SwipeHandler> ();

            if (_swipeHandler == null)
            {
                _swipeHandler = gameObject.AddComponent <SwipeHandler> ();
            }
        }
Esempio n. 8
0
    public void OnClickBuyFixButton()
    {
        Sound.Instans.PlaySe(Sound.Instans.fixSound);
        buyPanel.SetActive(false);
        //コイン減らす playerPrefsに追加
        SelectPlayer sp          = buyChara.GetComponent <SelectPlayer> ();
        int          currentCoin = EncryptedPlayerPrefs.LoadInt(Const.KEY_COIN, 0);
        int          afterCoin   = currentCoin - sp.price;

        EncryptedPlayerPrefs.SaveInt(Const.KEY_COIN, afterCoin);
        int charaNo = sp.charaType + sp.charaSeq;

        AddEnableCharas(charaNo);
        coinText.GetComponent <TextMeshProUGUI>().text = afterCoin.ToString();

        Animator animator = buySelectChara.GetComponent <Animator> ();

        animator.enabled = true;
        if (sp.charaType == PlayerInfo.KOHAKU)
        {
            animator.SetBool("Win1", true);
        }
        else if (sp.charaType == PlayerInfo.YUKO)
        {
            animator.SetBool("Win2", true);
        }
        else if (sp.charaType == PlayerInfo.MISAKI)
        {
            animator.SetBool("Win3", true);
        }

        DOVirtual.DelayedCall(4f, () => {
            //UIを再構築
            EnableChara(ref kohaku1Array);
            EnableChara(ref yuko1Array);
            EnableChara(ref misaki1Array);
            EnableChara(ref kohaku2Array);
            EnableChara(ref yuko2Array);
            EnableChara(ref misaki2Array);
            CloseBuyPanel();
        });
    }
Esempio n. 9
0
    void Init()
    {
        dead             = false;
        soundButtonImage = soundButtonObj.GetComponent <Image> ();
        bool isSound = EncryptedPlayerPrefs.LoadBool(Const.KEY_SOUND, true);

        if (isSound)
        {
            soundButtonImage.sprite = soundOnImage;
            SoundController.Instance.SetSound(true);
        }
        else
        {
            soundButtonImage.sprite = soundOffImage;
            SoundController.Instance.SetSound(false);
        }

        int        charaNo = EncryptedPlayerPrefs.LoadInt(Const.KEY_CHARA, 0);
        GameObject chara   = charactors [charaNo];

        Instantiate(chara, chara.transform.position, chara.transform.rotation);
        score     = 0;
        scoreText = ScoreObj.GetComponent <TextMeshProUGUI> ();

        maxScoreText = MaxScoreObj.GetComponent <TextMeshProUGUI> ();
        pointText    = PointObj.GetComponent <TextMeshProUGUI> ();
        maxScore     = EncryptedPlayerPrefs.LoadInt(Const.KEY_MAX_SCORE, 0);
        point        = EncryptedPlayerPrefs.LoadInt(Const.KEY_POINT, 0);

        uploadScore       = EncryptedPlayerPrefs.LoadInt(Const.KEY_UPD_SCORE, 0);
        maxScoreText.text = maxScore.ToString();
        pointText.text    = point.ToString();
        rewardButton.SetActive(false);
        reawrdedTextObj.SetActive(false);
        Admanager.bannerView.Hide();
        isNetConnect = (Application.internetReachability != NetworkReachability.NotReachable);
    }
Esempio n. 10
0
    IEnumerator ShowEndCanvas(PlayerInfo.PlayerType winPlayerType)
    {
        //そこまで!
        r3.SetActive(true);
        SoundMainScene.Instans.PlaySe(SoundMainScene.Instans.sokomade);
        Sound.Instans.Stop();
        yield return(new WaitForSeconds(2));

        mainCanvas.SetActive(false);
        endCanvas.SetActive(true);

        GameMaster.Instance.p1Win = 0;
        GameMaster.Instance.p2Win = 0;

        if (GameMaster.Instance.mode == GameMaster.GameMode.OnePlayerMode ||
            GameMaster.Instance.mode == GameMaster.GameMode.TwoPlayerMode)
        {
            GameMaster.Instance.round = 0;
            if (IsPlayer(winPlayerType) ||
                GameMaster.Instance.mode == GameMaster.GameMode.TwoPlayerMode)
            {
                if (winPlayerType == PlayerInfo.PlayerType.Player1)
                {
                    OnVictory(GameMaster.Instance.charaType1, player1);
                }
                else
                {
                    OnVictory(GameMaster.Instance.charaType2, player2);
                }

                // 勝ちキャラアップ
                Camera.main.gameObject.SendMessage("Win", winPlayerType);

                yield return(new WaitForSeconds(3));

                // キャラのセリフ
                if (winPlayerType == PlayerInfo.PlayerType.Player1)
                {
                    talkEvent.SendMessage("OnSerihu", GameMaster.Instance.charaType1);
                }
                else
                {
                    talkEvent.SendMessage("OnSerihu", GameMaster.Instance.charaType2);
                }
                yield return(new WaitForSeconds(0.5f));
            }
        }

        if (GameMaster.Instance.mode == GameMaster.GameMode.TwoPlayerMode)
        {
            //対戦モード
            yield return(new WaitForSeconds(1.5f));

            Application.CaptureScreenshot("screenShot.png");
            yield return(new WaitForSeconds(1.5f));

            SetShareImage();
            //二人プレイ
            endPanel.SetActive(true);
            retryButton.SetActive(true);
            nextButtonText.GetComponent <TextMeshProUGUI>().text = "きゃらせんたく";
        }
        else if (GameMaster.Instance.mode == GameMaster.GameMode.OnePlayerMode)
        {
            //ストーリーモード ゲームオーバー判定
            if (IsPlayer(winPlayerType))
            {
                yield return(new WaitForSeconds(1.5f));

                Application.CaptureScreenshot("screenShot.png");
                yield return(new WaitForSeconds(1.5f));

                //シェア画像生成
                SetShareImage();
                int currentCoin = EncryptedPlayerPrefs.LoadInt(Const.KEY_COIN, 0);
                currentCoinText.GetComponent <TextMeshProUGUI> ().text = currentCoin.ToString();
                coinPanel.SetActive(true);
                //コイン計算
                gotCoins = level * (GameMaster.Instance.stage + 1) * 10;
                SetCoinText(gotCoins);
                CountUpCoin(currentCoin, gotCoins);
                endPanel.SetActive(true);
                //ステージ繰り上げ
                GameMaster.Instance.stage += 1;
            }
            else
            {
                // ゲームオーバーの場合
                levelTextPanel.SetActive(false);
                // カメラ移動
                if (GameMaster.Instance.ctrPos == GameMaster.CtrLeft)
                {
                    Destroy(player2);
                    // カメラ移動
                    Camera.main.gameObject.SendMessage("Lose", PlayerInfo.PlayerType.Player1);
                }
                if (GameMaster.Instance.ctrPos == GameMaster.CtrRight)
                {
                    Destroy(player1);
                    Camera.main.gameObject.SendMessage("Lose", PlayerInfo.PlayerType.Player2);
                }
                yield return(new WaitForSeconds(1.5f));

                SoundMainScene.Instans.PlaySe(SoundMainScene.Instans.zannen);
                gameOverPanel.SetActive(true);
                gameOverText.SetActive(true);
            }
        }
        else
        {
            //勝ち抜きモード
            if (winPlayerType == PlayerInfo.PlayerType.Player1)
            {
                Destroy(player2);
                transform.position = player1LPos;
                OnVictoryNonVoice(GameMaster.Instance.charaType1, player1);
                // 負けキャラアップ
                Camera.main.gameObject.SendMessage("Win", PlayerInfo.PlayerType.Player1);
            }
            else
            {
                Destroy(player1);
                OnVictoryNonVoice(GameMaster.Instance.charaType2, player2);
                // 負けキャラアップ
                Camera.main.gameObject.SendMessage("Win", PlayerInfo.PlayerType.Player2);
            }
            SoundMainScene.Instans.PlaySe(SoundMainScene.Instans.kekka);
            // 結果発表
            yield return(new WaitForSeconds(3f));

            katinukiKekkaPanel.SetActive(true);
            yield return(new WaitForSeconds(1.5f));

            katinukiText.GetComponent <TextMeshProUGUI>().text = GameMaster.Instance.round + "にんぬき!";
            katinukiText.SetActive(true);
            yield return(new WaitForSeconds(0.5f));

            Application.CaptureScreenshot("screenShot.png");
            yield return(new WaitForSeconds(1.5f));

            SetShareImage();

            int currentCoin = EncryptedPlayerPrefs.LoadInt(Const.KEY_COIN, 0);
            currentCoinText.GetComponent <TextMeshProUGUI> ().text = currentCoin.ToString();
            yield return(new WaitForSeconds(0.5f));

            //勝ち抜き数で評価ボイス
            if (0 <= GameMaster.Instance.round && GameMaster.Instance.round <= 4)
            {
                SoundMainScene.Instans.PlaySe(SoundMainScene.Instans.end04);
            }
            else if (5 <= GameMaster.Instance.round && GameMaster.Instance.round <= 9)
            {
                SoundMainScene.Instans.PlaySe(SoundMainScene.Instans.end59);
            }
            else if (10 <= GameMaster.Instance.round && GameMaster.Instance.round <= 19)
            {
                SoundMainScene.Instans.PlaySe(SoundMainScene.Instans.end1019);
            }
            else if (20 <= GameMaster.Instance.round)
            {
                SoundMainScene.Instans.PlaySe(SoundMainScene.Instans.end20);
            }
            yield return(new WaitForSeconds(0.5f));

            if (GameMaster.Instance.round > 0)
            {
                gotCoins = GameMaster.Instance.round * 10;
                SetCoinText(gotCoins);
                coinPanel.SetActive(true);
                CountUpCoin(currentCoin, gotCoins);
            }
            endPanel.SetActive(true);
            retryButton.SetActive(true);
            nextButtonText.GetComponent <TextMeshProUGUI>().text = "きゃらせんたく";
            //シェアするための勝ち抜き数を保持
            chareKatinukiCount        = GameMaster.Instance.round;
            GameMaster.Instance.round = 0;
        }
    }
Esempio n. 11
0
    IEnumerator Restart()
    {
        yield return(new WaitForSeconds(1f));

        //結果判定
        PlayerInfo p1Info = player1.GetComponent <PlayerController>().playerInfo;
        PlayerInfo p2Info = player2.GetComponent <PlayerController>().playerInfo;

        if (p1Info.life <= 0 && p2Info.life <= 0)
        {
            //DROW 勝ち抜きモードの場合は負け
        }
        else if (p1Info.life <= 0)
        {
            //2pWIN
            GameMaster.Instance.p2Win += 1;
        }
        else if (p2Info.life <= 0)
        {
            //1pWIN
            GameMaster.Instance.p1Win += 1;
        }
        yield return(new WaitForSeconds(2f));

        if (GameMaster.Instance.mode != GameMaster.GameMode.EndlessMode)
        {
            if (GameMaster.Instance.p1Win == 1)
            {
                p1Win1.enabled = true;
            }
            if (GameMaster.Instance.p1Win == 2)
            {
                p1Win1.enabled = true;
                p1Win2.enabled = true;
            }
            if (GameMaster.Instance.p2Win == 1)
            {
                p2Win1.enabled = true;
            }
            if (GameMaster.Instance.p2Win == 2)
            {
                p2Win1.enabled = true;
                p2Win2.enabled = true;
            }
        }

        if (GameMaster.Instance.mode != GameMaster.GameMode.EndlessMode)
        {
            GameMaster.Instance.round += 1;
            if (GameMaster.Instance.p1Win == 2)
            {
                StartCoroutine("ShowEndCanvas", PlayerInfo.PlayerType.Player1);
            }
            else if (GameMaster.Instance.p2Win == 2)
            {
                StartCoroutine("ShowEndCanvas", PlayerInfo.PlayerType.Player2);
            }
            else
            {
                SceneManager.LoadScene("Main");
            }
        }
        else
        {
            //勝ち抜きモード
            if (IsPlayer(PlayerInfo.PlayerType.Player1) && p1Info.life <= 0)
            {
                //自分が1pかつ自分のライフが0
                if (!isContinue)
                {
                    //勝ち抜きモードの場合動画広告を見ると1度だけ回復できる
                    DOVirtual.DelayedCall(1.5f, () => {
                        katinukiContinuePanel.SetActive(true);
                    });
                }
                else
                {
                    StartCoroutine("ShowEndCanvas", PlayerInfo.PlayerType.Player1);
                }
            }
            else if (IsPlayer(PlayerInfo.PlayerType.Player2) && p2Info.life <= 0)
            {
                //自分が2pかつ自分のライフが0
                if (!isContinue)
                {
                    //勝ち抜きモードの場合動画広告を見ると1度だけ回復できる
                    DOVirtual.DelayedCall(1.5f, () => {
                        katinukiContinuePanel.SetActive(true);
                    });
                }
                else
                {
                    StartCoroutine("ShowEndCanvas", PlayerInfo.PlayerType.Player2);
                }
            }
            else
            {
                GameMaster.Instance.state  = GameMaster.GameState.Start;
                GameMaster.Instance.round += 1;
                //スコア更新
                katinukiScore.GetComponent <TextMeshProUGUI> ().text = string.Format("{0:D}にんぬき", GameMaster.Instance.round);
                int maxScore = EncryptedPlayerPrefs.LoadInt(Const.KEY_KATINUKI_MAX_SCORE, 0);
                if (maxScore < GameMaster.Instance.round)
                {
                    EncryptedPlayerPrefs.SaveInt(Const.KEY_KATINUKI_MAX_SCORE, GameMaster.Instance.round);
                    katinukiMaxScore.GetComponent <TextMeshProUGUI> ().text = string.Format("(さいこう{0:D})", EncryptedPlayerPrefs.LoadInt(Const.KEY_KATINUKI_MAX_SCORE, 0));
                }

                // 次の相手を投入
                if (p1Info.life <= 0)
                {
                    player1.GetComponent <InitPosition> ().enabled = false;
                    player1.transform.DOMoveX(-4.5f, 0.2f).OnComplete(() => {
                        Destroy(player1);
                    });

                    yield return(new WaitForSeconds(0.5f));

                    int random = Random.Range(0, playerList.Length);
                    int p1     = random;
                    GameMaster.Instance.player1Chara = p1;
                    player1 = Instantiate(playerList [p1], new Vector3(-4.5f, 0f, 0f), player1RRotate) as GameObject;
                    player1.SendMessage("Init", PlayerInfo.PlayerType.Player1);
                    enagyBar1.SendMessage("SetBar", Const.MAX_LIFE);

                    player1.transform.DOMove(player1RPos, 0.5f).OnComplete(() => {
                        player1.transform.position = player1RPos;
                        player1.transform.rotation = player1RRotate;
                        player1.SendMessage("OnStart", player1.transform);
                        player1.SendMessage("SetPlay");
                        player1.SendMessage("SetSgage", GameMaster.Instance.p1SGage);
                        sBar1.SendMessage("SetSuperBar", GameMaster.Instance.p1SGage);
                        name1.GetComponent <TextMeshProUGUI> ().text = GameMaster.GetCharaName(GameMaster.Instance.charaType1);
                    });
                }
                else if (p2Info.life <= 0)
                {
                    player2.GetComponent <InitPosition> ().enabled = false;
                    player2.transform.DOMoveX(4.5f, 0.2f).OnComplete(() => {
                        Destroy(player2);
                    });

                    yield return(new WaitForSeconds(0.5f));

                    int random = Random.Range(0, playerList.Length);
                    int p2     = random;
                    GameMaster.Instance.player2Chara = p2;
                    player2 = Instantiate(playerList [p2], new Vector3(4.5f, 0f, 0f), player2LRotate) as GameObject;
                    player2.SendMessage("Init", PlayerInfo.PlayerType.Player2);
                    enagyBar2.SendMessage("SetBar", Const.MAX_LIFE);

                    player2.transform.DOMove(player2LPos, 0.5f).OnComplete(() => {
                        player2.transform.position = player2LPos;
                        player2.transform.rotation = player2LRotate;
                        player2.SendMessage("OnStart", player2.transform);
                        player2.SendMessage("SetPlay");
                        player2.SendMessage("SetSgage", GameMaster.Instance.p2SGage);
                        sBar2.SendMessage("SetSuperBar", GameMaster.Instance.p2SGage);
                        name2.GetComponent <TextMeshProUGUI> ().text = GameMaster.GetCharaName(GameMaster.Instance.charaType2);;
                    });
                }
            }
        }
    }
Esempio n. 12
0
    private void InitCanvas()
    {
        mainCanvas.SetActive(true);
        name1.GetComponent <TextMeshProUGUI> ().text = player1Name;
        name2.GetComponent <TextMeshProUGUI> ().text = player2Name;
        if (GameMaster.Instance.mode == GameMaster.GameMode.OnePlayerMode)
        {
            levelTextPanel.SetActive(true);
            levelText.GetComponent <TextMeshProUGUI> ().text = "つよさ " + GetLevelText(level);
        }
        //モードによってコントローラー出しわけ
        if (GameMaster.Instance.mode == GameMaster.GameMode.OnePlayerMode ||
            GameMaster.Instance.mode == GameMaster.GameMode.EndlessMode)
        {
            if (GameMaster.Instance.ctrPos == GameMaster.CtrLeft)
            {
                controllerLeft.SetActive(true);
            }
            if (GameMaster.Instance.ctrPos == GameMaster.CtrRight)
            {
                controllerRight.SetActive(true);
            }

            if (GameMaster.Instance.mode == GameMaster.GameMode.EndlessMode)
            {
                katinukiScore.GetComponent <TextMeshProUGUI> ().text    = string.Format("{0:D}にんぬき", GameMaster.Instance.round);
                katinukiMaxScore.GetComponent <TextMeshProUGUI> ().text = string.Format("(さいこう{0:D})", EncryptedPlayerPrefs.LoadInt(Const.KEY_KATINUKI_MAX_SCORE, 0));
                katinukiScore.SetActive(true);
                katinukiMaxScore.SetActive(true);
            }
        }
        if (GameMaster.Instance.mode == GameMaster.GameMode.TwoPlayerMode)
        {
            controller2.SetActive(true);
        }

        enagyBar1.SendMessage("SetBar", p1Life);
        enagyBar2.SendMessage("SetBar", p2Life);
        if (GameMaster.Instance.round == 0)
        {
            GameMaster.Instance.p1SGage = 0;
            GameMaster.Instance.p2SGage = 0;
        }
        player1.SendMessage("InitSSButton", GameMaster.Instance.p1SGage);
        player2.SendMessage("InitSSButton", GameMaster.Instance.p2SGage);

        player1.SendMessage("SetSgage", GameMaster.Instance.p1SGage);
        player2.SendMessage("SetSgage", GameMaster.Instance.p2SGage);

        sBar1.SendMessage("SetSuperBar", GameMaster.Instance.p1SGage);
        sBar2.SendMessage("SetSuperBar", GameMaster.Instance.p2SGage);
    }
Esempio n. 13
0
    // Use this for initialization
    void Start()
    {
        if (!Advertisement.IsReady("rewardedVideo"))
        {
            RequestReward();
        }
        classRoom = classRoomArray [GameMaster.Instance.stage];
        if (GameMaster.Instance.stage == 1)
        {
            Color color = new Color();
            color.r     = 240f / 255f;
            color.g     = 231f / 255f;
            color.b     = 206f / 255f;
            light.color = color;
        }
        if (GameMaster.Instance.stage == 2)
        {
            Color color = new Color();
            color.r     = 182f / 255f;
            color.g     = 182f / 255f;
            color.b     = 182f / 255f;
            light.color = color;
        }
        if (GameMaster.Instance.round == 0)
        {
            GameMaster.Instance.FadeIn();
        }
        level = EncryptedPlayerPrefs.LoadInt(Const.KEY_LEVEL, Const.GAME_LEVEL_NOMAL);

        GameMaster.Instance.state = GameMaster.GameState.Ready;
        if (GameMaster.Instance.mode == GameMaster.GameMode.OnePlayerMode ||
            GameMaster.Instance.mode == GameMaster.GameMode.TwoPlayerMode)
        {
            if (GameMaster.Instance.round == 0)
            {
                Sound.Instans.audioSource.Stop();
            }
        }
        if (GameMaster.Instance.mode != GameMaster.GameMode.EndlessMode)
        {
            if (GameMaster.Instance.p1Win == 1)
            {
                p1Win1.enabled = true;
            }
            if (GameMaster.Instance.p1Win == 2)
            {
                p1Win1.enabled = true;
                p1Win2.enabled = true;
            }
            if (GameMaster.Instance.p2Win == 1)
            {
                p2Win1.enabled = true;
            }
            if (GameMaster.Instance.p2Win == 2)
            {
                p2Win1.enabled = true;
                p2Win2.enabled = true;
            }
        }

        Init();
        StartCoroutine(RoundStart());
    }
Esempio n. 14
0
    // Use this for initialization
    void Start()
    {
        GameMaster.Instance.FadeIn();
        GameMaster.Instance.ctrPos = EncryptedPlayerPrefs.LoadInt(Const.KEY_PLAYERPOS, GameMaster.CtrRight);
        int coins = EncryptedPlayerPrefs.LoadInt(Const.KEY_COIN, 0);

        coinText.GetComponent <TextMeshProUGUI>().text = coins.ToString();

        kohaku1Array = GameObject.FindGameObjectsWithTag("Kohaku").OrderBy(x => x.name).ToArray();
        yuko1Array   = GameObject.FindGameObjectsWithTag("Yuko").OrderBy(x => x.name).ToArray();
        misaki1Array = GameObject.FindGameObjectsWithTag("Misaki").OrderBy(x => x.name).ToArray();

        kohaku2Array = GameObject.FindGameObjectsWithTag("Kohaku2").OrderBy(x => x.name).ToArray();
        yuko2Array   = GameObject.FindGameObjectsWithTag("Yuko2").OrderBy(x => x.name).ToArray();
        misaki2Array = GameObject.FindGameObjectsWithTag("Misaki2").OrderBy(x => x.name).ToArray();

        //使用可能キャラのみアニメーションさせる
        EnableChara(ref kohaku1Array);
        EnableChara(ref yuko1Array);
        EnableChara(ref misaki1Array);
        EnableChara(ref kohaku2Array);
        EnableChara(ref yuko2Array);
        EnableChara(ref misaki2Array);

        kohakuLen = kohaku1Array.Length;
        yukoLen   = yuko1Array.Length;
        misakiLen = misaki1Array.Length;

        GameObject p1 = SwitchChara(kohaku1Array, p1Index);
        GameObject p2 = SwitchChara(kohaku2Array, p2Index);

        yuko.SetActive(false);
        misaki.SetActive(false);

        yuko2.SetActive(false);
        misaki2.SetActive(false);

        string p1Name = GameMaster.GetCharaName(p1Chara);
        string p2Name = GameMaster.GetCharaName(p2Chara);

        if (GameMaster.Instance.mode == GameMaster.GameMode.OnePlayerMode ||
            GameMaster.Instance.mode == GameMaster.GameMode.EndlessMode)
        {
            if (GameMaster.Instance.ctrPos == GameMaster.CtrLeft)
            {
                kohaku2.SetActive(false);
                yuko2.SetActive(false);
                misaki2.SetActive(false);
                twoPlayerPanel.SetActive(false);
                twoPArrow.SetActive(false);
                onePText.GetComponent <TextMeshProUGUI>().text = p1Name;
            }
            else
            {
                kohaku.SetActive(false);
                yuko.SetActive(false);
                misaki.SetActive(false);
                onePlayerPanel.SetActive(false);
                onePArrow.SetActive(false);
                twoPText.GetComponent <TextMeshProUGUI>().text = p2Name;
            }
        }
        if (GameMaster.Instance.mode == GameMaster.GameMode.TwoPlayerMode)
        {
            twoPlayerPanel.SetActive(true);
            twoPArrow.SetActive(true);
            onePText.GetComponent <TextMeshProUGUI>().text = p1Name;
            twoPText.GetComponent <TextMeshProUGUI>().text = p2Name;
        }

        GameMaster.Instance.player1Chara = PlayerInfo.KOHAKU;
        //1プレイモードの時はステージごとに代わる(MainGameControllerで調整)
        GameMaster.Instance.player2Chara = PlayerInfo.KOHAKU;

        buyChara1 = p1;
        buyChara2 = p2;
    }
Esempio n. 15
0
    //決定ボタン制御
    private void SetBuyButton(PlayerInfo.PlayerType player, GameObject charaObj)
    {
        if (PlayerInfo.PlayerType.Player1 == player)
        {
            buyChara1 = charaObj;
        }
        else
        {
            buyChara2 = charaObj;
        }

        SelectPlayer selectChara = charaObj.GetComponent <SelectPlayer> ();

        if (selectChara.enableFlg)
        {
            // 使える
            if (player == PlayerInfo.PlayerType.Player1)
            {
                p1Button.SetActive(true);
                p1BuyButton.SetActive(false);
            }
            else
            {
                p2Button.SetActive(true);
                p2BuyButton.SetActive(false);
            }
        }
        else
        {
            float alpha = 0.3f;
            //ボタンに値段をセット
            int             price = selectChara.price;
            TextMeshProUGUI priceText;
            Image           buttonImage;
            if (player == PlayerInfo.PlayerType.Player1)
            {
                p1Button.SetActive(false);
                p1BuyButton.SetActive(true);
                buttonImage    = p1BuyButton.GetComponent <Image> ();
                priceText      = p1PriceText.GetComponent <TextMeshProUGUI> ();
                priceText.text = price.ToString();
            }
            else
            {
                p2Button.SetActive(false);
                p2BuyButton.SetActive(true);
                buttonImage    = p2BuyButton.GetComponent <Image> ();
                priceText      = p2PriceText.GetComponent <TextMeshProUGUI> ();
                priceText.text = price.ToString();
            }
            int coin = EncryptedPlayerPrefs.LoadInt(Const.KEY_COIN, 0);
            if (coin >= price)
            {
                // 買える
                if (player == PlayerInfo.PlayerType.Player1)
                {
                    p1BuyButton.GetComponent <Button> ().enabled = true;
                }
                else
                {
                    p2BuyButton.GetComponent <Button> ().enabled = true;
                }
                DOTween.ToAlpha(() => buttonImage.color, color => buttonImage.color = color, 1f, 0f);
                DOTween.ToAlpha(() => priceText.color, color => priceText.color     = color, 1f, 0f);
            }
            else
            {
                // 買えない
                if (player == PlayerInfo.PlayerType.Player1)
                {
                    p1BuyButton.GetComponent <Button> ().enabled = false;
                }
                else
                {
                    p2BuyButton.GetComponent <Button> ().enabled = false;
                }
                DOTween.ToAlpha(() => buttonImage.color, color => buttonImage.color = color, alpha, 0f);
                DOTween.ToAlpha(() => priceText.color, color => priceText.color     = color, alpha, 0f);
            }
        }
    }