public void Initialize(JoystickLogic joystick) { var model = _modelContainer.GetChild(0); _animationLogic = model.GetComponent <CharacterAnimationLogic>(); // subscribe to joystick var movementData = new CharacterMovementData { Joystick = joystick, MovementMaxSpeed = _config.MovementMaxSpeed, OnCanMoveCheck = CheckCanMove, JoystickData = new JoystickEventData(), CharacterRigidbody = GetComponent <Rigidbody>(), AnimationLogic = _animationLogic }; _movementLogic.Initialize(this, movementData); var pod = _podContainer.GetChild(0); _podController = pod.GetComponent <PodController>(); var podData = new PodControllerData { Owner = transform }; _podController.Initialize(podData); var reachData = new CharacterReachData { OnMeeleTrigger = new CollisionTriggerData { TriggerEnterAction = OnMeleeRangeEnter, TriggerExitAction = OnMeleeRangeExit }, OnDodgeTrigger = new CollisionTriggerData { }, OnDistanceTrigger = new CollisionTriggerData { TriggerEnterAction = OnDistanceRangeEnter, TriggerExitAction = OnDistanceRangeExit } }; _reachLogic.Initialize(reachData); var attackData = new CharacterAttackData { AnimationLogic = _animationLogic }; _attackLogic.Initialize(attackData); }
static int ResetEvent(IntPtr L) { try { ToLua.CheckArgsCount(L, 0); JoystickLogic.ResetEvent(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
protected override void registLogics() { base.registLogics(); _joyLogicLeft = new JoystickLogic(); _joyLogicLeft.id = 1; addLogic(_joyLogicLeft); _joyLogicRight = new JoystickLogic(); _joyLogicRight.id = 2; _joyLogicRight.setCanKeyboardOperate(false); addLogic(_joyLogicRight); }
static int GetJoystickDirection(IntPtr L) { try { ToLua.CheckArgsCount(L, 0); UnityEngine.Vector2 o = JoystickLogic.GetJoystickDirection(); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int OnDestroy(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); JoystickLogic obj = (JoystickLogic)ToLua.CheckObject(L, 1, typeof(JoystickLogic)); obj.OnDestroy(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int IsJoystick(IntPtr L) { try { ToLua.CheckArgsCount(L, 0); bool o = JoystickLogic.IsJoystick(); LuaDLL.lua_pushboolean(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int OnDragMove(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); JoystickLogic obj = (JoystickLogic)ToLua.CheckObject(L, 1, typeof(JoystickLogic)); UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); obj.OnDragMove(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int OnButtonDown(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); JoystickLogic obj = (JoystickLogic)ToLua.CheckObject(L, 1, typeof(JoystickLogic)); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.OnButtonDown(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int set_simulate(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); JoystickLogic obj = (JoystickLogic)o; bool arg0 = LuaDLL.luaL_checkboolean(L, 2); obj.simulate = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index simulate on a nil value" : e.Message)); } }
static int set_areaChangeColor(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); JoystickLogic obj = (JoystickLogic)o; UnityEngine.Color arg0 = ToLua.ToColor(L, 2); obj.areaChangeColor = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index areaChangeColor on a nil value" : e.Message)); } }
static int set_JoystickTouch(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); JoystickLogic obj = (JoystickLogic)o; UIWrapper arg0 = (UIWrapper)ToLua.CheckUnityObject(L, 2, typeof(UIWrapper)); obj.JoystickTouch = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index JoystickTouch on a nil value" : e.Message)); } }
static int get_deltaPos(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); JoystickLogic obj = (JoystickLogic)o; UnityEngine.Vector2 ret = obj.deltaPos; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index deltaPos on a nil value" : e.Message)); } }
static int get_onUpdateJoystick(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); JoystickLogic obj = (JoystickLogic)o; LuaInterface.LuaFunction ret = obj.onUpdateJoystick; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onUpdateJoystick on a nil value" : e.Message)); } }
static int get_JoystickTouch(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); JoystickLogic obj = (JoystickLogic)o; UIWrapper ret = obj.JoystickTouch; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index JoystickTouch on a nil value" : e.Message)); } }
static int set_onUpdateJoystick(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); JoystickLogic obj = (JoystickLogic)o; LuaFunction arg0 = ToLua.CheckLuaFunction(L, 2); obj.onUpdateJoystick = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onUpdateJoystick on a nil value" : e.Message)); } }
static int get_offsetRadio(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); JoystickLogic obj = (JoystickLogic)o; float ret = obj.offsetRadio; LuaDLL.lua_pushnumber(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index offsetRadio on a nil value" : e.Message)); } }
static int set_recoverStartPos(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); JoystickLogic obj = (JoystickLogic)o; UnityEngine.Vector2 arg0 = ToLua.ToVector2(L, 2); obj.recoverStartPos = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index recoverStartPos on a nil value" : e.Message)); } }
static int get_IsJoysticking(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); JoystickLogic obj = (JoystickLogic)o; bool ret = obj.IsJoysticking; LuaDLL.lua_pushboolean(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index IsJoysticking on a nil value" : e.Message)); } }
static int set_offsetRadio(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); JoystickLogic obj = (JoystickLogic)o; float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); obj.offsetRadio = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index offsetRadio on a nil value" : e.Message)); } }
public void Initialize(CharacterController controller, CharacterMovementData data) { _joystick = data.Joystick; data.JoystickData.OnTouchDown = OnMoveStart; data.JoystickData.OnTouchUp = OnMoveEnd; data.JoystickData.OnDrag = OnMoveEvent; data.JoystickData.OnClick = OnClick; _joystick.InitializeEvents(data.JoystickData); _canMoveCheck = data.OnCanMoveCheck; _maxSpeed = data.MovementMaxSpeed; _characterRigidbody = data.CharacterRigidbody; _animationLogic = data.AnimationLogic; OnDisconnectEvents = _joystick.DisconnectEvents; _controller = controller; _initialized = true; }