예제 #1
0
    private void DetectItem()
    {
        for (int i = 2; i < itemOption.Length; i++)
        {
            if (itemOption[i].active == true)
            {
                // Activating Item...
                if (itemOption[i].duration >= itemOption[i].activeTimer)
                {
                    itemOption[i].activeTimer += Time.deltaTime;
                }
                // Deactivated Item... Timer Out
                else
                {
                    switch (itemOption[i].typeEnum)
                    {
                    case ItemType.ScoreBooster:
                        igsScoreMultifly = 1;
                        break;

                    case ItemType.BigShield:
                        foreach (ItemOptions item in itemOption)
                        {
                            if (item.typeEnum == ItemType.ShieldFullCharge)
                            {
                                if (item.active == false)
                                {
                                    playerScript.OP_BigShield(playerScript.op_shieldOriginalSize);
                                }
                            }
                        }
                        break;

                    case ItemType.ShieldFullCharge:
                        foreach (ItemOptions item in itemOption)
                        {
                            if (item.typeEnum == ItemType.BigShield)
                            {
                                if (item.active == false)
                                {
                                    playerScript.OP_BigShield(playerScript.op_shieldOriginalSize);
                                }
                            }
                        }
                        playerScript.OP_ShieldFullCharge(false);
                        break;

                    case ItemType.PowerBooster:
                        playerScript.OP_PowerBooster(1.0f);
                        playerScript.OP_PowerBoosterDamage(1.0f);
                        break;
                    }
                    itemOption[i].active      = false;
                    itemOption[i].activeTimer = 0;
                    if (itemOption[i].usingItem != null)
                    {
                        Destroy(itemOption[i].usingItem.gameObject);
                    }
                }
            }
        }
    }