コード例 #1
0
    IEnumerator Slam()
    {
        while (!isGrounded)
        {
            body.velocity = new Vector2(0, -jumpSpeed * 1.5f);
            yield return(null);
        }
        Instantiate(slamParticles, transform);
        Collider2D[] results = new Collider2D[8];
        results = Physics2D.OverlapBoxAll(transform.position, slamSize, 0);
        foreach (Collider2D col in results)
        {
            if (col != null && col.gameObject.name.Equals("Dummy B"))
            {
                dummiesHit++;
                switch (dummiesHit)
                {
                case (4):
                    tutorialController.DummyDamage("B");
                    tutorialController.SetComplete(1);
                    break;

                case (5):
                    tutorialController.DummyDamage("B");
                    tutorialController.SetComplete(2);
                    break;

                case (6):
                    tutorialController.DummyDamage("B");
                    tutorialController.SetComplete(3);
                    tutorialController.LearnBlock();
                    break;
                }
                break;
            }
        }
        lastJumpTime = Time.time;
        sound.PlaySlam();
        yield return(new WaitForSeconds(jumpCooldown));

        attackObject.isAttacking = false;
    }