Exemple #1
0
        /// <summary>
        /// This builds the action fields in the editor.
        /// </summary>
        /// <param name="heroObject">The hero object.</param>
        public static void BuildActionFields(HeroObject heroObject)
        {
            // referesh states
            if (heroObject.states.states != null && heroObject.states.states.Count != 0)
            {
                for (int stateID = 0; stateID < heroObject.states.states.Count; stateID++)
                {
                    StateBlock.Block(heroObject, stateID);

                    if (heroObject.states.states[stateID].heroEvent == null)
                    {
                        return;
                    }
                    for (int eventID = 0; eventID < heroObject.states.states[stateID].heroEvent.Count; eventID++)
                    {
                        EventBlock.Block(heroObject, stateID, eventID);

                        if (heroObject.states.states[stateID].heroEvent[eventID].actions == null)
                        {
                            return;
                        }
                        for (int actionID = 0; actionID < heroObject.states.states[stateID].heroEvent[eventID].actions.Count; actionID++)
                        {
                            ActionBlock.Block(heroObject, stateID, eventID, actionID);
                        }
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Draw the canvas window inside the hero kit editor (hero object).
        /// </summary>
        /// <param name="id">ID assigned to the GUI Window</param>
        private void DrawCanvasWindowHeroObject(int id)
        {
            scrollPosCanvas = EditorGUILayout.BeginScrollView(scrollPosCanvas, GUILayout.Width(windowCanvas.width), GUILayout.Height((int)(Instance.position.height - titleHeight)));

            SimpleLayout.BeginVertical(Box.StyleCanvas, (int)(Instance.position.height - titleHeight));

            // draw state
            if (HeroObjectMenuBlock.typeID == 1)
            {
                if (HeroObjectMenuBlock.stateID == -1)
                {
                    // show state tutorial page
                }
                else
                {
                    StateBlock.Block(heroObject, HeroObjectMenuBlock.stateID);
                }
            }
            // draw event
            if (HeroObjectMenuBlock.typeID == 2)
            {
                EventBlock.Block(heroObject, HeroObjectMenuBlock.stateID, HeroObjectMenuBlock.eventID);
            }
            // draw action
            else if (HeroObjectMenuBlock.typeID == 3)
            {
                ActionBlock.Block(heroObject, HeroObjectMenuBlock.stateID, HeroObjectMenuBlock.eventID, HeroObjectMenuBlock.actionID);
            }
            // draw properties
            else if (HeroObjectMenuBlock.typeID == 4)
            {
                if (HeroObjectMenuBlock.propertyID == -1)
                {
                    // show properties tutorial page
                }
                else
                {
                    PropertiesBlock.Block(heroObject, HeroObjectMenuBlock.propertyID);
                }
            }
            // draw variables
            else if (HeroObjectMenuBlock.typeID == 5)
            {
                switch (HeroObjectMenuBlock.variableID)
                {
                case -1:
                    // show variable tutorial page
                    break;

                case 0:
                    IntListBlock.Block(heroObject);
                    break;

                case 1:
                    BoolListBlock.Block(heroObject);
                    break;

                case 2:
                    StringListBlock.Block(heroObject);
                    break;

                case 3:
                    GameObjectListBlock.Block(heroObject);
                    break;

                case 4:
                    HeroObjectListBlock.Block(heroObject);
                    break;

                case 5:
                    FloatListBlock.Block(heroObject);
                    break;

                case 6:
                    UnityObjectListBlock.Block(heroObject);
                    break;
                }
            }
            // draw globals
            else if (HeroObjectMenuBlock.typeID == 6)
            {
                switch (HeroObjectMenuBlock.globalID)
                {
                case -1:
                    // show variable tutorial page
                    break;

                case 0:
                    IntListBlock.Block(heroObject, true);
                    break;

                case 1:
                    BoolListBlock.Block(heroObject, true);
                    break;

                case 2:
                    StringListBlock.Block(heroObject, true);
                    break;

                case 3:
                    GameObjectListBlock.Block(heroObject, true);
                    break;

                case 4:
                    HeroObjectListBlock.Block(heroObject, true);
                    break;

                case 5:
                    FloatListBlock.Block(heroObject, true);
                    break;

                case 6:
                    UnityObjectListBlock.Block(heroObject, true);
                    break;
                }
            }
            // draw settings
            else if (HeroObjectMenuBlock.typeID == 7)
            {
                SettingsBlock.Block();
            }

            SimpleLayout.EndVertical();
            EditorGUILayout.EndScrollView();
        }