Ejemplo n.º 1
0
        static IEnumerator TimeBonus()
        {
            int bonus = 0;

            GameManager.instance.TimeBonusText($"{TimeBonusPrefix}{bonus,5}</mspace>");
            int leftTime = Mathf.FloorToInt(GameParams.playTime * GameParams.TimeBonus);

            yield return(WaitForSecondsOrClick(WaitNextSeconds));

            int keta = 1;
            int waru = 10;

            while (leftTime > 0)
            {
                int count = (leftTime % waru) / keta;
                for (int i = 0; i < count; i++)
                {
                    bonus += keta;
                    GameParams.AddScore(keta);
                    SoundController.Play(SoundController.SeType.Click);
                    leftTime -= keta;

                    GameManager.instance.TimeBonusText($"{TimeBonusPrefix}{bonus,5}</mspace>");
                    GameParams.playTime = ((float)leftTime / GameParams.TimeBonus) + (0.1f / GameParams.TimeBonus);
                    yield return(waitFixed);
                }

                keta *= 10;
                waru *= 10;
            }
        }
Ejemplo n.º 2
0
        private void FixedUpdate()
        {
            if (!isEating)
            {
                return;
            }

            float t    = (Time.time - eatStartTime);
            float dist = Vector3.Distance(Graviy.MouthPosition, transform.position);

            if ((t >= eatTime) ||
                ((t >= eatMinTime) &&
                 (dist <= EatDistance)))
            {
                // 食べる
                Graviy.instance.EatDone(this);
                GameParams.AddScore(point);
                GameParams.AddLife(heal);
                Destroy(gameObject);
                return;
            }

            t = Mathf.Clamp01(t / eatTime);

            Vector3 next = Vector3.Lerp(transform.position, Graviy.MouthPosition, t);
            Vector3 move = (next - transform.position) / Time.fixedDeltaTime;

            rb.velocity = move;
        }
