public void Update() { GameObject gohero = EntityFactory.MainHero; if (gohero != null) { Vector3 vhero = gohero.transform.position; if (SoldierCamera.MainInstance <SoldierCamera>() != null && SoldierCamera.MainInstance <SoldierCamera>().cameraMode == CameraMode.MapGodControl) { vhero = CameraUtil.GetGodEyePos(); } Vector3 vtotallen = vsize; vtotallen.y = 0.0f; float ftotallen = vtotallen.magnitude; float fvislen = ftotallen * VisFactor; foreach (DictionaryEntry keypair in groups) { int key = (int)keypair.Key; AdorningGroup ag = (AdorningGroup)keypair.Value; Vector3 vdir = vhero - ag.pos; vdir.y = 0.0f; float flen = vdir.magnitude; bool bVis = flen < fvislen; ag.SetVisable(bVis, 0.1f, FadeTime, FadeEnable); } } }
/// <summary> /// 准备阶段 /// </summary> /// <returns></returns> private IEnumerator Worker_Ready() { Double loadSceneReadyTine = DateTime.Now.Ticks; //清除缓存 LightingEffectFactory.Instance.ClearCache(); SkinManager.UnLoadAllSkin(); //卸载所有场景 UnLoadAllLevel(); AdvanceProgress(10); yield return(new WaitForSeconds(1.0f)); currentLoadingTime++; //卸载无用内存 Resources.UnloadUnusedAssets(); //GC.Collect(); if (SoldierCamera.MainInstance()) { SoldierCamera.MainInstance().ClearCameraModeChangeEvent(); } yield return(new WaitForSeconds(0.5f)); currentLoadingTime += 0.5f; isLoadingScene = true; loadSceneReadyTine = DateTime.Now.Ticks - loadSceneReadyTine; loadSceneReadyTine *= 0.0000001f; Debug.Log("加载场景准备工作,耗时:" + loadSceneReadyTine); currentLoadingTime += loadSceneReadyTine; }
public void Update() { //编辑器下侦听窗口大小改变 if (Application.isEditor) { if ((Screen.width != OldResWidth) || (Screen.height != OldResHeight)) { OldResWidth = Screen.width; OldResHeight = Screen.height; SetResolution(OldResWidth, OldResHeight); } } if (SoldierCamera.MainInstance() != null && SoldierCamera.MainInstance().cameraMode == CameraMode.FPSMode) { CheckShowCursor(); CursorLockMode newMode = SoldierCamera.MainInstance <SoldierCamera>().bRotateWithMouse ? CursorLockMode.Locked : CursorLockMode.None; if (newMode != Cursor.lockState) { Cursor.lockState = newMode; //if(SoldierCamera.MainInstance<SoldierCamera>().bFPSRotate) //{ // EntityFactory.MainHero.GetComponent<ScreenRaycast>().SetDefaultSelection(); //} //else //{ // EntityFactory.MainHero.GetComponent<ScreenRaycast>().SetNPCTargetSelection(); //} } } CheckUIKeyMessage(); }
public static void Log(string msg) { if (SoldierCamera.MainInstance <SoldierCamera>().isDebug) { Trace.Log(msg); } }
public void StopAutoMove(bool userStop = true) { if (!isAutoMoving) { return; } isAutoMoving = false; if (m_autoMoveNavModeFollow) { SoldierCamera.MainInstance <SoldierCamera>().exitNavMode(CameraNavMode.Follow); m_autoMoveNavModeFollow = false; } if (m_pFSM.showLog) { Trace.Log("StopAutoMove"); } if (userStop) { cmd_creature_operation_type type = new cmd_creature_operation_type(); type.nType = 0; IntPtrHelper helper = new IntPtrHelper(); IntPtr ptr = helper.toPtr <cmd_creature_operation_type>(ref type); int len = Marshal.SizeOf(type); GameLogicAPI.onEntityEvent(m_pFSM.entityID, (int)EntityLogicDef.ENTITY_CMD_OPERATION_TYPE, len, "", ptr, len); } enableAutoMoveEffect(false); }
public void OnPlayerItemClick(PlayerCombatData item) { U3D_Render.EntityView ev = EntityFactory.getEntityViewByID(item.nEntityID); if (ev == null) { return; } CurrentPlayer = item; BottomView.ResetView(); SetNumPromps(ev); SetSpellData(); SetPersonBuyGoodsInfo(); RestoreAllSpellCD(); // 切换镜头 SoldierCamera.MainInstance <SoldierCamera>().SwitchOBSoliderTarget(ev); #if ENABLE_YUNYING_MODE SoldierCamera.MainInstance <SoldierCamera>().EnterOB_yunying(CameraMode.YUNYING_OBHeroLock); #else SoldierCamera.MainInstance <SoldierCamera>().EnableOBMode(true); #endif }
/// <summary> /// 切换观察当前距离最近的可见英雄 /// </summary> private void SwitchNearbyViewHero() { if (SoldierCamera.MainInstance().CurrentCamera == null) { return; } ICollection <int> entityList = DataCenter.LogicDataCenter.warOBDataManager.GetCurMainCampPlayerList(); Transform camTrans = SoldierCamera.MainInstance().CurrentCamera.transform; float nearbyDis = float.MaxValue; U3D_Render.EntityView nearbyEv = null; foreach (int evID in entityList) { U3D_Render.EntityView ev = EntityFactory.getEntityViewByID(evID); if (U3D_Render.EntityView.isNullOrEmpty(ev) || ev.gameObject == null) { continue; } float dis = Vector3.SqrMagnitude(ev.gameObject.transform.position - camTrans.position); if (Mathf.Abs(dis) < nearbyDis) { nearbyDis = dis; nearbyEv = ev; } } ViewTargetHero(nearbyEv); }
private void JumpBattleWarRecordView() { UISystem.Instance.ShowWnd(WndID.WND_ID_BATTLEWAR_RECORDTABLE, true); SoldierCamera.MainInstance <SoldierCamera>().LeaveCurMode(); SetVisible(false); }
public override bool Begin() { if (!BindConfig || null == EffectParam) { return(false); } base.Begin(); Camera cam = SoldierCamera.MainInstance().CurrentCamera; if (EffectParam.srcObject && cam && Initialize.mainCam) { //距离超过创建距离,不创建光效了。 //为了保证上帝视角和切换回英雄附近都能正确看到光效,这里同时考虑光效到英雄以及光效到摄像机的距离 Vector3 p0 = EffectParam.srcObject.transform.position; Vector3 p1 = Initialize.mainCam.transform.position; Vector3 p2 = Vector3.zero; if (EntityFactory.MainHero) { p2 = EntityFactory.MainHero.transform.position; } //不要Y p0.y = 0; p1.y = 0; p2.y = 0; Vector3 dis1 = p1 - p0; Vector3 dis2 = p2 - p0; float disSqr = LightingEffectFactory.CreateDistance * LightingEffectFactory.CreateDistance; if (EffectConfig.EnableDistanceOptimtized && (dis1.sqrMagnitude > disSqr) && (dis2.sqrMagnitude > disSqr)) { //创建失败,要进行回收,要不然缓存无法更新 LightingEffectBehavior temp = this; LightingEffectFactory.Instance.CacheEffectBehavior(ref temp); return(false); } } if (EffectParam.speed <= 0.0f) { EffectParam.speed = 1.0f; } uint tick = GameLogicAPI.getTickCount(); mStartTick = tick + (uint)((float)BindConfig.effectStartTick / EffectParam.speed); mEndTick = mStartTick + (uint)((float)BindConfig.effectLiveTick / EffectParam.speed); UnRegsiterSkinChangedEvent(EffectParam.nSrcEntityID, OnSkinChanged); RegsiterSkinChangedEvent(EffectParam.nSrcEntityID, OnSkinChanged); return(true); }
private int DeltaRotate() { if (m_bHoriDir) { return((int)Mathf.Abs(SoldierCamera.MainInstance <SoldierCamera>().target.rotation.eulerAngles.y - m_nBeginAngle)); } else { return((int)Mathf.Abs(SoldierCamera.MainInstance <SoldierCamera>().target.rotation.eulerAngles.x - m_nBeginAngle)); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); if (GUILayout.Button("Reset")) { if (SoldierCamera.MainInstance <SoldierCamera>() != null) { SoldierCamera.MainInstance <SoldierCamera>().Reset(true); Debug.Log("Camera reseted"); } } }
public void Update() { if (InputManager.GetKeyDown(KeyCode.BackQuote) && (InputManager.GetKey(KeyCode.LeftControl) || InputManager.GetKey(KeyCode.RightControl))) { RotateWithMouse = !RotateWithMouse; } if (SoldierCamera.MainInstance() != null && SoldierCamera.MainInstance <SoldierCamera>().bRotateWithMouse != RotateWithMouse) { if (SoldierCamera.MainInstance <SoldierCamera>().bRotateWithMouse) { setFPSRotate(true, true); } else { if (SoldierCamera.MainInstance().cameraMode == CameraMode.FPSMode) { setFPSRotate(false, true); } else if (SoldierCamera.MainInstance().cameraMode != CameraMode.SniperscopeControl) { setFPSRotate(false, false); } } } fMouseAxisX = InputManager.GetAxis(InputAxisSet.Axis_MouseX); fMouseAxisY = InputManager.GetAxis(InputAxisSet.Axis_MouseY); if (skillCtrl == null) { skillCtrl = transform.GetComponent <SkillCtrl>(); } if ((InputManager.GetMouseButton(1) || RotateWithMouse) && canSkillCtrl()) { m_bCameraRotateButton = true; } else { m_bCameraRotateButton = false; } updateMouseMoving(); //分状态对按键处理 updateFunction(); //if (Screen.lockCursor != m_lockCursor) //{ // Screen.lockCursor = m_lockCursor; //} }
private void UpdateTransform() { SoldierCamera soldierCam = SoldierCamera.MainInstance <SoldierCamera>(); if (!m_bEnable || EntityView.isNullOrEmpty(m_Entity) || !m_BillBoard || !soldierCam || !soldierCam.CurrentCamera) { return; } CreatureProperty pero = m_Entity.Property; if (!pero) { return; } //计算Y偏移值 float offsetY = m_BillBoard.HeightInMeter * 0.2f + pero.CreatureHeightInMeters + pero.BloodYOffset; m_BillBoard.transform.localPosition = new Vector3(0, offsetY, 0); //算出相机到实体的距离 float hideInDis = pero.TopInfoHideInDistance; //上帝视野要多加 if (soldierCam.InGodViewMode) { hideInDis += UBloodManager.Instance.extendHideDistanceInGodView; } Vector3 camPos = soldierCam.CurrentCamera.transform.position; Vector3 billBoardPos = m_BillBoard.transform.position; camPos.y = billBoardPos.y; float dis = (camPos - billBoardPos).sqrMagnitude; if (dis > hideInDis * hideInDis)//距离已经超过了实体头顶信息隐藏距离,隐藏 { m_IsOutOfVisibleDistance = true; UpdateVisible(); return; } else { if (m_IsOutOfVisibleDistance) { m_IsOutOfVisibleDistance = false; UpdateVisible(); } } }
protected override int onExecute(TBTWorkingData wData) { int runningState = TBTRunningStatus.USER_EXECUTING; if (SoldierCamera.MainInstance <SoldierCamera>() != null && SoldierCamera.MainInstance <SoldierCamera>().target != null) { runningState = DeltaRotate() > m_nCheckRotateAngleDelta ? TBTRunningStatus.FINISHED : TBTRunningStatus.EXECUTING; //if(runningState == TBTRunningStatus.FINISHED) // EntityEventHelper.Instance.SendCommand(EntityFactory.MainHeroID, EntityLogicDef.ENTITY_CMD_GUIDE_ROTATECAMERA); } return(runningState);//TBTRunningStatus.USER_EXECUTING; }
// 战场结束最后胜利队伍退出战场进入主城 public void onGameOverReturn() { Debug.Log("onGameOverReturn"); ViewEventHelper.Instance.SendCommand(GameLogicDef.GVIEWCMD_USER_BACK_GAME); //EntityEventHelper.Instance.SendCommand(EntityFactory.MainHeroID, EntityLogicDef.ENTITY_CMD_REQ_EXIT_WAR); SoldierCamera.MainInstance <SoldierCamera>().LeaveCurMode(); // 隐藏聊天框 ChatForceConditionHide ChatData = new ChatForceConditionHide(); ChatData.bForceHide = true; UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_CHATBOX_CONDITIONHIDE, ChatData); SetVisible(false); }
// 计算英雄与附近玩家目标角度并映射到UI上 private void GetQueryTarget(Int32 entityID, Transform TargetEntityTrans) { Transform CameraTransform = SoldierCamera.MainInstance <SoldierCamera>().getCameraTransform(); if (CameraTransform == null) { return; } if (EntityFactory.MainHero == null) { return; } float checkDis = Vector3.Distance(TargetEntityTrans.position, EntityFactory.MainHero.transform.position); if (checkDis > EntityFactory.MainHeroView.Sight || ScreenRaycast.isInScreen(TargetEntityTrans.position)) { return; } Vector3 vecHeroPos = EntityFactory.MainHeroView.gameObject.transform.position; Vector3 DirHeroToTarget = TargetEntityTrans.position - vecHeroPos; Vector3 DirHeroToCamera = CameraTransform.position - vecHeroPos; DirHeroToTarget.y = 0; DirHeroToCamera.y = 0; // 判断目标在相机的左右方, -1左方, +1右方 Vector3 vecCross = Vector3.Cross(DirHeroToTarget.normalized, DirHeroToCamera.normalized); float fLorR = Mathf.Sign(-vecCross.y); // 计算之间的夹角 float angle = Vector3.Angle(DirHeroToTarget.normalized, DirHeroToCamera.normalized); float relAngle = (angle * fLorR + 90) % 360; UIBillboardQueryResult qr = new UIBillboardQueryResult(); qr.entityID = entityID; qr.x = BillboardRadius * (Mathf.Cos(Mathf.Deg2Rad * (relAngle))); qr.y = -BillboardRadius * (Mathf.Sin(Mathf.Deg2Rad * (relAngle))); //在这个角度范围内图标水平移动 if (relAngle > BillboardAngle && relAngle < BillboardAngle + 120) { qr.y = -BillboardRadius * (Mathf.Sin(Mathf.Deg2Rad * BillboardAngle)); } qr.distance = Convert.ToUInt32(checkDis); qr.angle = Convert.ToInt32(relAngle + 90); tmpAroundEntitys.Add(qr); }
/// <summary> /// 切换观察阵营时的处理,如果锁定的英雄不可见了,则切换锁定目标 /// </summary> /// <param name="nNewCamp"></param> private void SwitchViewCamp(int nNewCamp) { if (SoldierCamera.MainInstance <SoldierCamera>().cameraMode != CameraMode.OBHeroLock) { return; } U3D_Render.EntityView ev = SoldierCamera.MainInstance <SoldierCamera>().soldier; if (!DataCenter.LogicDataCenter.warOBDataManager.CheckEntityViewVisible(ev)) { SwitchNearbyViewHero(); } }
public bool ConfirmWarQuit() { // 通知逻辑层释放连接 if (GameLogicAPI.getCurGameMode() == Game_ManagedDef.EGameMode.EGM_MCAMP) { EntityEventHelper.Instance.SendCommand(EntityFactory.MainHeroID, EntityLogicDef.ENTITY_CMD_REQ_EXIT_WAR); } else { ViewEventHelper.Instance.SendCommand(GameLogic.GameLogicDef.GVIEWCMD_USER_EXIT_WAR); SoldierCamera.MainInstance <SoldierCamera>().LeaveCurMode(); } SetVisible(false); return(true); }
public void CheckShowCursor() { //有泉水buff时一直显示 { if (GameLogicAPI.IsExistBuff(1044)) { SoldierCamera.MainInstance <SoldierCamera>().bFPSShowCursor = true; return; } } //死亡下一直显示 { if (EntityFactory.MainHeroView != null && EntityFactory.MainHeroView.StateMachine != null && EntityFactory.MainHeroView.StateMachine.GetState() == GameLogic.EntityState.Dead) { SoldierCamera.MainInstance <SoldierCamera>().bFPSShowCursor = true; return; } } //没死亡 { bool containUI = false; for (WndLayerDef i = WndLayerDef.WND_LAYER_POPUP02; i >= WndLayerDef.WND_LAYER_POPUP01; --i) { containUI = CheckShowCursorByWNDLayer(i); if (containUI) { break; } } if (containUI && !SoldierCamera.MainInstance <SoldierCamera>().bFPSShowCursor) { SoldierCamera.MainInstance <SoldierCamera>().bFPSShowCursor = true; return; } else if (!containUI && SoldierCamera.MainInstance <SoldierCamera>().bFPSShowCursor) { SoldierCamera.MainInstance <SoldierCamera>().bFPSShowCursor = false; return; } } //Cursor.lockState = (SoldierCamera.MainInstance<SoldierCamera>().bFPSShowCursor ? CursorLockMode.None : CursorLockMode.Locked); }
//public bool JudgeIsMouseLock() //{ // bool bMouseLock = false; // switch (m_eMouseLockState) // { // case EMouseLockModelType.EMLMT_OFF: // { // bMouseLock = false; // } // break; // case EMouseLockModelType.EMLMT_INALL: // { // bMouseLock = true; // } // break; // case EMouseLockModelType.EMLMT_INWAR: // { // bMouseLock = GameLogicAPI.isInWarScene() > 0; // } // break; // default: // break; // } // Debug.Log("type" + LockStateDesc[(int)m_eMouseLockState] + "bMouseLock" + bMouseLock); // return bMouseLock; //} #endregion public void ApplyCamSpeedData(float fValue) { if (fValue < 0) { return; } if (SoldierCamera.MainInstance() != null) { CameraProperty cp = SoldierCamera.MainInstance <SoldierCamera>().CurCameraProperty; if (cp != null) { cp.SpeedScale = fValue; } } GameSettingConfig.Instance.ModifyGameSetting(GameSettingIndex.CameraSpeed, fValue.ToString()); }
//判断是否需要创建飘字 private bool NeedToCreate(GameObject entry) { if (entry == null || Initialize.mainCam == null) { return(false); } float dis = Vector3.Distance(entry.transform.position, Initialize.mainCam.transform.position); float CameraDis = SoldierCamera.MainInstance <SoldierCamera>() ? SoldierCamera.MainInstance <SoldierCamera>().CurDistance : 8.0f; float hideinDis = HideInDistance + CameraDis; if (dis > hideinDis) { return(false); } return(true); }
// 离开状态 public void OnLeave() { if (!m_pFSM || !SoldierCamera.MainInstance <SoldierCamera>()) { return; } if (null == EntityFactory.MainHeroView || !EntityFactory.MainHeroView.StateMachine) { return; } if (m_pFSM.animator) { m_pFSM.animator.SetBool("floating", false); } if (wingAnimator) { wingAnimator.SetBool("floating", false); } DeleteFloatingAssets(); EnableAccelerate(false, 0.0f); if (m_pFSM.isHero) { if (!m_bWing) { SoldierCamera.MainInstance <SoldierCamera>().EnableMode(CameraMode.RidingControl, false); } else { SoldierCamera.MainInstance <SoldierCamera>().EnableMode(CameraMode.FloatingControl, false); } } else { //主角死亡的时候,切换的队友结束飞行需要切回上帝视角 if (EntityFactory.MainHeroView != null && EntityFactory.MainHeroView.StateMachine != null) { if (EntityFactory.MainHeroView.StateMachine.GetState() == EntityState.Dead) { SoldierCamera.MainInstance <SoldierCamera>().EnableMode(CameraMode.MapGodControl, true); } } } }
/// <summary> /// 观察指定英雄 /// </summary> /// <param name="ev"></param> public void ViewTargetHero(U3D_Render.EntityView ev) { if (U3D_Render.EntityView.isNullOrEmpty(ev)) { return; } #if ENABLE_YUNYING_MODE SoldierCamera.MainInstance <SoldierCamera>().SwitchOBSoliderTarget(ev); SoldierCamera.MainInstance <SoldierCamera>().EnterOB_yunying(CameraMode.YUNYING_OBHeroLock); #else SoldierCamera.MainInstance <SoldierCamera>().SwitchOBSoliderTarget(ev); SoldierCamera.MainInstance <SoldierCamera>().EnableOBMode(true); #endif USpeedUI.UISWitchHero heroData = new USpeedUI.UISWitchHero(); heroData.nEntityID = ev.ID; USpeedUI.UISystem.Instance.SendWndMessage(USpeedUI.WndMsgID.WND_MSG_WAR_OBSERVER_SWITCH_HERO, heroData); }
protected override void onEnter(TBTWorkingData wData) { m_nBeginAngle = 0; if (SoldierCamera.MainInstance() != null && SoldierCamera.MainInstance().target != null) { if (m_bHoriDir) { m_nBeginAngle = (int)SoldierCamera.MainInstance().target.rotation.eulerAngles.y; } else { m_nBeginAngle = (int)SoldierCamera.MainInstance().target.rotation.eulerAngles.x; } } base.onEnter(wData); }
public void LateUpdate() { if (null == EntityFactory.MainHero || null == SoldierCamera.MainInstance() || null == SoldierCamera.MainInstance().CurrentCamera) { return; } Camera curCam = SoldierCamera.MainInstance().CurrentCamera; //消除近大远小的效果 float dis = Vector3.Dot(transform.position - curCam.transform.position, curCam.transform.forward); if (Mathf.Abs(dis - m_zDistance) > 0.1f) { m_zDistance = dis; } if (!m_lastFieldOfView.Equals(curCam.fieldOfView) || m_lastScreenHeight != Screen.height) { m_unScaleflags_srceen = 2f / Screen.height; m_unScaleflags_fov = Mathf.Tan(curCam.fieldOfView * 0.5f * Mathf.Deg2Rad); m_lastScreenHeight = Screen.height; m_lastFieldOfView = curCam.fieldOfView; } float m_standradPixelToMeterScale = m_unScaleflags_srceen * 5.0f * m_unScaleflags_fov; m_pixelToMeterScale = m_unScaleflags_srceen * m_zDistance * m_unScaleflags_fov; Vector3 scale; scale.x = Mathf.Abs(m_pixelWidth * m_pixelToMeterScale * StandradScale.x * CorrScale.x); scale.y = Mathf.Abs(m_pixelHeight * m_pixelToMeterScale * StandradScale.y * CorrScale.y); scale.z = StandradScale.z; m_widthInMeter = Mathf.Abs(scale.x); m_heightInMeter = Mathf.Abs(scale.y); transform.localScale = scale; transform.rotation = curCam.transform.rotation * m_direction; }
public void OnFinish() { double loadSceneFinishTime = DateTime.Now.Ticks; ResourceEx.Collect(); AdorningManager.Init(); GrassAdorningManager.Init(); ImageSetting.OnSceneLoadFinish(); ImageSetting.Apply(true); //ImageSetting.ApplySceneImageSetting(SceneResInfoManager.CurrentActiveInstance, true); LightingEffectFactory.DisableDeadEffect(); // 场景地图资源加载完后开始播放背景音乐 //SoundManager.CreateUISound(StageManager.Instance.getSoundID()); if (SoldierCamera.MainInstance() != null) { SoldierCamera.MainInstance <SoldierCamera>().updateCameraParam(m_curMapID, -1); } loadSceneFinishTime = DateTime.Now.Ticks - loadSceneFinishTime; loadSceneFinishTime *= 0.0000001f; Debug.Log("场景加载完成阶段,耗时:" + loadSceneFinishTime); double time = DateTime.Now.Ticks - sceneLoadBegainTime; time *= 0.0000001f; Debug.Log("SceneLoad::DoTask 资源加载成功,场景名称 = " + m_SceneName + ",耗时:" + time); InvokeSceneLoadFinishEvent(m_SceneName); StartCoroutine(WaitTransitionFinish()); InvokeSceneTransitionStartEvent(m_SceneName); }
public override void Close() { if (!Valid) { return; } uint tick = GameLogicAPI.getTickCount(); if (m_camera != null) { if (tick < mEndTick) { m_camera.finishEffect((uint)cameraConfig.effectFinishTick); } else { CameraEffectUtil.MainInstance.stopEffect(); } SoldierCamera.MainInstance <SoldierCamera>().EnableMode(CameraMode.CameraAnim, false); } base.Close(); }
/// <summary> /// 实体优化 /// </summary> private void EntityOptimize() { if (!SkinConfig || SoldierCamera.MainInstance() == null || Initialize.mainCam == null || Initialize.Instance.SoliderTargetGO == null) { return; } float dragonOptimitzedDistance = 7.0f; //策划控制 U3D_Render.EntityView mainEv = EntityFactory.getMainPlayer(); if (null == mainEv) { return; } //大小龙体积过大,透明度优化 int vocationID = creaturePropety.GetNumProp(ENTITY_PROPERTY.PROPERTY_VOCATION); if (vocationID > 11 && vocationID < 15) { //检测距离,如果距离太近,不降低透明度 float dis = CaclDistance(mainEv.gameObject.transform.position, creature.position); if (dragonOptimitzedDistance > dis) { SkinControl.setAlpha(0.5f); } else { SkinControl.setAlpha(1.0f); } } if (SkinConfig.OptimitzedDistance > 0) { //检测距离,如果距离太远,不渲染了 //参考点分两种情况:上帝模式、非上帝模式 Vector3 calcPos = new Vector3(); if (SoldierCamera.MainInstance().cameraMode == CameraMode.MapGodControl || SoldierCamera.MainInstance().cameraMode == CameraMode.OBMoveFree) { calcPos = Initialize.mainCam.transform.position; } else { calcPos = Initialize.Instance.SoliderTargetGO.transform.position; } #if ENABLE_YUNYING_MODE if (SoldierCamera.MainInstance().cameraMode == CameraMode.YUNYING_OBMoveFree) { calcPos = Initialize.mainCam.transform.position; } return; #endif calcPos.y = creature.position.y; float dis = CaclDistance(calcPos, creature.position); if (dis < SkinConfig.OptimitzedDistance) { if (!m_DistanceVisible) { m_DistanceVisible = true; //淡入的时候是不可见的,所以要立马更新可见性 UpdateVisible(); //淡入皮肤 FadeInSkin(); } //位置往前移2m,再判断 Vector3 p = creature.position + Initialize.mainCam.transform.forward * 2.0f; bool isOnFrustmView = CameraUtil.isOnCameraView(p); if (isOnFrustmView) { GameUtil.EnabledAnimator(animator); } else { GameUtil.DisabledAnimator(animator); } } else { if (m_DistanceVisible) { m_DistanceVisible = false; //淡出皮肤 FadeOutSkin(); } GameUtil.DisabledAnimator(animator); } UpdateFadeSkin(); } //如果没有开启优化,走老套路 else { if (!m_DistanceVisible) { m_DistanceVisible = true; UpdateVisible(); SkinControl.setAlpha(1.0f); GameUtil.EnabledAnimator(animator); } } }
public void ApplyAnimation() { if (!m_pFSM.animator) { return; } if (!m_pFSM.SkinConfig) { return; } DeleteFloatingAssets(); if (currWing_State.szPath != "" && currWing_State.szPath != "0" && !wingGO && m_pFSM.SkinConfig && m_pFSM.SkinConfig.chibangguadian) { m_bWing = true; WingAssets = AssetBundleManager.GetAssets(AssetType.Asset_Prefab, currWing_State.szPath); if (WingAssets != null) { wingGO = WingAssets.InstanceMainRes(); wingGO.transform.SetParent(m_pFSM.SkinConfig.chibangguadian, false); wingAnimator = wingGO.GetComponent <Animator>(); //绑翅膀音效 BindSound m_bindAnimSound; m_bindAnimSound = wingGO.GetComponent <BindSound>(); if (m_bindAnimSound == null) { m_bindAnimSound = wingGO.AddComponent <BindSound>(); if (m_bindAnimSound != null) { m_bindAnimSound.bindSoundEvent += SoundManager.CreateSound; } } } } if (m_pFSM.animatorCtrl.ana) { m_pFSM.animatorCtrl.ana.SetBool("isLanding", false); m_pFSM.animatorCtrl.ana.SetBool("floating", true); m_pFSM.animatorCtrl.ana.SetBool("flyDown", false); } if (wingAnimator) { wingAnimator.SetBool("isLanding", false); wingAnimator.SetBool("floating", true); wingAnimator.SetBool("flyDown", false); } if (m_pFSM.isHero && SoldierCamera.MainInstance()) { Vector2 cameraAngle = Vector2.zero; float cameraDistance = 0.0f; if (!m_bWing) { cameraAngle = new Vector2(currWing_State.fMinCameraAngle, currWing_State.fMaxCameraAngle); cameraDistance = currWing_State.fCameraDistance; RidingStateParam camParam = new RidingStateParam(cameraDistance, cameraAngle); SoldierCamera.MainInstance <SoldierCamera>().EnableMode(CameraMode.RidingControl, true, camParam); } else { SoldierCamera.MainInstance <SoldierCamera>().EnableMode(CameraMode.FloatingControl, true); } } else { if (currWing_State.nType == WING_STATE_TYPE.WING_STATE_NORMAL_FLIGHT) { m_pFSM.animatorCtrl.ana.SetTrigger("skipFlyStart"); } else if (currWing_State.nType == WING_STATE_TYPE.WING_STATE_ACCELERATION) { m_pFSM.animatorCtrl.ana.SetTrigger("skipFlyStart"); EnableAccelerate(true, currWing_State.fMaxSpeed); } } }
public void LeaveGodEye() { SoldierCamera.MainInstance <SoldierCamera>().EnableMode(CameraMode.MapGodControl, false); }