//设置是否进入战斗锁定视角 public void SetCamFightLockState(bool isLock, GameObject target = null) { if (isLock && target != null && _CamCtrlMode == CTRL_MODE.FOLLOW) { _IsChangeLockTarget = _FightLockTarget != target; //只有跟随模式才能进入锁定 _FightLockTarget = target; IsFightLock = true; _LockTargetHeightOffset = CUnityUtil.GetModelHeight(_FightLockTarget, true) / 2; } else { QuitCamFightLock(); } }
public void AdjustOffsetWithScale(GameObject effectiveModel, float fAddHeight, float fScale) { if (FollowTarget == null) { return; } if (effectiveModel == null) { effectiveModel = FollowTarget; } var height = CUnityUtil.GetModelHeight(effectiveModel, fScale, false); Offset.y = height + .2f; Offset.y += fAddHeight; }
private static int GetModelHeight(IntPtr L) { int count = LuaDLL.lua_gettop(L); const int nRet = 1; if ((count == 1 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject)))) { var m = LuaScriptMgr.GetUnityObject <GameObject>(L, 1); if (m != null) { float heigth = CUnityUtil.GetModelHeight(m); LuaScriptMgr.Push(L, heigth); } else { HobaDebuger.LogWarning("GetModelHeight param 1 is null"); LuaScriptMgr.Push(L, 0); } } else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject), typeof(bool))) { var m = LuaScriptMgr.GetUnityObject <GameObject>(L, 1); if (m != null) { bool inchild = LuaScriptMgr.GetBoolean(L, 2); float heigth = CUnityUtil.GetModelHeight(m, inchild); LuaScriptMgr.Push(L, heigth); } else { HobaDebuger.LogWarning("GetModelHeight param 1 is null"); LuaScriptMgr.Push(L, 0); } } else { LogParamError("GetModelHeight", count); LuaScriptMgr.Push(L, 0); } return(CheckReturnNum(L, count, nRet)); }