Ejemplo n.º 3
0
        private void Update()
        {
            if ((state == StateType.Game) ||
                (state == StateType.NextScene) ||
                (Time.time - waitStartTime < nextSceneWait))
            {
                return;
            }

            if (state == StateType.ToGameOver)
            {
                // ゲームオーバーになって、クリック可能になる秒数が経過したらボタンを表示してハイスコアチェック
                if (GameParams.Stage > 0)
                {
                    gameOverButtonAnimator.SetTrigger("Show");
                }
                else
                {
                    gameOverButtonAnimator.SetTrigger("ShowTitle");
                }
                if (GameParams.CheckHighScore())
                {
                    highScoreAnimator.gameObject.SetActive(true);
                    highScoreAnimator.SetTrigger("Show");
                    if (!GameParams.useDebugKey)
                    {
                        state = StateType.Ranking;
                        StartCoroutine(SceneChanger.ShowRanking(ToGameOver));
                        return;
                    }
                }
                state = StateType.GameOver;
            }
            else if (state == StateType.Clear && ClearSequencer.CanNext)
            {
                if (Input.GetMouseButtonDown(0))
                {
                    Graviy.SetAudioListener(false);
                    SoundController.Play(SoundController.SeType.Start);
                    clickAnimator.SetBool("Show", false);

                    // ステージクリア
                    if (GameParams.NextStage())
                    {
                        SceneChanger.ChangeScene(SceneChanger.SceneType.Ending);
                    }
                    else
                    {
                        SceneChanger.ChangeScene(SceneChanger.SceneType.Game);
                    }
                    state = StateType.NextScene;
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// ゲーム開始
        /// </summary>
        public void GameStart()
        {
            if (isStart)
            {
                return;
            }

            SoundController.Play(SoundController.SeType.Start);
            GameParams.NewGame();
            SceneChanger.ChangeScene(SceneChanger.SceneType.Game);
            isStart = true;
        }
Ejemplo n.º 5
0
        static IEnumerator ClearCoroutine(ClearObject clearObject)
        {
            // ブラックホールに吸い込まれる
            yield return(clearObject.ToBlackhole());

            Blackhole.instance.ClearDone();
            Graviy.instance.StartEat();

            // 落下
            yield return(clearObject.Fall());

            // 口を閉じてクリア表示
            Graviy.AddEnergy(Graviy.EnergyMax);
            Graviy.instance.CloseMouth();
            GameManager.ShowClear();

            yield return(WaitForSecondsOrClick(WaitNextSeconds));

            // タイムボーナス
            yield return(TimeBonus());

            yield return(WaitForSecondsOrClick(WaitNextSeconds));

            // ライフボーナス
            yield return(LifeBonus());

            yield return(WaitForSecondsOrClick(WaitNextSeconds));

            // アイテムパーフェクトボーナス
            if (GameManager.GetItem >= GameManager.ItemCount)
            {
                GameManager.instance.PerfectBonusText(PerfectBonusMessage);
                GameParams.AddScore(PerfectPoint);
                SoundController.Play(SoundController.SeType.Start);
            }
            else
            {
                GameManager.instance.PerfectBonusText($"{GameManager.ItemCount}{Kosu}コ</size>中{GameManager.GetItem}{Kosu}コ</size>ゲット。{GameManager.ItemCount - GameManager.GetItem}{Kosu}コ</size>とりのがし...");
            }

            yield return(WaitForSecondsOrClick(WaitNextSeconds));

            GameManager.ShowClick();
            CanNext = true;
        }
Ejemplo n.º 6
0
        static IEnumerator LifeBonus()
        {
            int bonus = 0;

            GameManager.instance.LifeBonusText($"{LifeBonusPrefix}{bonus,5}</mspace>");

            yield return(WaitForSecondsOrClick(WaitNextSeconds));

            while (GameParams.Life > 0)
            {
                yield return(WaitForSecondsOrClick(WaitLifeSeconds));

                bonus += LifeBonusPoint;
                GameParams.AddScore(LifeBonusPoint);
                SoundController.Play(SoundController.SeType.Click);
                GameParams.LifeDecrement();
                GameManager.instance.LifeBonusText($"{LifeBonusPrefix}{bonus,5}</mspace>");
            }
        }
Ejemplo n.º 7
0
        void Miss(Collider2D col)
        {
            if (mutekiTime >= 0)
            {
                return;
            }

            // 無敵時間設定
            mutekiTime = mutekiSeconds;

            SoundController.Play(SoundController.SeType.Miss);

            // 吹っ飛び処理
            Vector3 hitpos = col.ClosestPoint(transform.position);
            Vector3 addVec = transform.position - hitpos;
            Vector3 add    = addVec.normalized * blowOffAdd;

            rb.velocity = Vector2.zero;
            rb.AddForce(add, ForceMode2D.Impulse);

            // 吸い寄せ中のアイテムがあったら解除
            for (int i = 0; i < eatingCount; i++)
            {
                eatingObjects[i].ReleaseEat();
            }
            eatingCount = 0;
            anim.SetBool("Inhale", false);
            isEating = false;

            // ゲームオーバーチェック
            if (GameParams.LifeDecrement())
            {
                anim.SetInteger("State", (int)AnimType.Dead);
                gameObject.layer = gameOverLayer;
                rb.gravityScale  = gameOverGravityScale;
                GameManager.GameOver();
                return;
            }
        }
Ejemplo n.º 8
0
 public override void OnFadeOutDone()
 {
     base.OnFadeOutDone();
     GameParams.InitStageParams();
 }
Ejemplo n.º 9
0
        private void FixedUpdate()
        {
            if (!CanMove)
            {
                rb.velocity = Vector2.zero;
                return;
            }

            bool isSucked = suiyose.Suck();

            switch (state)
            {
            case StateType.Move:
                // 縮小チェック
                EnemyInBlackhole.StateType instate = enemyInBlackhole.FixedUpdateState();
                if (instate == EnemyInBlackhole.StateType.In)
                {
                    anim.SetInteger("State", (int)AnimType.Blackhole);
                    anim.SetFloat("Speed", 1);
                    state = StateType.Blackhole;

                    lastSucked = true;
                    break;
                }
                // 吸い寄せされていたら、歩きはキャンセルして、吸い寄せ
                if (isSucked)
                {
                    lastSucked = true;
                    anim.SetInteger("State", (int)AnimType.Sucked);
                    break;
                }

                if (lastSucked)
                {
                    // 吸い寄せられていたら、歩き速度未満になるまでは歩きに復帰しない
                    float spd = rb.velocity.magnitude;
                    if (spd >= walkSpeed)
                    {
                        break;
                    }
                }
                lastSucked = false;
                UpdateMove();
                break;

            case StateType.Blackhole:
                lastSucked = true;

                // 吸い込まれのチェック
                EnemyInBlackhole.StateType st = enemyInBlackhole.FixedUpdateState();
                if (st == EnemyInBlackhole.StateType.InDone)
                {
                    // 吸い込まれが完了した
                    ToSweets();
                    GameParams.AddScore(point);
                    Destroy(gameObject);
                }
                else if (st == EnemyInBlackhole.StateType.None)
                {
                    // 戻った
                    state = StateType.Move;
                    UpdateMove();
                }

                break;
            }
        }
Ejemplo n.º 10
0
 private void Start()
 {
     startTime   = nextSceneWait;
     isHighScore = GameParams.CheckHighScore();
     state       = StateType.Credit;
 }
Ejemplo n.º 11
0
 public override void OnFadeOutDone()
 {
     Graviy.SetAudioListener(true);
     GameParams.SetStartTime(stageTime);
     SceneManager.SetActiveScene(gameObject.scene);
 }