コード例 #1
0
        public static void BuildField(HeroActionParams actionParams)
        {
            HeroAction heroAction = actionParams.heroAction;

            //-----------------------------------------
            // create the action fields if they don't exist
            //-----------------------------------------
            ActionCommon.CreateActionFieldsOnHeroObject(heroAction, 4);

            //-----------------------------------------
            // create the fields for this action
            //-----------------------------------------
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            GetStringField.BuildFieldA("The name of the pool:", actionParams, heroAction.actionFields[0]);
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            GetIntegerField.BuildFieldA("The number of objects to add to the pool:", actionParams, heroAction.actionFields[1]);
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            string[] items  = { "Hero Object", "Prefab" };
            int      result = GetDropDownField.BuildField("Object type: ", actionParams, heroAction.actionFields[2], new GenericListField(items));

            // prefab
            if (result == 2)
            {
                GetPrefabValue.BuildField("Prefab used by the object pool:", actionParams, heroAction.actionFields[3]);
            }
            SimpleLayout.EndVertical();
        }
コード例 #2
0
        /// <summary>
        /// Get an animation to play. This requires the use of action fields 0-3.
        /// </summary>
        /// <param name="title">Title of the action field.</param>
        /// <param name="actionParams">Action parameters.</param>
        /// <param name="actionFieldA">Action field.</param>
        /// <param name="actionFieldB">Action field.</param>
        /// <param name="actionFieldC">Action field.</param>
        /// <param name="paramType">Animation controller parameter type.</param>
        /// <param name="targetHeroObject">The target hero object.</param>
        public static void GetAnimation(string title, HeroActionParams actionParams, HeroActionField actionFieldA, HeroActionField actionFieldB, HeroActionField actionFieldC, AnimatorControllerParameterType paramType, HeroObject targetHeroObject)
        {
            if (title != "")
            {
                SimpleLayout.Label(title);
            }

            SimpleLayout.BeginVertical(Box.StyleB);

            if (targetHeroObject == null)
            {
                SimpleLayout.Label("Select a hero object to see its animation parameters.");
                SimpleLayout.EndVertical();
                return;
            }

            if (targetHeroObject.states.states == null || targetHeroObject.states.states.Count == 0)
            {
                SimpleLayout.Label("This hero object has no states.");
                SimpleLayout.EndVertical();
                return;
            }

            SimpleLayout.Label("The state that contains the animation controller:");
            int stateID = GetDropDownBField.BuildField("", actionParams, actionFieldA, new HeroField.StateListField(), targetHeroObject.states.states) - 1;

            if (stateID >= 0)
            {
                string paramTypeName = paramType.ToString();

                SimpleLayout.Label(paramTypeName + " assigned to the animation controller:");
                RuntimeAnimatorController animatorController = GetAnimationParameterField.BuildFieldA("", actionParams, actionFieldB, targetHeroObject, stateID, paramType);

                if (animatorController == null)
                {
                    SimpleLayout.BeginVertical(Box.StyleA);
                    SimpleLayout.Label("This state has no animation controller.\nIf you are 100% certain a specific animation controller\nwill be available at runtime, drag the prefab \nthat contains the controller here:");
                    GameObject prefab = GetPrefabValue.BuildField("", actionParams, actionFieldC);
                    if (prefab != null)
                    {
                        Animator animator = prefab.GetComponent <Animator>();
                        if (animator != null)
                        {
                            animatorController = animator.runtimeAnimatorController;
                            if (animatorController != null)
                            {
                                GetAnimationParameterField.BuildFieldB("", actionParams, actionFieldB, animatorController, paramType);
                            }
                        }
                    }

                    SimpleLayout.EndVertical();
                }
            }

            SimpleLayout.EndVertical();
        }
