public void GameClear()
    {
        IsGesslerBattle = false;
        gameState       = G20_GameState.CLEAR;
        //gameRootAnim.enabled = true;
        //gameRootAnim.CrossFade("ToClear", 0.1f);
        //StartCoroutine(RootAnimOff(2f));

        // 敵(残ってれば)全滅
        G20_EnemyCabinet.GetInstance().KillAllEnemys();
        G20_ScoreApplePopper.GetInstance().DeleteAllScoreApples();
        G20_BGMManager.GetInstance().FadeOut();
        G20_BulletShooter.GetInstance().coutingHitRate = false;
        // クリア演出の開始
        G20_ClearPerformer.GetInstance().Excute(GameEnd);
    }
Example #2
0
    void ScoreAppleUpdate()
    {
        if (scoreApplePatern.Length == 0)
        {
            return;
        }

        scoreApplePopTimer += Time.deltaTime;

        if (timer > scoreAppleCanPopTimeMin &&
            scoreApplePopTimer > scoreApplePopInterval)
        {
            scoreApplePopTimer = 0f;
            G20_ScoreApplePopper.GetInstance().PopApple(scoreApplePatern[scoreApplePaternCueCounter]);
            scoreApplePaternCueCounter++;
            if (scoreApplePaternCueCounter >= scoreApplePatern.Length)
            {
                scoreApplePaternCueCounter = 0;
            }
        }
    }
    IEnumerator FallCoroutine()
    {
        // 落下
        Vector3 velocity = Vector3.zero;

        rb.useGravity  = true;
        rb.isKinematic = false;
        transform.parent.GetComponent <Animator>().enabled = false;
        rb.velocity = Vector3.zero;
        while (transform.position.y > hitGroundHeight)
        {
            //velocity += Physics.gravity * Time.deltaTime;
            //transform.position += velocity * Time.deltaTime;
            yield return(null);
        }
        //while ( transform.localPosition.y > -0.6f )
        //{
        //    velocity += Physics.gravity * Time.deltaTime;
        //    transform.localPosition += velocity * Time.deltaTime;
        //    yield return null;
        //}

        //GetComponent<Animator>().enabled = true;
        //GetComponent<Animator>().CrossFade("AppleFall", 0f);

        //yield return new WaitForSeconds(1);
        //// 地面に当たる
        //velocity.y *= -1;
        //bool isRightSide = transform.position.x > 0;
        //velocity.x = 3f * ( isRightSide ? -1 : 1 );

        G20_ScoreApplePopper.GetInstance().UnregisterApple(this);

        Vector3 pos = transform.position;

        pos.y = hitGroundHeight + 0.02f;
        transform.position = pos;
        //transform.position += velocity * Time.deltaTime;
        //yield return null;

        //velocity.y *= bounceRate;

        //// もう一度放物線運動
        //while ( transform.position.y > hitGroundHeight )
        //{
        //    velocity += Physics.gravity * Time.deltaTime;
        //    velocity.x -= 6f * Time.deltaTime * ( velocity.x > 0 ? 1 : -1 );
        //    transform.position += velocity * Time.deltaTime;
        //    transform.rotation = Quaternion.Euler(
        //        0, 0, 180 * Time.deltaTime * ( isRightSide ? 1 : -1 ))
        //        * transform.rotation;
        //    yield return null;
        //}

        rb.velocity *= -bounceRate;
        rb.AddForce(transform.right, ForceMode.VelocityChange);
        var rate = Random.Range(1f, 2f);

        rb.AddTorque(transform.forward * -rate, ForceMode.VelocityChange);
        //rb.velocity +=
        while (transform.position.y > hitGroundHeight)
        {
            yield return(null);
        }

        // 消える
        yield return(StartCoroutine(FadeOut()));

        Destroy(transform.parent.gameObject);
    }