Ejemplo n.º 1
0
 public void startStun()
 {
     if (/*checkStun() && */ manaCount.getMana() > 0)
     {
         //manaCount.useMana (1);
         //enemy.SetSpeed(0);  //sets the enemies speed to 0
         enemyDmg.multiplyDamage(2);
         enemy.SetStun(true);
         StartCoroutine(WaitForStun());             // Starts the wait time for stun
     }
 }
Ejemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     if (timeforCool1.canUse(Time.time)) //Uncomment for cool down
     {
         if (Input.GetKey(KeyCode.Alpha1) && buttonPressed == false)
         {
             if (wallcount == 0 && (manaCount.getMana() > 0))
             {
                 obj.SetActive(true);
                 if (Ray.shootRayDown(obj, playerpos.transform.position, 3, true, playerpos.facingRight))
                 {
                     playerpos.SFX.PlayOneShot(playerpos.spellSFX);
                     manaCount.useMana(1);
                     wallcount = 1;
                     timeforCool1.addTime(Time.time, wallCoolDown);
                     //playerpos.lockMovement();
                     timeforCool2.addTime(Time.time, 3.5f);
                     buttonPressed = true;
                     movewall      = true;
                 }
                 else
                 {
                     obj.SetActive(false);
                 }
             }
         }
         if (movewall)
         {
             //print("moveWall");
             if ((timeforCool2.canUse(Time.time)) || Input.GetKeyUp(KeyCode.Alpha1))
             {
                 finishWallMove();
             }
             else
             {
                 //print("here");
                 StartCoroutine(moveWall());
             }
         }
         if (Input.GetKeyUp(KeyCode.Alpha1))
         {
             buttonPressed = false;
         }
     }
 }
Ejemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        if (coolDown.canUse(Time.time))
        {
            if (Input.GetKeyDown(KeyCode.O) && playerHP.getMana() > 0 && !hasWand)
            {
                player.animator.SetBool("Spellcasting", true);
                player.SFX.PlayOneShot(player.fireball);
                // bul.SetActive(true);
                if (player.facingRight)
                {
                    pro.setSpeed(player.facingRight);
                    makeProjectile(2, 0.15f);
                    playerHP.useMana(1);
                }
                else
                {
                    pro.setSpeed(player.facingRight);
                    print(pro.projectileSpeed);
                    makeProjectile(-2, -0.15f);
                    playerHP.useMana(1);
                }
                coolDown.addTime(Time.time, timeforCoolDown);
            }
            else if (Input.GetKeyDown(KeyCode.O) && hasWand)
            {
                player.animator.SetBool("Spellcasting", true);
                player.SFX.PlayOneShot(player.fireball);
                // bul.SetActive(true);
                if (player.facingRight)
                {
                    pro.setSpeed(player.facingRight);
                    makeProjectile(2, 0.15f);
                }
                else
                {
                    pro.setSpeed(player.facingRight);
                    print(pro.projectileSpeed);
                    makeProjectile(-2, -0.15f);
                }
                coolDown.addTime(Time.time, timeforCoolDown);
            }
        }


        if (Input.GetKeyUp(KeyCode.O))
        {
            player.animator.SetBool("Spellcasting", false);
        }
        if (Input.GetKeyDown(KeyCode.Alpha4) && playerHP.getMana() > 0)         //&& (PlayerPrefs.GetString("hasFreeze") == "true"))
        {
            // bul.SetActive(true);
            if (player.facingRight)
            {
                ice.setSpeed(player.facingRight);
                makeFreeze(1, 1);
            }
            else
            {
                ice.setSpeed(player.facingRight);
                //print(ice.projectileSpeed);
                makeFreeze(-1, -1);
            }
            playerHP.useMana(1);
            freezeCool.addTime(Time.time, timeforCoolDown);
        }

        if (Input.GetKeyDown(KeyCode.Alpha3) && playerHP.getMana() > 0 && (PlayerPrefs.GetString("hasHeal") == "true"))
        {
            player.SFX.PlayOneShot(player.spellSFX);
            playerHP.useMana(1);
            playerHP.heal();
        }
    }