コード例 #3
0
        /// <summary>
        /// Get an animation to play. This requires the use of action fields 0-3.
        /// </summary>
        /// <param name="title">Title of the action field.</param>
        /// <param name="actionParams">Action parameters.</param>
        /// <param name="actionFieldA">Action field.</param>
        /// <param name="actionFieldB">Action field.</param>
        /// <param name="actionFieldC">Action field.</param>
        /// <param name="paramType">Animation controller parameter type.</param>
        /// <param name="targetHeroObject">The target hero object.</param>
        public static void GetAnimation_Legacy(string title, HeroActionParams actionParams, HeroActionField actionFieldA, HeroActionField actionFieldB, HeroActionField actionFieldC, HeroObject targetHeroObject)
        {
            if (title != "")
            {
                SimpleLayout.Label(title);
            }

            SimpleLayout.BeginVertical(Box.StyleB);

            if (targetHeroObject == null)
            {
                SimpleLayout.Label("Select a hero object to see its animations.");
                SimpleLayout.EndVertical();
                return;
            }

            if (targetHeroObject.states.states == null || targetHeroObject.states.states.Count == 0)
            {
                SimpleLayout.Label("This hero object has no states.");
                SimpleLayout.EndVertical();
                return;
            }

            SimpleLayout.Label("The state that contains the animations:");
            int stateID = GetDropDownBField.BuildField("", actionParams, actionFieldA, new HeroField.StateListField(), targetHeroObject.states.states) - 1;

            if (stateID >= 0)
            {
                SimpleLayout.Label("The animation to play:");
                Animation animation = GetAnimationParameterField.BuildFieldA_Legacy("", actionParams, actionFieldB, targetHeroObject, stateID);

                if (animation == null)
                {
                    SimpleLayout.BeginVertical(Box.StyleA);
                    SimpleLayout.Label("This state has no animation component.\nIf you are 100% certain a specific animation component\nwill be available at runtime, drag the prefab \nthat contains the component here:");
                    GameObject prefab = GetPrefabValue.BuildField("", actionParams, actionFieldC);
                    if (prefab != null)
                    {
                        animation = prefab.GetComponent <Animation>();
                        if (animation != null)
                        {
                            GetAnimationParameterField.BuildFieldB_Legacy("", actionParams, actionFieldB, animation);
                        }
                    }

                    SimpleLayout.EndVertical();
                }
            }

            SimpleLayout.EndVertical();
        }
コード例 #4
0
        public static void BuildField(HeroActionParams actionParams)
        {
            HeroAction heroAction = actionParams.heroAction;

            //-----------------------------------------
            // create the action fields if they don't exist
            //-----------------------------------------
            ActionCommon.CreateActionFieldsOnHeroObject(heroAction, 7);

            //-----------------------------------------
            // create the fields for this action
            //-----------------------------------------

            // get the prefab
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            GetPrefabValue.BuildField("Prefab:", actionParams, heroAction.actionFields[0]);
            SimpleLayout.EndVertical();

            // get the menu
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            GetGameObjectField.BuildFieldA("Parent Game Object:", actionParams, heroAction.actionFields[1]);
            SimpleLayout.EndVertical();

            // how many instances do we need?
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            GetIntegerField.BuildFieldA("How many duplicates do we need?", actionParams, heroAction.actionFields[2]);
            SimpleLayout.EndVertical();

            //// should we allow these instances to be saved?
            //SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleA1);
            //GetBoolValue.BuildField("Allow these items to be saved?", actionParams, heroAction.actionField[6], true);
            //SimpleLayout.EndVertical();

            // increment item id?
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            GetBoolValue.BuildField("Increment Item ID on Hero Kit Listener?", actionParams, heroAction.actionFields[3], true);
            SimpleLayout.EndVertical();

            // where to send notifications
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            HeroObject targetObject = GetHeroObjectField.BuildFieldA("Send notifications to this hero object:", actionParams, heroAction.actionFields[4]);

            if (targetObject != null)
            {
                SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
                GetEventField.BuildField("", actionParams, heroAction.actionFields[5], targetObject);
                SimpleLayout.EndVertical();
            }
            SimpleLayout.EndVertical();
        }
コード例 #5
0
        public static void BuildField(HeroActionParams actionParams)
        {
            HeroAction heroAction = actionParams.heroAction;

            //-----------------------------------------
            // create the action fields if they don't exist
            //-----------------------------------------
            ActionCommon.CreateActionFieldsOnHeroObject(heroAction, 2);

            //-----------------------------------------
            // create the fields for this action
            //-----------------------------------------
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            GetPrefabValue.BuildField("Template to use:", actionParams, heroAction.actionFields[0]);
            SimpleLayout.EndVertical();
        }
