CopyAction() public method

public CopyAction ( int index ) : void
index int
return void
Ejemplo n.º 1
0
    public static AIBehaviour AIBehaviourSettings(AIBehaviour ai, int index)
    {
        GUILayout.Label("Priority "+(index+1).ToString(), EditorStyles.boldLabel);
        ai.battleAI = EditorGUILayout.Popup("Battle AI", ai.battleAI,
                DataHolder.BattleAIs().GetNameList(true), GUILayout.Width(mWidth));
        ai.difficultyID = EditorGUILayout.Popup("Difficulty", ai.difficultyID,
                DataHolder.Difficulties().GetNameList(true), GUILayout.Width(mWidth));
        EditorGUILayout.Separator();

        if(GUILayout.Button("Add action", GUILayout.Width(mWidth*0.5f)))
        {
            ai.AddAction();
        }
        for(int i=0; i<ai.attackSelection.Length; i++)
        {
            EditorGUILayout.BeginVertical("box");
            EditorGUILayout.BeginHorizontal();
            GUILayout.Label("Action "+(i+1).ToString(), EditorStyles.boldLabel);
            EditorGUILayout.Separator();
            if(GUILayout.Button("Remove", GUILayout.Width(mWidth*0.3f)))
            {
                ai.RemoveAction(i);
                break;
            }
            if(GUILayout.Button("Copy", GUILayout.Width(mWidth*0.3f)))
            {
                ai.CopyAction(i);
            }
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Separator();

            ai.actionDifficultyID[i] = EditorGUILayout.Popup("Difficulty", ai.actionDifficultyID[i],
                    DataHolder.Difficulties().GetNameList(true), GUILayout.Width(mWidth));
            EditorGUILayout.Separator();

            EditorGUILayout.BeginHorizontal();
            ai.attackSelection[i] = (AttackSelection)EditorGUILayout.EnumPopup(
                    ai.attackSelection[i], GUILayout.Width(mWidth*0.5f));
            if(AttackSelection.SKILL.Equals(ai.attackSelection[i]))
            {
                ai.useID[i] = EditorGUILayout.Popup(ai.useID[i],
                        DataHolder.Skills().GetNameList(true), GUILayout.Width(mWidth*0.7f));
                ai.useLevel[i] = EditorGUILayout.IntField("Skill level", ai.useLevel[i], GUILayout.Width(mWidth*0.7f));
                ai.useLevel[i] = EditorTab.MinMaxCheck(ai.useLevel[i], 1, DataHolder.Skill(ai.useID[i]).level.Length);
            }
            else if(AttackSelection.ITEM.Equals(ai.attackSelection[i]))
            {
                ai.useID[i] = EditorGUILayout.Popup(ai.useID[i],
                        DataHolder.Items().GetNameList(true), GUILayout.Width(mWidth*0.7f));
            }
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Separator();
            EditorGUILayout.EndVertical();
        }
        EditorGUILayout.Separator();
        return ai;
    }