コード例 #1
0
 // Start is called before the first frame update
 void Start()
 {
     //ハイスコア取得
     hiScoreCount = PlayerPrefs.GetFloat("HighScore", 0);
     //フェイズを初期化
     stagePhase = StagePhase.Phase1;
 }
コード例 #2
0
    IEnumerator StartCountdown()
    {
        yield return(new WaitForSeconds(10));

        currentStage = StagePhase.PHONE;
        HandleStageChange();
    }
コード例 #3
0
    public void SetPhase(StagePhase phase)
    {
        this.Phase = phase;
        switch (Phase)
        {
        case StagePhase.MEMORY:
            break;

        case StagePhase.COUNTDOWN:
            view.startPanel.gameObject.SetActive(false);
            Camera.main.transform.parent.DOMove(Constant.PLAY_CAM_POS, 1f).SetEase(Ease.Linear);
            StartCoroutine(view.CountDown());
            break;

        case StagePhase.PLAY:
            view.inGamePanel.gameObject.SetActive(true);
            Camera.main.gameObject.GetComponent <MouseLook> ().enabled = true;
            rifle.SetActive(true);
            CreateCharacter();
            break;

        case StagePhase.SHOT:
            view.inGamePanel.gameObject.SetActive(false);
            rifle.SetActive(false);
            var citizens = GameObject.FindGameObjectsWithTag("Citizen");
            foreach (var c in citizens)
            {
                c.GetComponent <UnityEngine.AI.NavMeshAgent> ().speed = 0;
            }
            break;

        case StagePhase.CLEAR:
            Debug.Log("CLEAR");
            AudioManager.Instance.PlaySE("gameclear");
            Cursor.lockState = CursorLockMode.None;
            Cursor.visible   = true;
            if (GameManager.Instance.CurrentLevel <= 2)
            {
                var clearTime = (float)Constant.TIME_LIMIT_ARRAY[GameManager.Instance.CurrentLevel - 1] - stageTimer.Value;
                GameManager.Instance.SetClearTime(GameManager.Instance.CurrentLevel - 1, clearTime);
                view.clearPanel.gameObject.SetActive(true);
            }
            else
            {
                GameManager.Instance.CalculateClearTime();
                view.gameClearPanel.gameObject.SetActive(true);
                naichilab.RankingLoader.Instance.SendScoreAndShowRanking(GameManager.Instance.clearTime);
            }
            break;

        case StagePhase.GAMEOVER:
            AudioManager.Instance.PlaySEWithVolume("gameover", 0.5f);
            Debug.Log("GAMEOVER");
            Cursor.lockState = CursorLockMode.None;
            Cursor.visible   = true;
            view.gameOverPanel.gameObject.SetActive(true);
            break;
        }
    }
コード例 #4
0
    // Update is called once per frame
    void Update()
    {
        if (currentStage == StagePhase.PHONE)
        {
            if (!playerPhone.inConversation)
            {
                currentStage = StagePhase.ALLEY;
                HandleStageChange();
            }
        }

        if (currentStage == StagePhase.ALLEY)
        {
            if (wallet.amScanned)
            {
                currentStage = StagePhase.CRIME;
                HandleStageChange();
            }
        }

        if (currentStage == StagePhase.CRIME)
        {
            int scanCount = 0;

            if (newsTablet.amScanned)
            {
                scanCount++;
            }

            if (postIt.amScanned)
            {
                scanCount++;
            }

            if (emailTablet.amScanned)
            {
                scanCount++;
            }

            if (workTablet.amScanned)
            {
                scanCount++;
            }

            if (CrumbledEvidence.amScanned)
            {
                scanCount++;
            }

            if (scanCount > 3)
            {
                currentStage = StagePhase.ACCUSE;
                HandleStageChange();
            }
        }
    }
コード例 #5
0
	// Update is called once per frame
	void Update () 
    {
        if (timeBetweenDamage > 0)
        {
            timeBetweenDamage -= Time.deltaTime;
        }

	    if(gemHealth <= 0)
        {
            Debug.Log("GEM DEAD");

            timer += Time.deltaTime;
            LiftPlayers();

            if (timer > 4)
            {
                transition = true;
            }

            if (currentPhase == StagePhase.GemAlive)
            {
                currentPhase = StagePhase.GemBroken;
            }
            if (currentPhase == StagePhase.GemBroken)
            {
                currentPhase = StagePhase.GemDestroyed;
                gemLighting.GemShattered(true);
                DestroyPlatform();
                DestroyCharmarks();
                mainCam.GetComponent<CameraShake>().PlayShake();
            }
        }

        if (transition && !broken)
        {
            LowerPlayers();
            Part1.SetActive(false);
            Part2.SetActive(true);
            broken = true;
            gemLighting.GemShattered(false);
            gemLighting.ResetLighting();
            gameObject.SetActive(false);
        }

	}
