예제 #1
0
 private void FixedUpdate()
 {
     if (items.CurrentItem() == null || !WeaponEnabled)
     {
         return;
     }
     else if (items.CurrentItem().canPowerUp.value)
     {
         if (Input.GetButtonDown(InputType) && !items.CurrentItem().inUse)
         {
             startTime = Time.time;
         }
         else if (Input.GetButtonUp(InputType) && !items.CurrentItem().inUse)
         {
             endTime = Time.time;
             if (endTime - startTime >= powerUpTime)
             {
                 endTime   = 0;
                 startTime = 0;
                 StartCoroutine(items.CurrentItem().UsePoweredWeapon(getWeaponAttackObj(), Player));
             }
             else
             {
                 endTime   = 0;
                 startTime = 0;
                 StartCoroutine(items.CurrentItem().UseItem(getWeaponAttackObj(), Player));
             }
         }
     }
     else
     {
         if (Input.GetButtonDown(InputType) && !items.CurrentItem().inUse)
         {
             StartCoroutine(items.CurrentItem().UseItem(getWeaponAttackObj(), Player));
         }
     }
 }
예제 #2
0
    private void SetSprites()
    {
        numtimesthrough = 0;
        rightIndex      = GetRight(equipped.CurrentEquip);
        numtimesthrough = 0;
        leftIndex       = GetLeft(equipped.CurrentEquip);
        if (equipped.items[rightIndex] != null)
        {
            right.sprite = equipped.items[rightIndex].sprite;
            right.color  = corners;
            if (equipped.items[rightIndex] is Usable_Amount_Item)
            {
                rightAmount.gameObject.SetActive(true);
                Usable_Amount_Item temp = equipped.items[rightIndex] as Usable_Amount_Item;
                rightAmount.text = temp.amount.value.ToString();
            }
            else
            {
                rightAmount.gameObject.SetActive(false);
            }
        }
        else
        {
            rightAmount.gameObject.SetActive(false);
            right.color = Color.clear;
        }

        if (equipped.items[leftIndex] != null)
        {
            left.sprite = equipped.items[leftIndex].sprite;
            left.color  = corners;
            if (equipped.items[leftIndex] is Usable_Amount_Item)
            {
                leftAmount.gameObject.SetActive(true);
                Usable_Amount_Item temp = equipped.items[leftIndex] as Usable_Amount_Item;
                leftAmount.text = temp.amount.value.ToString();
            }
            else
            {
                leftAmount.gameObject.SetActive(false);
            }
        }
        else
        {
            left.color = Color.clear;
            leftAmount.gameObject.SetActive(false);
        }

        if (equipped.CurrentItem() != null)
        {
            current.sprite = equipped.CurrentItem().sprite;
            current.color  = center;
            if (equipped.CurrentItem() is Usable_Amount_Item)
            {
                currentAmount.gameObject.SetActive(true);
                Usable_Amount_Item temp = equipped.CurrentItem() as Usable_Amount_Item;
                currentAmount.text = temp.amount.value.ToString();
            }
            else
            {
                currentAmount.gameObject.SetActive(false);
            }
        }
        else
        {
            currentAmount.gameObject.SetActive(false);
            current.color = Color.clear;
        }
    }