Behaviour 是一种可以控制 激活/失效 的 Component。

参见:MonoBehaviour 和 Component.

상속: Component
    static int _CreateUnityEngine_Behaviour(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("UnityEngine.Behaviour.ctor");
#endif
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                UnityEngine.Behaviour obj = new UnityEngine.Behaviour();
                ToLua.Push(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.Behaviour.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #2
0
    static void Behaviour_isActiveAndEnabled(JSVCall vc)
    {
        UnityEngine.Behaviour _this = (UnityEngine.Behaviour)vc.csObj;
        var result = _this.isActiveAndEnabled;

        JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(result));
    }
예제 #3
0
 static public int constructor(IntPtr l)
 {
     UnityEngine.Behaviour o;
     o = new UnityEngine.Behaviour();
     pushObject(l, o);
     return(1);
 }
예제 #4
0
    static int GetActive(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.GameObject)))
            {
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 1);
                bool o = NGUITools.GetActive(arg0);
                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.Behaviour)))
            {
                UnityEngine.Behaviour arg0 = (UnityEngine.Behaviour)ToLua.ToObject(L, 1);
                bool o = NGUITools.GetActive(arg0);
                LuaDLL.lua_pushboolean(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: NGUITools.GetActive"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
예제 #5
0
 void SwitchGroup(Behaviour[] behaviours, bool bGroupOn)
 {
     for (int i = 0; i < behaviours.Length; ++i)
     {
         behaviours[i].enabled = bGroupOn;
     }
 }
예제 #6
0
        private void Shuffle()
        {
            Behaviour lastRunningNode = null;

            if (CurrentStatus == BehaviourStatus.Running)
            {
                lastRunningNode = _children[_lastIndex];
            }

            for (int i = base.ChildrenCount; i >= 0; i--)
            {
                int       toSwitch = Random.Range(0, i);
                Behaviour tmp      = _children[i - 1];
                _children[i - 1]    = _children[toSwitch];
                _children[toSwitch] = tmp;
            }

            if (lastRunningNode == null)
            {
                return;
            }

            for (int i = 0; i < base.ChildrenCount; i++)
            {
                if (_children[i] == lastRunningNode)
                {
                    Behaviour tmp = _children[i];
                    _children[i] = _children[0];
                    _children[0] = tmp;

                    break;
                }
            }
        }
 static public int get_isActiveAndEnabled(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.Behaviour self = (UnityEngine.Behaviour)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.isActiveAndEnabled);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
예제 #8
0
 public static int  obj_hash(long L)
 {
     UnityEngine.Behaviour obj = FCGetObj.GetObj <UnityEngine.Behaviour>(L);
     if (obj != null)
     {
         return(obj.GetHashCode());
     }
     return(0);
 }
예제 #9
0
    static public int set_enabled(IntPtr l)
    {
        UnityEngine.Behaviour o = (UnityEngine.Behaviour)checkSelf(l);
        bool v;

        checkType(l, 2, out v);
        o.enabled = v;
        return(0);
    }
 public override void Reset()
 {
     gameObject = null;
     script = null;
     component = null;
     enable = true;
     allScripts = false;
     inclChildren = false;
 }
 static public int get_isActiveAndEnabled(IntPtr l)
 {
     try {
         UnityEngine.Behaviour self = (UnityEngine.Behaviour)checkSelf(l);
         pushValue(l, self.isActiveAndEnabled);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #12
0
 static public int get_enabled(IntPtr l)
 {
     try {
         UnityEngine.Behaviour self = (UnityEngine.Behaviour)checkSelf(l);
         pushValue(l, self.enabled);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.Behaviour o;
         o = new UnityEngine.Behaviour();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.Behaviour o;
			o=new UnityEngine.Behaviour();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
 static public int set_enabled(IntPtr l)
 {
     try {
         UnityEngine.Behaviour self = (UnityEngine.Behaviour)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.enabled = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #16
0
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.Behaviour o;
         o=new UnityEngine.Behaviour();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
예제 #17
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.Behaviour o;
         o = new UnityEngine.Behaviour();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
예제 #18
0
 static public int constructor(IntPtr l)
 {
     LuaDLL.lua_remove(l, 1);
     UnityEngine.Behaviour o;
     if (matchType(l, 1))
     {
         o = new UnityEngine.Behaviour();
         pushObject(l, o);
         return(1);
     }
     LuaDLL.luaL_error(l, "New object failed.");
     return(0);
 }
예제 #19
0
 public static bool  obj_equal(long L, long R)
 {
     UnityEngine.Behaviour left  = FCGetObj.GetObj <UnityEngine.Behaviour>(L);
     UnityEngine.Behaviour right = FCGetObj.GetObj <UnityEngine.Behaviour>(R);
     if (left != null)
     {
         return(left.Equals(right));
     }
     if (right != null)
     {
         return(right.Equals(left));
     }
     return(true);
 }
예제 #20
0
        public int GetCurrentBehaviourIndex(Behaviour []methodList, Behaviour currentBehaviour)
        {
            if(currentBehaviour != null)
            {
                int objectCount = methodList.Length;
                for(int i = 0; i < objectCount; ++i)
                {
                    if(string.Equals(methodList[i].ToString(), currentBehaviour.ToString()) == true)
                        return i;
                }
            }

            return 0;
        }
예제 #21
0
 public static int set_enabled_wrap(long L)
 {
     try
     {
         long nThisPtr             = FCLibHelper.fc_get_inport_obj_ptr(L);
         UnityEngine.Behaviour ret = get_obj(nThisPtr);
         bool arg0 = FCLibHelper.fc_get_bool(L, 0);
         ret.enabled = arg0;
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     return(0);
 }
예제 #22
0
 public static int get_enabled_wrap(long L)
 {
     try
     {
         long nThisPtr             = FCLibHelper.fc_get_inport_obj_ptr(L);
         UnityEngine.Behaviour ret = get_obj(nThisPtr);
         long ret_ptr = FCLibHelper.fc_get_return_ptr(L);
         FCLibHelper.fc_set_value_bool(ret_ptr, ret.enabled);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     return(0);
 }
예제 #23
0
// fields

// properties
    static void Behaviour_enabled(JSVCall vc)
    {
        if (vc.bGet)
        {
            UnityEngine.Behaviour _this = (UnityEngine.Behaviour)vc.csObj;
            var result = _this.enabled;
            JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(result));
        }
        else
        {
            System.Boolean        arg0  = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg);
            UnityEngine.Behaviour _this = (UnityEngine.Behaviour)vc.csObj;
            _this.enabled = arg0;
        }
    }
    static int set_enabled(IntPtr L)
    {
        UnityEngine.Behaviour obj = (UnityEngine.Behaviour)ToLua.ToObject(L, 1);
        bool arg0 = LuaDLL.luaL_checkboolean(L, 2);

        try
        {
            obj.enabled = arg0;
        }
        catch (Exception e)
        {
            return(LuaDLL.luaL_error(L, obj == null ? "attempt to index enabled on a nil value" : e.Message));
        }

        return(0);
    }
    static int get_isActiveAndEnabled(IntPtr L)
    {
        UnityEngine.Behaviour obj = (UnityEngine.Behaviour)ToLua.ToObject(L, 1);
        bool ret;

        try
        {
            ret = obj.isActiveAndEnabled;
        }
        catch (Exception e)
        {
            return(LuaDLL.luaL_error(L, obj == null ? "attempt to index isActiveAndEnabled on a nil value" : e.Message));
        }

        LuaDLL.lua_pushboolean(L, ret);
        return(1);
    }
    static int _CreateUnityEngine_Behaviour(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            UnityEngine.Behaviour obj = new UnityEngine.Behaviour();
            ToLua.Push(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: UnityEngine.Behaviour.New");
        }

        return(0);
    }
    static int set_enabled(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.Behaviour obj = (UnityEngine.Behaviour)o;
            bool arg0 = LuaDLL.luaL_checkboolean(L, 2);
            obj.enabled = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index enabled on a nil value"));
        }
    }
예제 #28
0
    static int get_isActiveAndEnabled(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.Behaviour obj = (UnityEngine.Behaviour)o;
            bool ret = obj.isActiveAndEnabled;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index isActiveAndEnabled on a nil value" : e.Message));
        }
    }
예제 #29
0
 static int QPYX__CreateUnityEngine_Behaviour_YXQP(IntPtr L_YXQP)
 {
     try
     {
         int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP);
         if (QPYX_count_YXQP == 0)
         {
             UnityEngine.Behaviour QPYX_obj_YXQP = new UnityEngine.Behaviour();
             ToLua.Push(L_YXQP, QPYX_obj_YXQP);
             return(1);
         }
         else
         {
             return(LuaDLL.luaL_throw(L_YXQP, "invalid arguments to ctor method: UnityEngine.Behaviour.New"));
         }
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
    static int get_isActiveAndEnabled(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("UnityEngine.Behaviour.isActiveAndEnabled");
#endif
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.Behaviour obj = (UnityEngine.Behaviour)o;
            bool ret = obj.isActiveAndEnabled;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index isActiveAndEnabled on a nil value"));
        }
    }
    static int set_enabled(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("UnityEngine.Behaviour.enabled");
#endif
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.Behaviour obj = (UnityEngine.Behaviour)o;
            bool arg0 = LuaDLL.luaL_checkboolean(L, 2);
            obj.enabled = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index enabled on a nil value"));
        }
    }
예제 #32
0
        void DoEnableBehaviour(GameObject go)
        {
            if (go == null) return;

            if (component != null)
            {
                componentTarget = component as Behaviour;
            }
            else
            {
                componentTarget = go.GetComponent(behaviour.Value) as Behaviour;
            }

            if (componentTarget == null)
            {
                LogWarning(" " + go.name + " missing behaviour: " + behaviour.Value);
                return;
            }

            componentTarget.enabled = enable.Value;
        }
예제 #33
0
    static int _CreateUnityEngine_Behaviour(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                UnityEngine.Behaviour obj = new UnityEngine.Behaviour();
                ToLua.Push(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.Behaviour.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
	static int _CreateUnityEngine_Behaviour(IntPtr L)
	{
		try
		{
			int count = LuaDLL.lua_gettop(L);

			if (count == 0)
			{
				UnityEngine.Behaviour obj = new UnityEngine.Behaviour();
				ToLua.Push(L, obj);
				return 1;
			}
			else
			{
				return LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.Behaviour.New");
			}
		}
		catch(Exception e)
		{
			return LuaDLL.toluaL_exception(L, e);
		}
	}
 public DirectorBehaviourControlEventArgs(UnityEngine.Behaviour behaviour, DirectorBehaviourControl control)
 {
     this.Behaviour = behaviour;
     this.Control   = control;
 }
예제 #36
0
 /// <summary>
 /// MonoBehaviour是否激活
 /// </summary>
 /// <param name="mb"></param>
 /// <returns></returns>
 public static bool GetActive(Behaviour mb)
 {
     return mb && mb.enabled && mb.gameObject.activeInHierarchy;
 }
예제 #37
0
파일: Pausable.cs 프로젝트: rennone/Katana
 //! 子要素から取得可能条件
 private bool Findable(Behaviour b)
 {
     // Pausableはdisableしない && すでにdisableのものは取得しない(Resumeでenableになってしまうので)
     return b != this && b.enabled;
 }
예제 #38
0
 TweenParms KeepEnabled(Behaviour[] p_targets, bool p_enabled)
 {
     manageBehaviours = true;
     if (p_enabled) managedBehavioursOn = p_targets;
     else managedBehavioursOff = p_targets;
     return this;
 }
예제 #39
0
 /// <summary>
 /// Keeps the given components disabled while the tween is playing
 /// </summary>
 public TweenParms KeepDisabled(Behaviour[] p_targets)
 {
     return KeepEnabled(p_targets, false);
 }
예제 #40
0
 /// <summary>
 /// Keeps the given component disabled while the tween is playing
 /// </summary>
 public TweenParms KeepDisabled(Behaviour p_target)
 {
     if (p_target == null) {
         manageBehaviours = false;
         return this;
     }
     return KeepEnabled(new[] { p_target }, false);
 }
예제 #41
0
 /// <summary>
 /// Keeps the given components enabled while the tween is playing
 /// </summary>
 public TweenParms KeepEnabled(Behaviour[] p_targets)
 {
     return KeepEnabled(p_targets, true);
 }
        void DoEnableScript(GameObject go)
        {
            if (go == null)
            {
                return;
            }

            if (component != null)
            {
                componentTarget = component as Behaviour;
                componentTarget.enabled = enable.Value;
            }
            else
            {
                (go.gameObject.GetComponent(script.Value) as Behaviour).enabled = enable.Value;
            }

            if (inclChildren.Value == true)
            {

                for(int i=0; i< go.transform.childCount; i++)
                {
                    var child = go.transform.GetChild(i).gameObject;
                    if(child != null){

                    if (!string.IsNullOrEmpty(script.Value))
                    {
                    (child.gameObject.GetComponent(script.Value) as Behaviour).enabled = enable.Value;
                    }
                    else if (string.IsNullOrEmpty(script.Value)){

                            Debug.LogWarning("!!!!!! Dropdown does not work with incl child. Please input script name !!!!!!");
                            return;
                            }

                        }
                }
                }
        }
예제 #43
0
        private void StartAction(Behaviour actionToStart)
        {
            FacePlayer();
            ActiveBehaviour = actionToStart;

            _rigidBody2D.velocity = new Vector2(0.0f, _rigidBody2D.velocity.y);
            _timedActionTimer = 0.0f;

            switch (actionToStart)
            {
                case Behaviour.Resting: StartResting(); break;
                case Behaviour.Walking: StartWalking(); break;
                case Behaviour.Jumping: SetAnimationFlags("Jumping"); break;
                case Behaviour.Stamping: SetAnimationFlags("Stamping"); break;
                case Behaviour.Firing: SetAnimationFlags("Firing"); break;
            }
        }
예제 #44
0
 public Component(UnityEngine.Component source)
 {
     id = IdManager.Instance.CreateComponentId();
     UnityEngine.Behaviour behaviour = source as UnityEngine.Behaviour;
     enabled = behaviour ? behaviour.enabled : true;
 }
예제 #45
0
        // ===================================================================================
        // BEHAVIOURS/GAMEOBJECT MANAGEMENT METHODS ------------------------------------------

        /// <summary>
        /// Keeps the given component enabled while the tween is playing
        /// </summary>
        public SequenceParms KeepEnabled(Behaviour p_target)
        {
            if (p_target == null) {
                manageBehaviours = false;
                return this;
            }
            return KeepEnabled(new[] { p_target }, true);
        }
예제 #46
0
        public List<string> LoadMethodsFromGameObject(Behaviour []ListOfMethods)
        {
            List<string> listOfMethods = new List<string>();
            int objectCount = ListOfMethods.Length;
            char[] Seperators = new char[2];
            Seperators[0] = '(';
            Seperators[1] = ')';
            for(int i = 0; i < objectCount; ++i)
            {
                string[] listOfTempNameStrings = ListOfMethods[i].ToString().Split(Seperators);
                listOfMethods.Add(listOfTempNameStrings[1]);
            }

            return listOfMethods;
        }
예제 #47
0
 /// <summary>
 /// Keeps the given components disabled while the tween is playing
 /// </summary>
 public SequenceParms KeepDisabled(Behaviour[] p_targets)
 {
     return KeepEnabled(p_targets, false);
 }
예제 #48
0
 public sBehaviour(Behaviour b)
 {
     enabled = b.enabled;
 }
예제 #49
0
 public SidebarControlEventArgs(UnityEngine.Behaviour behaviour, DirectorEditor.SidebarControl control)
 {
     this.Behaviour      = behaviour;
     this.SidebarControl = control;
 }