/// <summary> /// /// </summary> /// <param name="confList"></param> public static void LoadAsync(string[] confList) { XRes.LoadMultiAsync(confList, delegate(Object[] objs) { confPvp = objs[0] as XCameraConfigure; if (confPvp) { confPvp.Initialize(); } confPve = objs[1] as XCameraConfigure; if (confPve) { confPve.Initialize(); } // joy config yo = objs[2] as XCameraYo; joy = objs[3] as XCameraYo; #if UNITY_EDITOR foreach (Object obj in objs) { GLog.Log("[XCameraHelper:LoadAsync] " + obj); } #endif }); }
/// <summary> /// /// </summary> /// <param name="conf"></param> private void ApplyConfigure(XCameraConfigure conf) { _fov = conf.fov; _restFocusHeight = conf.restFocusHeight; _maxHeight = conf.maxHeight; _minHeight = conf.minHeight; _maxRange = conf.maxRange; _minRange = conf.minRange; _focusMoveSpeed = conf.focusMoveSpeed; _positionMoveSpeed = conf.positionMoveSpeed; _posHeightMod = conf.posHeightMod; _sideBuffer = conf.sideBuffer; _offsetFocus = conf.focusOffset; _ryA = conf.ry0; _ryB = conf.ry1; _beginMaxDistanceModValue = conf.beginMaxDistanceModValue; _endMaxDistanceModValue = conf.endMaxDistanceModValue; _beginMinDistanceModValue = conf.beginMinDistanceModValue; _endMinDistanceModValue = conf.endMinDiastanceModValue; _followMinHeight = conf.followMinHeight; _followMaxHeight = conf.followMaxHeight; // reset currnt offset height, if not setting the value then camera use LeftFoot and rightFoot mid XCameraUpdater.offsetHeight = _restFocusHeight; }
/// <summary> /// /// </summary> /// <param name="type"></param> /// <returns></returns> public bool PlayShake(int type) { XCameraConfigure conf = XCameraHelper.confPvp; if (!IsPvp()) { conf = XCameraHelper.confPve; } if (!conf || conf.myShakes.Count < type) { return(false); } XCameraShake shake = XCameraShake.GetSingleton(); if (shake && shake.isActiveAndEnabled) { shake.DoShake(conf.myShakes[type - 1].numberOfShakes, conf.myShakes[type - 1].shakeAmount, conf.myShakes[type - 1].rotationAmount, conf.myShakes[type - 1].distance, conf.myShakes[type - 1].speed, conf.myShakes[type - 1].decay, conf.myShakes[type - 1].guiShakeMod, conf.myShakes[type - 1].multiplyByTimeScale); } return(true); }
/// <summary> /// /// </summary> /// <param name="type"></param> /// <param name="left"></param> /// <param name="right"></param> public void Configure(XCameraType type, float left, float right, GameObject source, GameObject target) { XCameraUpdater.type = _cameraType; _cameraType = type; _leftBoundary = left; _rightBoundary = right; if (source) { SetSource(source); } if (target) { SetTarget(target); } XCameraConfigure conf = XCameraHelper.confPvp; if (IsPvp()) { _shouldResetTwoPos = false; } else { _inMinCameraDistanceMod = false; _inMaxCameraDistanceMod = false; conf = XCameraHelper.confPve; } ApplyConfigure(conf); ResetCameraForce(); }
/// <summary> /// /// </summary> /// <param name="modNum"></param> /// <param name="name"></param> /// <param name="priority"></param> /// <param name="loopDuration"></param> public void AddModifierForCharge(int modNum, string name, int priority, float loopDuration) { XCameraConfigure conf = XCameraHelper.confPvp; if (!IsPvp()) { conf = XCameraHelper.confPve; } XCameraConfigure.ModClass mod = conf.GetMod(name); if (mod != null) { XCameraModifier modForCharge = new XCameraModifier(mod.modName, mod.modPriority, mod.focusMod, mod.heightMod, mod.rangeMod, mod.yawMod * priority, mod.wallBufferMod, mod.fieldOfView, mod.loopType, loopDuration); AddModifier(modForCharge); } }