playMaker

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Zyxil

Pages: [1]
1
So I have a custom action that is used in a few places.  I added a new FsmInt public field to the action and when I switch back to Unity everything compiles like normal, but the new field does not appear on the action.  

Why would a new field not show up on the action?

2
Share New Actions / DestroyChildren
« on: August 28, 2012, 06:36:46 PM »
Code: [Select]
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
    [ActionCategory(ActionCategory.GameObject)]
    [Tooltip("Destroy all children on the Game Object.")]
    public class DestroyChildren : FsmStateAction
    {
        [RequiredField]
        public FsmOwnerDefault gameObject;

        public override void Reset()
        {
            gameObject = null;
        }

        public override void OnEnter()
        {
            DoDestroyChildren(Fsm.GetOwnerDefaultTarget(gameObject));

            Finish();
        }

        static void DoDestroyChildren(GameObject go)
        {
            if (go != null)
            {
                for (int i = 0; i < go.transform.GetChildCount(); i++)
                    GameObject.Destroy(go.transform.GetChild(0).gameObject);
            }
        }
    }
}

3
Community Wiki Suggestions / Editing Wiki?
« on: August 27, 2012, 07:56:41 PM »
I don't see a way to log in to edit the wiki.  

I was going to add this simple action:

Code: [Select]
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
    [ActionCategory(ActionCategory.GameObject)]
    [Tooltip("Destroy all children on the Game Object.")]
    public class DestroyChildren : FsmStateAction
    {
        [RequiredField]
        public FsmOwnerDefault gameObject;

        public override void Reset()
        {
            gameObject = null;
        }

        public override void OnEnter()
        {
            DoDestroyChildren(Fsm.GetOwnerDefaultTarget(gameObject));

            Finish();
        }

        static void DoDestroyChildren(GameObject go)
        {
            if (go != null)
            {
                for (int i = 0; i < go.transform.GetChildCount(); i++)
                    GameObject.Destroy(go.transform.GetChild(0).gameObject);
            }
        }
    }
}

4
Share New Actions / ObjectIsNull
« on: May 09, 2012, 07:28:33 PM »
Not rocket science, just a copy of GameObjectIsNull with the GO switched to Object.

Code: [Select]
namespace HutongGames.PlayMaker.Actions
{
    [ActionCategory(ActionCategory.Logic)]
    [Tooltip("Tests if an Object Variable has a null value.")]
    public class ObjectIsNull : FsmStateAction
    {
        [RequiredField]
        [UIHint(UIHint.Variable)]
        public FsmObject theObject;
        public FsmEvent isNull;
        public FsmEvent isNotNull;
        [UIHint(UIHint.Variable)]
        public FsmBool storeResult;
        public bool everyFrame;

        public override void Reset()
        {
            theObject = null;
            isNull = null;
            isNotNull = null;
            storeResult = null;
            everyFrame = false;
        }

        public override void OnEnter()
        {
            DoIsObjectNull();

            if (!everyFrame)
                Finish();
        }

        public override void OnUpdate()
        {
            DoIsObjectNull();
        }

        void DoIsObjectNull()
        {
            bool oIsNull = theObject == null;

            if (storeResult != null)
                storeResult.Value = oIsNull;

            Fsm.Event(oIsNull ? isNull : isNotNull);
        }
    }
}

Pages: [1]