예제 #1
0
 private void HandleCasting()
 {
     if (Input.GetKeyDown(KeyCode.Space) && preparing == false && casting == false)
     {
         preparing = true;
         if (spellbookScroller.activeSelf == true)
         {
             spellbookScroller.SetActive(false);
             spellBookController.gameObject.SetActive(false);
         }
         componentLoader.GatherComponents(spellBook[currentSpell].components);
     }
     else if (casting)
     {
         castTicker += Time.deltaTime;
         if (castTicker > castSpeed)
         {
             castTicker = 0;
             ConsumeMana(WorldObject.CASTING_COST);
             CastResult res = spellBook[currentSpell].CastNext();
             //Debug.Log(res.storedMagic);
             if (res.storedMagic > channelLimit)
             {
                 HandleAberration("GandalfOverflowAberration!", res.storedMagic);
             }
             else if (res.aberration != "")
             {
                 HandleAberration(res.aberration, res.storedMagic);
             }
             else
             {
                 if (spellBook[currentSpell].currentLine == -1)
                 {
                     casting = false;
                 }
                 else
                 {
                     voice.Speak(spellBook[currentSpell].SpeakNext(), castSpeed);
                 }
             }
         }
     }
 }