コード例 #6
0
        public static void BuildField(HeroActionParams actionParams)
        {
            HeroAction heroAction = actionParams.heroAction;

            //-----------------------------------------
            // create the action fields if they don't exist
            //-----------------------------------------
            ActionCommon.CreateActionFieldsOnHeroObject(heroAction, 8);

            //-----------------------------------------
            // create the fields for this action
            //-----------------------------------------
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            GetHeroObjectField.BuildFieldE("Change a different object?", actionParams, heroAction.actionFields[0], heroAction.actionFields[1]);
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            bool changePrefab = GetBoolValue.BuildField("Use a new prefab?", actionParams, heroAction.actionFields[2], true);

            if (changePrefab)
            {
                GetPrefabValue.BuildField("", actionParams, heroAction.actionFields[3]);
            }
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            bool changeRigidbody = GetBoolValue.BuildField("Use a new rigidbody?", actionParams, heroAction.actionFields[4], true);

            if (changeRigidbody)
            {
                GetRigidbodyValue.BuildField("", actionParams, heroAction.actionFields[5]);
            }
            SimpleLayout.EndVertical();

            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            bool changeHidden = GetBoolValue.BuildField("Show or hide visuals?", actionParams, heroAction.actionFields[6], true);

            if (changeHidden)
            {
                string[] choices = { "Show Visuals", "Hide Visuals" };
                GetDropDownField.BuildField("", actionParams, heroAction.actionFields[7], new GenericListField(choices), true);
            }
            SimpleLayout.EndVertical();
        }
コード例 #7
0
        public static void BuildField(HeroActionParams actionParams)
        {
            HeroAction heroAction = actionParams.heroAction;

            //-----------------------------------------
            // create the action fields if they don't exist
            //-----------------------------------------
            ActionCommon.CreateActionFieldsOnHeroObject(heroAction, 20);

            //-----------------------------------------
            // create the fields for this action
            //-----------------------------------------

            // spawn object from a pool?
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            bool usePool = GetBoolValue.BuildField("Spawn from pool? (Yes=True, No=False)", actionParams, heroAction.actionFields[1], true);

            if (usePool)
            {
                GetStringField.BuildFieldA("", actionParams, heroAction.actionFields[2]);
            }
            SimpleLayout.EndVertical();

            // spawn from hero object (1) or prefab (2)
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            string[] items  = { "Spawn object from Hero Object", "Spawn object from Prefab" };
            int      result = GetDropDownField.BuildField("Spawn the object from:", actionParams, heroAction.actionFields[0], new GenericListField(items));

            if (result == 1)
            {
                GetHeroObjectField.BuildFieldC("Hero Object:", actionParams, heroAction.actionFields[3]);
                GetBoolValue.BuildField("Debug this Hero Object?", actionParams, heroAction.actionFields[4], true);
                GetBoolValue.BuildField("Don't save this Hero Object?", actionParams, heroAction.actionFields[5], true);
            }
            else if (result == 2)
            {
                if (!usePool)
                {
                    GetPrefabValue.BuildField("Prefab:", actionParams, heroAction.actionFields[5]);
                }
            }
            SimpleLayout.EndVertical();

            // change position?
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            bool changePos = GetBoolValue.BuildField("Change position?", actionParams, heroAction.actionFields[6], true);

            if (changePos)
            {
                GetCoordinatesField.BuildField("", actionParams,
                                               heroAction.actionFields[7], heroAction.actionFields[8],
                                               heroAction.actionFields[9], heroAction.actionFields[10],
                                               heroAction.actionFields[11], heroAction.actionFields[12]);
            }
            SimpleLayout.EndVertical();

            // change rotation?
            SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB);
            bool changeRotation = GetBoolValue.BuildField("Change rotation?", actionParams, heroAction.actionFields[13], true);

            if (changeRotation)
            {
                GetCoordinatesField.BuildField("", actionParams,
                                               heroAction.actionFields[14], heroAction.actionFields[15],
                                               heroAction.actionFields[16], heroAction.actionFields[17],
                                               heroAction.actionFields[18], heroAction.actionFields[19]);
            }
            SimpleLayout.EndVertical();
        }