コード例 #1
0
    public void GiveCombination(string weaponType)
    {
        //Debug.Log(weaponType);
        CreateCombination cc = GetComponentInChildren <CreateCombination>();

        if (cc)
        {
            cc.GiveCustomCombo(weaponCombination);
            cc.UseCustomCombo();
        }
        else
        {
            Debug.Log("No Create Combination attached");
        }
        WeaponCombination wc = GetComponentInChildren <WeaponCombination>();

        if (wc)
        {
            wc.SwapWeapon(weaponType);
        }
        else
        {
            Debug.Log("No Create Weapon Combination attached");
        }
    }
コード例 #2
0
 protected void SetWeapon(string name)
 {
     if (playerHand.GetComponentInChildren <Weapon>() == true)
     {                                                                                   // If there is a weapon in hand..
         Destroy(playerHand.GetComponentInChildren <Weapon>().gameObject);               // .. Destroy it.
     }
     this.playerWeapon = ItemFactory.instance.CreateWeapon(playerHand, name);            // Spawn specified weapon.
     this.playerWeapon.transform.parent     = playerHand;                                // Make it the child of the hand.
     this.playerWeapon.transform.localScale = new Vector3(1, 1, 1);                      // Fix the scale.
     this.weaponComboScript = playerWeapon.GetComponentInChildren <WeaponCombination>(); // Sets a reference to the weapon's script.
 }
コード例 #3
0
    public void SwapWeaponType(string weaponType)
    {
        WeaponCombination wc = GetComponentInChildren <WeaponCombination>();

        if (wc)
        {
            wc.SwapWeapon(weaponType);
        }
        else
        {
            Debug.Log("No WeaponCombination attached");
        }
    }
コード例 #4
0
 public void SetWeaponHands(WeaponCombination _w, bool calm)
 {
     if (!calm) // In battle.
     {
         if (_w.GetWeaponGrip() == true)
         {
             // Set hands to one handed weapon
             OneHandGrip.SetActive(true);
             TwoHandGrip.SetActive(false);
             playerHand.transform.localPosition = new Vector3(-0.08f, -0.36f, 0f);
             playerWeapon.GetComponentInChildren <WeaponCombination>().SwitchHandleLayer(true);
             //Debug.Log("In Battle, One Hand");
         }
         else
         {
             // Set hands to two handed weapon
             OneHandGrip.SetActive(false);
             TwoHandGrip.SetActive(true);
             playerHand.transform.localPosition = new Vector3(-0.08f, 0.17f, 0f);
             playerWeapon.GetComponentInChildren <WeaponCombination>().SwitchHandleLayer(false);
             //Debug.Log("In Battle, Two Hand");
         }
     }
     else // Out of battle.
     {
         if (_w.GetWeaponGrip() == true)
         {
             // Set hands to one handed weapon
             OneHandGrip.SetActive(true);
             TwoHandGrip.SetActive(false);
             playerHand.transform.localPosition = new Vector3(-0.08f, -0.36f, 0f);
             playerWeapon.GetComponentInChildren <WeaponCombination>().SwitchHandleLayer(true);
             //Debug.Log("Out Battle, One Hand");
         }
         else
         {
             // Set hands to two handed weapon
             OneHandGrip.SetActive(true);
             TwoHandGrip.SetActive(false);
             playerHand.transform.localPosition = new Vector3(-0.08f, -0.36f, 0f);
             playerWeapon.GetComponentInChildren <WeaponCombination>().SwitchHandleLayer(true);
             //Debug.Log("Out Battle, Two Hand");
         }
     }
 }
コード例 #5
0
    private void UpdateCombination()
    {
        Sword  sword  = GetItem(SwordSlot) as Sword;
        Shield shield = GetItem(ShieldSlot) as Shield;

        if (sword || shield)
        {
            currentCombination = WeaponCombination.SwordShield;
            return;
        }

        MagicBook book = GetItem(BookSlot) as MagicBook;

        if (book)
        {
            currentCombination = WeaponCombination.Book;
            return;
        }
    }