コード例 #1
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>");
            }
        }
コード例 #2
0
ファイル: Graviy.cs プロジェクト: dat19/HungraviyEx2019
        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;
            }
        }