Esempio n. 1
0
    public int makeAttack(AtkType a)
    {
        switch (a)
        {
        case AtkType.DownAir:
            currentAttack = Instantiate(DownAir, transform, false);
            source.PlayOneShot(DownAir.GetComponent <Attack>().attackSound, hitVolume);
            break;

        case AtkType.NeutralAir:
            currentAttack = Instantiate(NeutralAir, transform, false);
            source.PlayOneShot(NeutralAir.GetComponent <Attack>().attackSound, hitVolume);
            break;

        case AtkType.UpAir:
            currentAttack = Instantiate(UpAir, transform, false);
            source.PlayOneShot(UpAir.GetComponent <Attack>().attackSound, hitVolume);
            break;

        case AtkType.ForwardAir:
            currentAttack = Instantiate(ForwardAir, transform, false);
            source.PlayOneShot(ForwardAir.GetComponent <Attack>().attackSound, hitVolume);
            break;

        case AtkType.BackAir:
            currentAttack = Instantiate(BackAir, transform, false);
            source.PlayOneShot(BackAir.GetComponent <Attack>().attackSound, hitVolume);
            break;

        case AtkType.DownGround:
            currentAttack = Instantiate(DownGround, transform, false);
            source.PlayOneShot(DownGround.GetComponent <Attack>().attackSound, hitVolume);
            break;

        case AtkType.UpGround:
            currentAttack = Instantiate(UpGround, transform, false);
            source.PlayOneShot(UpGround.GetComponent <Attack>().attackSound, hitVolume);
            break;

        case AtkType.BackGround:
            currentAttack = Instantiate(BackGround, transform, false);
            source.PlayOneShot(BackGround.GetComponent <Attack>().attackSound, hitVolume);
            break;

        case AtkType.ForwardGround:
            currentAttack = Instantiate(ForwardGround, transform, false);
            source.PlayOneShot(ForwardGround.GetComponent <Attack>().attackSound, hitVolume);
            break;

        case AtkType.NeutralGround:
            currentAttack = Instantiate(NeutralGround, transform, false);
            source.PlayOneShot(NeutralGround.GetComponent <Attack>().attackSound, hitVolume);
            break;

        case AtkType.Finisher:
            currentAttack = Instantiate(Finisher, transform, false);
            source.PlayOneShot(Finisher.GetComponent <Attack>().attackSound, finisherVolume);
            ComboCounter c = GetComponent <ComboCounter>();
            currentAttack.GetComponent <AttackActive>().comboStrength = c.currentCombo;
            c.reset();
            break;

        default:
            print("Not implemented");
            currentAttack = Instantiate(NeutralAir, transform, false);
            break;
        }
        currentAttack.GetComponent <AttackActive>().setType(a);
        mf = currentAttack.GetComponent <MovePhysics>();
        return(currentAttack.GetComponent <AttackActive>().atkFrames);
    }