예제 #1
0
    private void Update()
    {
        if (isCasting == false)
        {
            if (Input.GetKeyDown(KeyCode.Mouse0))
            {
                if (currentCooldowns[0] <= 0)
                {
                    CastRequest(Spellbook.CastTime(Spellbook.KeyRep.M0, TalentSystem.m0), TalentSystem.m0, 0);
                }
            }
            if (Input.GetKeyDown(KeyCode.Mouse1))
            {
                if (currentCooldowns[1] <= 0)
                {
                    CastRequest(Spellbook.CastTime(Spellbook.KeyRep.M1, TalentSystem.m1), TalentSystem.m1, 1);
                }
            }
            if (Input.GetKeyDown(KeyCode.Q))
            {
                if (currentCooldowns[2] <= 0)
                {
                    CastRequest(Spellbook.CastTime(Spellbook.KeyRep.Q, TalentSystem.keyQ), TalentSystem.keyQ, 2);
                }
            }
            if (Input.GetKeyDown(KeyCode.E))
            {
                if (currentCooldowns[3] <= 0)
                {
                    CastRequest(Spellbook.CastTime(Spellbook.KeyRep.E, TalentSystem.keyE), TalentSystem.keyE, 3);
                }
            }
            if (Input.GetKeyDown(KeyCode.R))
            {
                if (currentCooldowns[4] <= 0)
                {
                    CastRequest(Spellbook.CastTime(Spellbook.KeyRep.R, TalentSystem.keyR), TalentSystem.keyR, 4);
                }
            }
            if (Input.GetKeyDown(KeyCode.F))
            {
                if (currentCooldowns[5] <= 0)
                {
                    CastRequest(Spellbook.CastTime(Spellbook.KeyRep.F, TalentSystem.keyF), TalentSystem.keyF, 5);
                }
            }
        }


        if (isCasting == true && (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.D)))
        {
            CancelCast();
        }

        if (Input.GetKeyDown(KeyCode.T))
        {
            CancelCast();
        }
        if (isCasting == true)
        {
            Casting();
        }

        for (int i = 0; i < 6; i++)
        {
            if (currentCooldowns[i] >= 0)
            {
                currentCooldowns[i] = currentCooldowns[i] - Time.deltaTime;
            }
        }
    }