private void StopNav() { if (!isMovingToTarget) { return; } _isjoystickMove = false; _joystickX = 0; _joystickY = 0; pathNodeMoveCost = 0; ixyGetPoint = false; curPathDistance = 0; _isMovingToTarget = false; if (controlMode == ControlMode.IDLE) { return; } pathIndex = 0; path.ClearCorners(); controlMode = ControlMode.IDLE; if (!forceMove) { _controller.Move(Vector3.zero); } if (luaEventCall != null) { LuaManager.CallFunc_VX(luaEventCall, luaEventCallParam, EVENT_MOVESTOP); } }
private void UpdateStopNav(int len) { ixyGetPoint = false; if (_isjoystickMove) { if (_joystickX != 0 || _joystickY != 0) { Move(_joystickX, _joystickY); return; } } if (pathIndex >= len) { pathIndex = len - 1; } if (pathIndex >= 0) { } StopNav(); if (lifeState != null) { lifeState.SetEvent(EVENT_MOVETOTARGET, null); } if (luaEventCall != null) { LuaManager.CallFunc_VX(luaEventCall, luaEventCallParam, EVENT_MOVETOTARGET); } }
public int MoveTo(Vector3 pos, bool once = false) { path.ClearCorners(); if (NavMesh.CalculatePath(m_transform.position, pos, NavMesh.AllAreas, path)) { pathIndex = 1; if (path.corners.Length <= 1) { pathIndex = 0; } prevDestPosition = m_transform.position; curPathDistance = (prevDestPosition - path.corners[pathIndex]).sqrMagnitude; if (!grounded) { path.corners[pathIndex].y = prevDestPosition.y; } moveDir = (path.corners[pathIndex] - prevDestPosition).normalized; _isMovingToTarget = true; if (luaEventCall != null) { LuaManager.CallFunc_VX(luaEventCall, luaEventCallParam, EVENT_FINDPATHSUCCESS); } pathNodeMoveCost = 0; controlMode = ControlMode.RUNNING; } else { if (!once) { NavMeshHit hit; if (NavMesh.Raycast(m_transform.position, pos, out hit, NavMesh.AllAreas)) { if (hit.mask == 0) { if (NavMesh.FindClosestEdge(m_transform.position, out hit, NavMesh.AllAreas)) { return(MoveTo(hit.position, true)); } } else { return(MoveTo(hit.position, true)); } } } if (luaEventCall != null) { LuaManager.CallFunc_VX(luaEventCall, luaEventCallParam, EVENT_FINDPATHFAILED); } return(-1000); } return(0); }
public void FallingDamage(float fall_distance) { if (lifeState != null) { lifeState.SetEvent(EVENT_FALLDOWNDAMAGE, new System.Object[] { fall_distance }); } if (luaEventCall != null) { LuaManager.CallFunc_VX(luaEventCall, luaEventCallParam, EVENT_FALLDOWNDAMAGE); } }
protected void ProcessEndModelCall(ModelBase mb, int _bodyID) { if (endProcessModel != null) { endProcessModel(mb, endProcessParam); } if (luaEndProcessModel != null) { LuaManager.CallFunc_VX(luaEndProcessModel, _bodyID, endProcessParam); } }
void OnCuteSceneFinished(object sender, CutsceneEventArgs arg) { if (cutscene == null) { return; } LuaInterface.LuaFunction func = LuaManager.GetFunction("SequenceCall.OnFinished"); string name = cutscene.name; int index = name.IndexOf("("); if (index >= 0) { name = name.Substring(0, index); } LuaManager.CallFunc_VX(func, name); }
void OnMessage(object sender, CutsceneEventArgs arg) { if (cutscene == null) { return; } LuaInterface.LuaFunction func = LuaManager.GetFunction("SequenceCall.OnMessage"); string name = cutscene.name; int index = name.IndexOf("("); if (index >= 0) { name = name.Substring(0, index); } LuaManager.CallFunc_VX(func, arg.msg, arg.param); }
public virtual void ProcessModel(GameObject obj) { if (obj == null) { if (endProcessModel != null) { endProcessModel(null, endProcessParam); } if (luaEndProcessModel != null) { LuaManager.CallFunc_VX(luaEndProcessModel, -1, endProcessParam); } return; } if (body != null) { if (body == obj.transform) { if (Config.Detail_Debug_Log()) { Debug.LogWarning("model base process model over: equal body"); } ProcessEndModelCall(this, bodyID); return; } LuaObjs.Destroy(bodyID); body = null; bodyID = -1; } body = obj.transform; bodyID = LuaObjs.RegisterTransform(body, true); Vector3 vec = m_transform.position; body.parent = m_transform; vec.Set(0, 0, 0); body.localPosition = vec; body.localRotation = Quaternion.identity; vec.Set(1, 1, 1); body.localScale = vec; body.gameObject.layer = gameObject.layer; ErgodicTransform(body, gameObject.layer); ProcessAnimationModule(); if (Config.Detail_Debug_Log()) { Debug.LogError("model base process model call->" + (endProcessModel == null)); } if (endProcessModel != null) { endProcessModel(this, endProcessParam); } if (luaEndProcessModel != null) { LuaManager.CallFunc_VX(luaEndProcessModel, bodyID, endProcessParam); } }