Example #1
0
    private void CopyDisplaceProperty(DisplacementProperty prop)
    {
        eDisplacementType type = new eDisplacementType();

        type = prop.displacementType;

        int[] values = new int[5];

        for (int i = 0; i < 5; i++)
        {
            int val = prop.distancePerLevel [i];
            values [i] = val;
        }

        bool targetCaster = prop.targetCasterOverride;
        bool affectCaster = prop.affectsCaster;
        bool allies       = prop.affectsAllyPlayers;
        bool allySummon   = prop.affectsAllySummons;
        bool enemies      = prop.affectsEnemyPlayers;
        bool enemySummon  = prop.affectsAllySummons;

        DisplacementProperty newProp = new DisplacementProperty();

        newProp.displacementType     = type;
        newProp.distancePerLevel     = values;
        newProp.targetCasterOverride = targetCaster;
        newProp.affectsCaster        = affectCaster;
        newProp.affectsAllyPlayers   = allies;
        newProp.affectsAllySummons   = allySummon;
        newProp.affectsEnemyPlayers  = enemies;
        newProp.affectsEnemySummons  = enemySummon;

        ability.critDisplacementEffects.Add(newProp);
    }
Example #2
0
    private void DrawDisplacementProperty(DisplacementProperty prop, int index, bool crit)
    {
        int propID = crit ? critTotal + total : total;

        EditorGUILayout.BeginVertical("box");
        GUILayout.Space(5);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(5);

        string type = ToUppercaseStart(prop.displacementType.ToString());

        EditorGUILayout.LabelField("Displace - " + type + ":", EditorStyles.boldLabel, GUILayout.MaxWidth(100));
        if (prop.displacementType == eDisplacementType.PUSH || prop.displacementType == eDisplacementType.PULL)
        {
            EditorGUILayout.LabelField(prop.distancePerLevel [showLevel - 1] + " cells", EditorStyles.boldLabel, GUILayout.MaxWidth(60));
            EditorGUILayout.LabelField("at level " + showLevel, GUILayout.MinWidth(60));
        }
        else
        {
            EditorGUILayout.LabelField("");
        }

        if (prop.displacementType == eDisplacementType.BLINK)
        {
            prop.targetCasterOverride = true;
        }

        if (editEffectIndex == propID)
        {
            if (GUILayout.Button("Hide", EditorStyles.miniButtonLeft, GUILayout.Width(60)))
            {
                editEffectIndex = int.MaxValue;
            }
        }
        else
        {
            if (GUILayout.Button("Show", EditorStyles.miniButtonLeft, GUILayout.Width(60)))
            {
                editEffectIndex = propID;
            }
        }

        if (GUILayout.Button("Remove", EditorStyles.miniButtonRight, GUILayout.Width(60)))
        {
            if (!crit)
            {
                ability.displacementEffects.RemoveAt(index);
                total--;
            }
            else
            {
                ability.critDisplacementEffects.RemoveAt(index);
                critTotal--;
            }
            return;
        }
        GUILayout.Space(5);
        EditorGUILayout.EndHorizontal();
        GUILayout.Space(2);

        if (editEffectIndex == propID)
        {
            GUILayout.Space(4);
            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(4);
            EditorGUILayout.LabelField("Displacement Type:", GUILayout.Width(130));
            prop.displacementType = (eDisplacementType)EditorGUILayout.EnumPopup(prop.displacementType, GUILayout.Width(80), GUILayout.Height(15));
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(2);

            for (int i = 0; i < 5; i++)
            {
                if (prop.displacementType == eDisplacementType.PUSH || prop.displacementType == eDisplacementType.PULL)
                {
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Space(4);
                    EditorGUILayout.LabelField("Level " + (i + 1) + ":", GUILayout.Width(60));
                    GUILayout.Label("Distance:", GUILayout.MaxWidth(100));
                    prop.distancePerLevel [i] = EditorGUILayout.IntField(prop.distancePerLevel [i], GUILayout.Width(40));
                    EditorGUILayout.EndHorizontal();
                }
            }
            GUILayout.Space(5);
        }

        //Affected Units.
        DrawAffectedUnitsPanel(propID, ref prop.targetCasterOverride, ref prop.affectsCaster, ref prop.affectsAllyPlayers, ref prop.affectsAllySummons, ref prop.affectsEnemyPlayers, ref prop.affectsEnemySummons);

        EditorGUILayout.EndVertical();
    }