Exemple #1
0
 //Access GearEquipper to apply the skin changes to the character
 void ApplySkinChanges()
 {
     AccGE.Melee          = CurrentChosenGears[Gears.Melee];
     AccGE.Shield         = CurrentChosenGears[Gears.Shield];
     AccGE.Bow            = CurrentChosenGears[Gears.Bow];
     AccGE.Quiver         = CurrentChosenGears[Gears.Quiver];
     AccGE.Staff          = CurrentChosenGears[Gears.Staff];
     AccGE.DuelistOffhand = CurrentChosenGears[Gears.DuelistOffhand];
     AccGE.Armor          = CurrentChosenGears[Gears.Armor];
     AccGE.Helmet         = CurrentChosenGears[Gears.Helmet];
     AccGE.Shoulder       = CurrentChosenGears[Gears.Shoulder];
     AccGE.Arm            = CurrentChosenGears[Gears.Arm];
     AccGE.Feet           = CurrentChosenGears[Gears.Feet];
     AccGE.Hair           = CurrentChosenGears[Gears.Hair];
     AccGE.Face           = CurrentChosenGears[Gears.Face];
     AccGE.ApplySkinChanges();
 }
Exemple #2
0
    public override void OnInspectorGUI()
    {
        //Override the base OnInspectorGUI showing the range of possible choices

        //Records the object for Undo purposes
        Undo.RecordObject(GE, "Character Changes");

        EditorGUI.BeginChangeCheck();

        GE.Job = (Jobs)EditorGUILayout.EnumPopup("Job", GE.Job);

        if (GE.Job == Jobs.Warrior)
        {
            GE.Melee  = EditorGUILayout.IntSlider("Melee", GE.Melee, 0, 45);
            GE.Shield = EditorGUILayout.IntSlider("Shield", GE.Shield, 0, 26); //max +1
        }
        else if (GE.Job == Jobs.Archer)
        {
            GE.Bow    = EditorGUILayout.IntSlider("Bow", GE.Bow, 0, 25);
            GE.Quiver = EditorGUILayout.IntSlider("Quiver", GE.Quiver, 0, 25);
        }
        else if (GE.Job == Jobs.Elementalist)
        {
            GE.Melee          = EditorGUILayout.IntSlider("Melee", GE.Melee, 0, 45);
            GE.DuelistOffhand = EditorGUILayout.IntSlider("Offhand", GE.DuelistOffhand, 0, 45);
        }
        else if (GE.Job == Jobs.Duelist)
        {
            GE.Staff = EditorGUILayout.IntSlider("Staff", GE.Staff, 0, 25);
        }
        GE.Armor    = EditorGUILayout.IntSlider("Armor", GE.Armor, 0, 25);
        GE.Helmet   = EditorGUILayout.IntSlider("Helmet", GE.Helmet, 0, 27);
        GE.Shoulder = EditorGUILayout.IntSlider("Shoulder", GE.Shoulder, 0, 25);
        GE.Arm      = EditorGUILayout.IntSlider("Arm", GE.Arm, 0, 25);
        GE.Feet     = EditorGUILayout.IntSlider("Feet", GE.Feet, 0, 25);
        GE.Hair     = EditorGUILayout.IntSlider("Hair", GE.Hair, 0, 18);
        GE.Face     = EditorGUILayout.IntSlider("Face", GE.Face, 0, 18);


        GUILayout.Space(15);

        //Toggling IsAutoUpdate refreshes the skins automaticaily but takes more resources

        GE.IsAutoUpdate = EditorGUILayout.Toggle("Auto Apply Gear", GE.IsAutoUpdate);

        if (GE.IsAutoUpdate == false)
        {
            GUILayout.BeginHorizontal();

            GUIStyle myButtonStyle = new GUIStyle(GUI.skin.button);
            myButtonStyle.fontSize    = 16;
            myButtonStyle.fontStyle   = FontStyle.Bold;
            myButtonStyle.fixedHeight = 30;
            myButtonStyle.fixedWidth  = Screen.width;
            myButtonStyle.alignment   = TextAnchor.MiddleCenter;


            GUI.backgroundColor = new Color(0.9f, 1, 0.9f);
            if (GUILayout.Button("Apply Gear on Character", myButtonStyle))
            {
                GE.ApplySkinChanges();
            }
            GUILayout.EndHorizontal();
        }
        else
        {
            if (GUI.changed && GE != null)
            {
                GE.ApplySkinChanges();
            }
        }



        if (GUI.changed && GE != null)
        {
            EditorUtility.SetDirty(GE);
        }


        if (EditorGUI.EndChangeCheck())
        {
            Undo.FlushUndoRecordObjects();
        }
    }
Exemple #3
0
 public void OnEnable()
 {
     GE = (GearEquipper)target;
     GE.ApplySkinChanges();
 }