コード例 #6
0
    // Use this for initialization
    void Start()
    {
        input_count = 0;
        DataManager.Get().QuestDatas.TryGetValue(GameManager.quest_num, out questdata);
        if (questdata == null)
        {
            ////Debug.log("quest data missing");
            GameObject.Find("GameManager").SendMessage("GotoMain");
        }
       
        matrix_state = true;
        stage_phase = StagePhase.INTRO;
        score = 0;
        currnet_coin = 0;
        get_coin = 0;
        max_coin = questdata.MaxGold;
        InitStageManager();
        InitMatrixScreen();
        if (questdata.Mode == 0 || questdata.Mode == 2)
        {
            clear = 1;
        }
        else
        {
            clear = 3;
        }
        InfinityModeCount = 0;
        LevelDifficulty = InfinityModeCount + 1;

        touch_panel = GameObject.Find("touch_Panel");
        DamageCount = (GameObject)Resources.Load("Prefabs/hud/DamageCount");
        GameObject tDamageCountObj = (GameObject)Instantiate(StageManager.DamageCount, gameObject.transform.position, Quaternion.identity);
        if (tDamageCountObj != null)
        {
            tDamageCountObj.GetComponent<FontManager>().SetDamageNum
                (FontManager.ColorIndex.YELLOW, (int)1, 40.0f);
            GameObject.Destroy(tDamageCountObj, 0.5f);
        }
        // 상단광고용
        //AndroidAdmob.Get().Show(TextAnchor.UpperCenter);
    }
コード例 #7
0
    // Update is called once per frame
    void Update()
    {
        //スコア増加フラグがTRUE時
        if (scoreIncreasing)
        {
            scoreCount += pointsPerSec * Time.deltaTime;
        }
        else if (specialScoreIncreasing)   //スペシャル3発動時
        {
            scoreCount += 3 * pointsPerSec * Time.deltaTime;
        }

        //ハイスコアを超えた場合更新し続ける
        if (scoreCount > hiScoreCount)
        {
            hiScoreCount = scoreCount;
            PlayerPrefs.SetFloat("HighScore", hiScoreCount);
        }
        scoreText.text   = "スコア: " + Mathf.Round(scoreCount);
        hiScoreText.text = "ハイスコア: " + Mathf.Round(hiScoreCount);

        //現在スコアでフェイズの切り替え
        if (scoreCount < 2000 && scoreCount >= 800)
        {
            stagePhase = StagePhase.Phase2;
        }
        else if (scoreCount < 4000 && scoreCount >= 2000)
        {
            stagePhase = StagePhase.Phase3;
        }
        else if (scoreCount < 7000 && scoreCount >= 4000)
        {
            stagePhase = StagePhase.Phase4;
        }
        else if (scoreCount >= 7000)
        {
            stagePhase = StagePhase.Phase5;
        }
    }
コード例 #8
0
 void MoveToBossIntro()
 {
     if(!(stage_phase == StagePhase.FINISH))
         stage_phase = StagePhase.BOSS_INTRO;
 }
コード例 #9
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            EnterPause();
        }

        if (AndroidAdmob.Get().GetBanner(TextAnchor.LowerCenter) != null)
        {
            if (AndroidAdmob.Get().GetBanner(TextAnchor.LowerCenter).IsOnScreen == true)
                AndroidAdmob.Get().Hide(TextAnchor.LowerCenter);
        }

        if (stage_phase != StagePhase.PAUSE && stage_phase != StagePhase.FINISH)
        {
            MatrixCheck();
        }
       
        switch (stage_phase)
        {
            case StagePhase.INTRO:
                if (!first_check)
                {
                    forced_matrix_state = 1;
//                    player_manager.SendMessage("ForceMove", new Vector3(0, -200, 0));
                    first_check = true;
                }
                if (CheckInputCount())
                {
                    stage_phase += 1;
                    Hud_manager.SendMessage("disappear");
                    first_check = false;
                    ShowStageName();
                }
                break;
            case StagePhase.ENEMY:
                {
                    StagePhaseEnemy();
                }
                break;
            case StagePhase.BOSS_INTRO:
                if (boss_manager.activeSelf == false)
                {
                    matrix_state = false;
                    forced_matrix_state = 1;
                    Hud_manager.SendMessage("disappear");
                    boss_manager.SetActive(true);
                    player_manager.SendMessage("StopShoot");
                }
                break;
            case StagePhase.BOSS:
                {
                    StagePhaseBoss();
                }
                break;
            case StagePhase.FINISH:
                matrix_state = false;
                
                // todo: 이부분 꼭 바뀌어야 제대로 종료체크가 됨. 터치패널이 아닌 다른 부분으로.
                if (touch_panel.activeSelf == true)
                {
                    GameManager.quest_clear = false;
                    screentouchon();
                    forced_matrix_state = 1;
                    touch_panel.SetActive(false);
                    player_manager.SendMessage("StopShoot");
                    player_manager.SendMessage("ForceMove", new Vector3(0, 1500, 5));
                    MatrixOff();
                    if (InfinityModeCount == 0)
                    {
                        get_coin *= 1;
                    }
                    else
                    {
                        get_ticket = (InfinityModeCount - 1);
                        // todo: InfinityModeCount가 1이라서 경험치가 안차는 현상 수정 필요.
                        if (InfinityModeCount == 1)
                        {
                            get_exp = InfinityModeCount * 360;
                        }
                        else
                        {
                            get_exp = (InfinityModeCount - 1) * 360;    
                        }
                        
                    }
                    if (clear == 1)
                    {
                        InfinityModeCount = 1;
                        GameManager.quest_clear = true;
                        
                    }
                    else if (clear == 2)
                    {
                        InfinityModeCount = 0;
                    }
                        /*
                    else if (clear == 3)
                    {
                        InfinityModeCount -= 1;
                    }
                    */
                    PacketManager.instance.Request(PacketManager.PacketID.QUEST_FINISH);
                    Hud_manager.SendMessage("SetReward", clear);

                    /*GameManager.User.Gold += get_coin;
                    if (questdata.Mode == 1)
                    {
                        GameManager.User.Ruby += get_ticket;
                    }
                    else { GameManager.User.Ruby += 0; }
                    */
                }
                break;
            case StagePhase.PAUSE:
                if (!first_check)
                {
                    temp_timescale = Time.timeScale;
                    Time.timeScale = 0.0f;
                    touch_panel.SetActive(false);
 //                   map_manager.SendMessage("PauseBGM");
                    first_check = true;
                }
                break;
        }
    }
