コード例 #1
0
    // Use this for initialization
    void Start()
    {
        for (int numType = 0; numType < m_statusEffects.Length; ++numType)
        {
            List <StatusEffectItem> itemList = new List <StatusEffectItem>();
            for (int i = 0; i < m_poolAmount; ++i)
            {
                StatusEffectItem newStatusEffect = new StatusEffectItem();

                newStatusEffect.m_object = Instantiate(m_statusEffects[numType], this.transform);



                StatusEffect effectScript = newStatusEffect.m_object.GetComponent <StatusEffect>();

                if (effectScript != null)
                {
                    effectScript.m_manager   = this.transform;
                    newStatusEffect.m_type   = effectScript.m_type;
                    newStatusEffect.m_script = effectScript;
                }



                newStatusEffect.m_object.SetActive(false);
                newStatusEffect.m_object.transform.parent = this.transform;


                itemList.Add(newStatusEffect);
            }

            m_pool.Add(itemList);
        }
    }
コード例 #2
0
    private void ShowConsumables()
    {
        GUILayout.Label("> Consumable", EditorStyles.boldLabel);
        //newConsumableType = (Enums.eConsumableType)EditorGUILayout.EnumPopup("Consumable: ", newConsumableType);
        ConsumableItem consumable = (ConsumableItem)mCurrentCreateType;

        switch (consumable.ConsumableType)
        {
        case Enums.eConsumableType.Recovery:
            GUILayout.Label("  > Recovery", EditorStyles.boldLabel);
            RecoveryItem recovery = (RecoveryItem)consumable;
            //newRecoveryStatType = (Enums.eConsumableStatType)EditorGUILayout.EnumPopup("Stat Type: ", newRecoveryStatType);
            GUILayout.Label("Recovery Type: " + recovery.ConsumableStatType, EditorStyles.boldLabel);
            recoveryAmount = EditorGUILayout.IntField("Recovery Amount: ", Mathf.Clamp(recoveryAmount, 0, 99));

            //if (mCurrentItem.GetType() != typeof(RecoveryItem))
            //{
            //    mCurrentItem = new RecoveryItem();
            //}
            break;

        case Enums.eConsumableType.StatUpgrade:
            GUILayout.Label("  > Stat Upgrade", EditorStyles.boldLabel);
            StatUpgradeItem statUpgrade = (StatUpgradeItem)consumable;
            newStatType     = (Enums.eStatType)EditorGUILayout.EnumPopup("Boost Max Stat: ", newStatType);
            statBoostAmount = EditorGUILayout.IntField("Amount: ", Mathf.Clamp(statBoostAmount, 0, 99));

            //if (mCurrentItem.GetType() != typeof(StatUpgradeItem))
            //{
            //    mCurrentItem = new StatUpgradeItem();
            //}
            break;

        case Enums.eConsumableType.StatusEffect:
            GUILayout.Label("  > Status Effect", EditorStyles.boldLabel);
            StatusEffectItem status = (StatusEffectItem)consumable;
            newEffectType = (Enums.eStatusEffect)EditorGUILayout.EnumPopup("Effect: ", newEffectType);

            //if (mCurrentItem.GetType() != typeof(StatusEffectItem))
            //{
            //    mCurrentItem = new StatusEffectItem();
            //}
            break;

        case Enums.eConsumableType.WeaponUpgrade:
            GUILayout.Label("  > Weapon Upgrade", EditorStyles.boldLabel);
            WeaponUpgradeItem weaponUpgrade = (WeaponUpgradeItem)consumable;
            GUILayout.Label("Stat Boosted: ATT", EditorStyles.boldLabel);
            weaponUpgradeAmount = EditorGUILayout.IntField("Amount: ", Mathf.Clamp(weaponUpgradeAmount, 0, 99));

            //if (mCurrentItem.GetType() != typeof(WeaponUpgradeItem))
            //{
            //    mCurrentItem = new WeaponUpgradeItem();
            //}
            break;

        case Enums.eConsumableType.CharacterSupport:
            GUILayout.Label("  > Character Support", EditorStyles.boldLabel);
            CharacterSupportItem support = (CharacterSupportItem)consumable;
            switch (support.SupportType)
            {
            case Enums.eCharacterSupportType.Teleport:
                GUILayout.Label("    > Teleport", EditorStyles.boldLabel);
                Teleport t = (Teleport)support;
                TeleportPrefab = (GameObject)EditorGUILayout.ObjectField("Prefab:", TeleportPrefab, typeof(GameObject), false);
                if (TeleportPrefab != null)
                {
                    TeleportPrefabName = TeleportPrefab.name;
                }
                break;

            case Enums.eCharacterSupportType.Revive:
                GUILayout.Label("    > Revive", EditorStyles.boldLabel);
                // no fields
                break;

            case Enums.eCharacterSupportType.Resource:
                GUILayout.Label("    > Resource", EditorStyles.boldLabel);
                // will need fields filled in
                break;

            case Enums.eCharacterSupportType.Scroll:
                GUILayout.Label("    > Scroll", EditorStyles.boldLabel);

                ScrollTeachType = (Enums.eSpellType)EditorGUILayout.EnumPopup("Spell Type: ", ScrollTeachType);
                break;
            }
            break;
        }
    }