private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("MagicSword"))
     {
         audioSrc.volume = 1.0f;
         audioSrc.pitch  = 0.8f;
         audioSrc.PlayOneShot(pickupSword);
         MagicSwordPickedUp = true;
         EnableWeapon(2);
         powcount.EnableWeapon(2);
         Destroy(other.gameObject);
         ItemPause = gameCtrl.GetComponent <PauseMenu>();
         ItemPause.ItemPauseGame(PauseMenu.PauseState.ItemPause);
         ItemMenuFlameSword.SetActive(true);
     }
     if (other.gameObject.CompareTag("ThunderSword"))
     {
         audioSrc.volume = 1.0f;
         audioSrc.pitch  = 1.2f;
         audioSrc.PlayOneShot(pickupSword);
         ThunderSwordPickedUp = true;
         EnableWeapon(3);
         powcount.EnableWeapon(3);
         Destroy(other.gameObject);
         ItemPause = gameCtrl.GetComponent <PauseMenu>();
         ItemPause.ItemPauseGame(PauseMenu.PauseState.ItemPause);
         ItemMenuElectroSword.SetActive(true);
     }
     if (other.gameObject.CompareTag("IceSword"))
     {
         audioSrc.volume = 1.0f;
         audioSrc.pitch  = 1.5f;
         audioSrc.PlayOneShot(pickupSword);
         IceSwordPickedUp = true;
         EnableWeapon(4);
         powcount.EnableWeapon(4);
         Destroy(other.gameObject);
         ItemPause = gameCtrl.GetComponent <PauseMenu>();
         ItemPause.ItemPauseGame(PauseMenu.PauseState.ItemPause);
         ItemMenuFrostSword.SetActive(true);
     }
 }
Esempio n. 2
0
 public void BroadSword()
 {
     WeapSelect.EnableWeapon(1);
     powCount.EnableWeapon(1);
 }
    public void EnableWeapon(int sword)
    {
        //audioSrc.PlayOneShot(selection);
        EnableSword = SwordModel.GetComponent <AnimatedSword>();
        //if (sword == 0)
        //{
        //    Armed.SetActive(true);
        //    arrows.enabled = true;
        //    arrowUI.enabled = true;
        //    weaponSelected.text = "Crossbow";
        //    broadSword.SetActive(false);
        //    magicSword.SetActive(false);
        //    thunderSword.SetActive(false);
        //    crossBow.SetActive(true);
        //    swordOfIce.SetActive(false);
        //    Unarmed.SetActive(false);
        //    crossbowImg.enabled = true;
        //    broadSwordImg.enabled = false;
        //    magicSwordImg.enabled = false;
        //    thunderSwordImg.enabled = false;
        //    swordOfIceImg.enabled = false;
        //    UnarmedEnabled = false;

        //}
        if (sword == 1)
        {
            powcount = GetComponent <PowerCounter>();
            Armed.SetActive(true);
            arrows.enabled      = false;
            arrowUI.enabled     = false;
            weaponSelected.text = "Broad Sword";
            broadSword.SetActive(true);
            magicSword.SetActive(false);
            thunderSword.SetActive(false);
            crossBow.SetActive(false);
            swordOfIce.SetActive(false);
            Unarmed.SetActive(false);
            crossbowImg.enabled     = false;
            broadSwordImg.enabled   = true;
            magicSwordImg.enabled   = false;
            thunderSwordImg.enabled = false;
            swordOfIceImg.enabled   = false;
            UnarmedEnabled          = false;
            powcount.EnableWeapon(1);
            EnableSword.SwordEquip(AnimatedSword.EquipSword.BroadSword);
        }
        if (sword == 2)
        {
            powcount = GetComponent <PowerCounter>();
            Armed.SetActive(true);
            arrows.enabled      = false;
            arrowUI.enabled     = false;
            weaponSelected.text = "Flame Sword";
            broadSword.SetActive(false);
            magicSword.SetActive(true);
            thunderSword.SetActive(false);
            crossBow.SetActive(false);
            swordOfIce.SetActive(false);
            Unarmed.SetActive(false);
            crossbowImg.enabled     = false;
            broadSwordImg.enabled   = false;
            magicSwordImg.enabled   = true;
            thunderSwordImg.enabled = false;
            swordOfIceImg.enabled   = false;
            UnarmedEnabled          = false;
            powcount.EnableWeapon(2);
            EnableSword.SwordEquip(AnimatedSword.EquipSword.FlameSword);
        }
        if (sword == 3)
        {
            powcount = GetComponent <PowerCounter>();
            Armed.SetActive(true);
            arrows.enabled      = false;
            arrowUI.enabled     = false;
            weaponSelected.text = "Electro Sword";
            broadSword.SetActive(false);
            magicSword.SetActive(false);
            thunderSword.SetActive(true);
            crossBow.SetActive(false);
            swordOfIce.SetActive(false);
            Unarmed.SetActive(false);
            crossbowImg.enabled     = false;
            broadSwordImg.enabled   = false;
            magicSwordImg.enabled   = false;
            thunderSwordImg.enabled = true;
            swordOfIceImg.enabled   = false;
            UnarmedEnabled          = false;
            powcount.EnableWeapon(3);
            EnableSword.SwordEquip(AnimatedSword.EquipSword.ThunderSword);
        }
        if (sword == 4)
        {
            powcount = GetComponent <PowerCounter>();
            Armed.SetActive(true);
            arrows.enabled      = false;
            arrowUI.enabled     = false;
            weaponSelected.text = "Glacial Sword";
            broadSword.SetActive(false);
            magicSword.SetActive(false);
            thunderSword.SetActive(false);
            crossBow.SetActive(false);
            swordOfIce.SetActive(true);
            Unarmed.SetActive(false);
            crossbowImg.enabled     = false;
            broadSwordImg.enabled   = false;
            magicSwordImg.enabled   = false;
            thunderSwordImg.enabled = false;
            swordOfIceImg.enabled   = true;
            UnarmedEnabled          = false;

            EnableSword.SwordEquip(AnimatedSword.EquipSword.GlacialSword);
            powcount.EnableWeapon(4);
        }
        if (sword == 5)
        {
            arrows.enabled      = false;
            arrowUI.enabled     = false;
            weaponSelected.text = "Unarmed";
            Armed.SetActive(false);
            Unarmed.SetActive(true);
            crossbowImg.enabled     = false;
            broadSwordImg.enabled   = false;
            magicSwordImg.enabled   = false;
            thunderSwordImg.enabled = false;
            swordOfIceImg.enabled   = false;
            UnarmedEnabled          = true;
        }
        UnarmedEnabled = false;
        SwordAttacked  = SwordModel.GetComponent <AnimatedSword>();
        SwordAttacked.ResetAttacked();
    }