コード例 #10
0
 public void EnterPause()
 {
     if (stage_phase == StagePhase.PAUSE)
     {
         return;
     }
     else
     {
         Hud_manager.SendMessage("SetPause");
         temp_phase = stage_phase;
         stage_phase = StagePhase.PAUSE;
     }
 }
コード例 #11
0
    public void CallBossManager(int index)
    {
        // infinity mode용.
        
        stage_phase = StagePhase.BOSS_INTRO;
        strBuffer.Remove(0, strBuffer.Length);
        strBuffer.Append("BossManager");
        strBuffer.Append(index.ToString());

        DestroyImmediate(boss_manager);

        boss_manager = new GameObject();
        boss_manager.name = strBuffer.ToString();
        boss_manager.SetActive(false);
        is_boss_stage = false;

        if (questdata.Mode == 1) // infinity mode
        {
            InfinityModeCount++;
            LevelDifficulty++;
        }

        if (boss_manager.AddComponent("BossManager" + index.ToString() ) == null)
        {
            MoveToFinishPhase();
        }
        map_manager.SendMessage("StartBossBGM");
    }
コード例 #12
0
 public void ExitPause()
 {
     Hud_manager.SendMessage("QuitPause");
     touch_panel.SetActive(true);
     //        map_manager.SendMessage("PlayBGM");
     Time.timeScale = temp_timescale;
     stage_phase = temp_phase;
     first_check = false;
     if (CheckInputCount() != true)
     {
         screentouchoff();
     }
 }
コード例 #13
0
    public void CallEnemyManager(int index)
    {
        // infinity mode용.
        stage_phase = StagePhase.ENEMY;

        strBuffer.Remove(0, strBuffer.Length);
        strBuffer.Append("EnemyManager");
        strBuffer.Append(index.ToString());

        DestroyImmediate(enemy_manager);

        enemy_manager = new GameObject();
        enemy_manager.name =  strBuffer.ToString();
        enemy_manager.SetActive(false);

        if (enemy_manager.AddComponent("EnemyManager" + index.ToString()) == null)
        {
            MoveToFinishPhase();
        }
        else
        {
            StagePhaseEnemy();
            if (questdata.Mode == 1) // infinity mode
            {
                currnet_coin = 0;
                InfinityModeCount++;
            }
        }
        map_manager.SendMessage("StopBossBGM");
    }
コード例 #14
0
    void MoveToFinishPhase()
    {
        if (stage_phase == StagePhase.BOSS_INTRO)
        {
            touch_panel.SetActive(true);
        }

        stage_phase = StagePhase.FINISH;
        PlayerManager script = player_manager.GetComponent<PlayerManager>();
        if (script != null)
        {
            if ( 0 <= script.HP_current)
            {
                script.BeStrong();     
            }
        }
    }
コード例 #15
0
 void MoveToBossPhase()
 {
     if (!(stage_phase == StagePhase.FINISH))
         stage_phase = StagePhase.BOSS;
 }
コード例 #16
0
 public void EnterPauseForTutorial()
 {
     temp_phase = stage_phase;
     stage_phase = StagePhase.PAUSE;
 }
コード例 #17
0
 public void ExitPauseForTutorial()
 {
     touch_panel.SetActive(true);
     Time.timeScale = temp_timescale;
     stage_phase = temp_phase;
     first_check = false;
     if (CheckInputCount() != true)
     {
         screentouchoff();
     }
 }