void Awake() { if (Application.isPlaying) { //SetBossCameraView(); // adjust camera position float max = 16.0f / 9.0f; float min = 16.0f / 10.0f;//by pj 缩小范围 保持镜头不穿帮 //float current = GetComponent<Camera>().aspect; //current = Mathf.Max(min, current); //float factor = max / Mathf.Max(min, current); // 锁定范围大小,保证所有分辨率比例下显示一致 float factor = max / min; if (waypointObjects != null) { for (int i = 0; i < waypointObjects.Length; ++i) { Vector3 localPosition = waypointObjects[i].transform.localPosition; localPosition *= factor; waypointObjects[i].transform.localPosition = localPosition; } } } if (GetComponent <CameraShake>() == null) { gameObject.AddComponent <CameraShake>(); } Instance = this; }
public void Init() { //EasyTouchSimpleEvent.SwipeAction += OnSwipe; //EasyTouchSimpleEvent.Swipe2FingerAction += OnSwipe2Finger; //EasyTouchSimpleEvent.SwipeEnd2FingerAction += OnSwipeEnd2Finger; //InputManager.MouseScrollWheelAction += OnMouseScrollWheel; if (initialized) { return; } initialized = true; if (followCamera == null) { followCamera = Camera.main; } if (followCamera == null)//再次确认是否存在,场景里不拖拽相机到这脚本上,就需要代码赋值,但存在camera被隐藏的情况,因此通过名字查找 { Transform obj = transform.parent.Find("Main Camera"); if (obj != null) { followCamera = obj.GetComponent <Camera>(); } else { EB.Debug.LogError("Can't find Main Camera!!!"); } } cc = followCamera.GetComponent <CombatCamera>(); if (isActive) { //followOffset = new Vector3(0, followOffsetY, 0); Transform buffParent = transform.parent; followCamera.transform.LookAt(this.transform); transform.SetParent(followCamera.transform); transform.localEulerAngles = Vector3.zero; transform.SetParent(buffParent); followCamera.transform.SetParent(this.transform); if (cc != null) { cc.State = CombatCamera.MotionState.Freedom; } } if (_rotationTarget == null) { _rotationTarget = new GameObject("RotationTarget").transform; _rotationTarget.rotation = transform.rotation; } delTouchCharacter += OnTouchCharacter; delTouchDownInView += OnTouchDownInView; if (GameEngine.Instance == null) { isOpenTouchView = false; } CameraRotationalSpeed = CAMERA_ROTATIONAL_SPEED; }
// Use this for initialization void Awake () { control = this; cameraPositions = cameraPositionsNode.GetComponentsInChildren<Transform>(); SetOrigins (); }
public void DeregisterAll() { #if UNITY_EDITOR _previewCamera = null; #else GameObject.DestroyImmediate(_previewCamera); #endif Reset(); _previews.Clear(); }
public void Init(HUDController hudController) { _hudController = hudController; PlayerCombatView view = GameObject.Instantiate <PlayerCombatView>(_gameplayResources.playerCombatView); _playerCombatController = new PlayerCombatController(view, _gameConfig.playerConfig); _playerCombatController.AddListener(GameplayEventType.DAMAGE_TAKEN, OnPlayeDamageTake); _gameplayCam = GameObject.FindObjectOfType <GameplayCamera>(); _combatCamera = new CombatCamera(_gameplayCam, _playerCombatController.transform); _parentController = GameObject.Instantiate <ParentController>(_gameplayResources.parentController); _parentController.Init(_gameConfig.playerConfig); _parentController.AddListener(GameplayEventType.DAMAGE_TAKEN, OnParentDamageTaken); }
public static int get_m_initSplitScreenOrthographicSize(IntPtr l) { int result; try { CombatCamera combatCamera = (CombatCamera)LuaObject.checkSelf(l); LuaObject.pushValue(l, true); LuaObject.pushValue(l, combatCamera.m_luaExportHelper.m_initSplitScreenOrthographicSize); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int constructor(IntPtr l) { int result; try { CombatCamera o = new CombatCamera(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, o); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
void FadeOutRating() { _isShowingRating = false; ScreenCollider.CustomSetActive(false); CombatLogic.Instance.ExitCombat(); CombatCamera combat_camera = null; if (Camera.main != null) { combat_camera = Camera.main.GetComponent <CombatCamera>(); if (combat_camera != null) { combat_camera.DisableBlurEffect(); } } OnVictoryFadedOut(); }
public static int __callBase_GetAnimationOffset(IntPtr l) { int result; try { CombatCamera combatCamera = (CombatCamera)LuaObject.checkSelf(l); Vector3 o = combatCamera.m_luaExportHelper.__callBase_GetAnimationOffset(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, o); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int __callBase_PlayAnimation(IntPtr l) { int result; try { CombatCamera combatCamera = (CombatCamera)LuaObject.checkSelf(l); string name; LuaObject.checkType(l, 2, out name); combatCamera.m_luaExportHelper.__callBase_PlayAnimation(name); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int set_m_initPosition(IntPtr l) { int result; try { CombatCamera combatCamera = (CombatCamera)LuaObject.checkSelf(l); Vector3 initPosition; LuaObject.checkType(l, 2, out initPosition); combatCamera.m_luaExportHelper.m_initPosition = initPosition; LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int Initialize(IntPtr l) { int result; try { CombatCamera combatCamera = (CombatCamera)LuaObject.checkSelf(l); GameObject go; LuaObject.checkType <GameObject>(l, 2, out go); combatCamera.Initialize(go); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int Update(IntPtr l) { int result; try { CombatCamera combatCamera = (CombatCamera)LuaObject.checkSelf(l); float dt; LuaObject.checkType(l, 2, out dt); combatCamera.Update(dt); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int set_m_initOrthographicSize(IntPtr l) { int result; try { CombatCamera combatCamera = (CombatCamera)LuaObject.checkSelf(l); float initOrthographicSize; LuaObject.checkType(l, 2, out initOrthographicSize); combatCamera.m_luaExportHelper.m_initOrthographicSize = initOrthographicSize; LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int StartCombat(IntPtr l) { int result; try { CombatCamera combatCamera = (CombatCamera)LuaObject.checkSelf(l); bool splitScreen; LuaObject.checkType(l, 2, out splitScreen); combatCamera.StartCombat(splitScreen); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int set_m_camera2(IntPtr l) { int result; try { CombatCamera combatCamera = (CombatCamera)LuaObject.checkSelf(l); Camera camera; LuaObject.checkType <Camera>(l, 2, out camera); combatCamera.m_luaExportHelper.m_camera2 = camera; LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int __callBase_IsCulled(IntPtr l) { int result; try { int num = LuaDLL.lua_gettop(l); if (num == 2) { CombatCamera combatCamera = (CombatCamera)LuaObject.checkSelf(l); Vector2 p; LuaObject.checkType(l, 2, out p); bool b = combatCamera.m_luaExportHelper.__callBase_IsCulled(p); LuaObject.pushValue(l, true); LuaObject.pushValue(l, b); result = 2; } else if (num == 3) { CombatCamera combatCamera2 = (CombatCamera)LuaObject.checkSelf(l); Vector2 bmin; LuaObject.checkType(l, 2, out bmin); Vector2 bmax; LuaObject.checkType(l, 3, out bmax); bool b2 = combatCamera2.m_luaExportHelper.__callBase_IsCulled(bmin, bmax); LuaObject.pushValue(l, true); LuaObject.pushValue(l, b2); result = 2; } else { LuaObject.pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function __callBase_IsCulled to call"); result = 2; } } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
void OnVictoryFadedOut() { CombatCamera combatCamera = null; if (Camera.main != null) { combatCamera = Camera.main.GetComponent <CombatCamera>(); if (combatCamera != null) { combatCamera.HoldingCamera = false; } } VictoryAnimation.CustomSetActive(false); DefeatRating.CustomSetActive(false); { LeaveResultScreen(); } }
public static int __callBase_Initialize(IntPtr l) { int result; try { CombatCamera combatCamera = (CombatCamera)LuaObject.checkSelf(l); GameObject cameraGo; LuaObject.checkType <GameObject>(l, 2, out cameraGo); GameObject animatorGo; LuaObject.checkType <GameObject>(l, 3, out animatorGo); combatCamera.m_luaExportHelper.__callBase_Initialize(cameraGo, animatorGo); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int __callBase_GetViewSize(IntPtr l) { int result; try { CombatCamera combatCamera = (CombatCamera)LuaObject.checkSelf(l); float o; float o2; combatCamera.m_luaExportHelper.__callBase_GetViewSize(out o, out o2); LuaObject.pushValue(l, true); LuaObject.pushValue(l, o); LuaObject.pushValue(l, o2); result = 3; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public void Update(float time, float deltaTime) { if (_event == null) { return; } if (IsPlaying()) { if (Camera.main != null) { CombatCamera combat_camera = Camera.main.GetComponent <CombatCamera>(); if (combat_camera != null) { combat_camera.EditorUpdate(deltaTime); } } //CombatCamera combat_camera = CameraMotionPreviewManager.Instance._previewCamera; //if (combat_camera != null) //{ // combat_camera.EditorUpdate(); //} //float t = time - _startTime; //CameraMotionEventProperties info = _event._cameraMotionProperties; //float delta = Mathf.Clamp01(t / info._lerpDuration); //Camera.main.transform.eulerAngles = Vector3.Lerp(Camera.main.transform.eulerAngles, m_target_angle, info._lerpCurve.Evaluate(delta)); //Camera.main.transform.position = Vector3.Lerp(Camera.main.transform.position, m_target_pos, info._lerpCurve.Evaluate(delta)); //if (t > info._lerpDuration) //{ // EB.Debug.Log("STOP CAMERA MOTION PREVIEW"); // Stop(); //} } }
public static void DirectExitCombat() { string state = ""; DataLookupsCache.Instance.SearchDataByID <string>("playstate.state", out state); if (string.IsNullOrEmpty(state) || state.CompareTo("Combat") == 0) { MainLandLogic.GetInstance().RequestCombatResumeToScene(); } else { CombatLogic.Instance.ExitCombat(); if (Camera.main != null) { CombatCamera combat_camera = Camera.main.GetComponent <CombatCamera>(); if (combat_camera != null) { combat_camera.DisableBlurEffect(); combat_camera.HoldingCamera = false; } } if (GameStateManager.Instance != null) { GameStateLoadGame loadState = GameStateManager.Instance.GetGameState <GameStateLoadGame>(); UIStack.Instance.ShowLoadingScreen(() => { if (loadState != null) { LTHotfixManager.GetManager <SceneManager>().EnterSceneByPlayState(); } }, false, true); } } }
// Start is called before the first frame update void Start() { combatCamera = Object.FindObjectOfType <CombatCamera>(); foreground.GetComponent <Image>().fillAmount = 1.0f; }
private void OnDestroy() { Instance = null; }
//显示战斗结算界面 public void ShowBattleResult(bool win) { CombatCamera combatCamera = null; if (Camera.main != null) { combatCamera = Camera.main.GetComponent <CombatCamera>(); if (combatCamera != null) { combatCamera.HoldingCamera = true; } } switch (_battleType) { case eBattleType.ExpeditionBattle: break; case eBattleType.TreasuryBattle: case eBattleType.ExpSpringBattle: LTResourceInstanceRatingGM com = ResInstanceRating.GetMonoILRComponent <LTResourceInstanceRatingGM>(); com.OnShownAnimCompleted = OnRatingShownAnimFinished; com.BattleType = _battleType; ResInstanceRating.CustomSetActive(true); if (win && _battleType == eBattleType.TreasuryBattle) { FusionTelemetry.GamePlayData.PostEvent(FusionTelemetry.GamePlayData.gold_camp_topic, FusionTelemetry.GamePlayData.gold_camp_event_id, FusionTelemetry.GamePlayData.gold_camp_umengId, "reward"); } else if (win && _battleType == eBattleType.ExpSpringBattle) { FusionTelemetry.GamePlayData.PostEvent(FusionTelemetry.GamePlayData.exp_camp_topic, FusionTelemetry.GamePlayData.exp_camp_event_id, FusionTelemetry.GamePlayData.exp_camp_umengId, "reward"); } break; case eBattleType.MainCampaignBattle: CampaignRatingDialogMH main_rating = CampaignRating.GetMonoILRComponent <CampaignRatingDialogMH>(); main_rating.IsWon = m_CombatResult == eCombatOutcome.Win ? true : false; main_rating.onShownAnimCompleted = OnRatingShownAnimFinished; CampaignRating.CustomSetActive(true); LTGuideTips.IsEnableGuideTips = main_rating.IsWon; break; case eBattleType.ChallengeCampaign: case eBattleType.AlienMazeBattle: CommonRatingDialogLT challenge_rating = CommonCampaignRating.GetMonoILRComponent <CommonRatingDialogLT>(); challenge_rating.IsWon = m_CombatResult == eCombatOutcome.Win ? true : false; challenge_rating.IsShowHp = true; challenge_rating.onShownAnimCompleted = OnRatingShownAnimFinished; CommonCampaignRating.CustomSetActive(true); break; case eBattleType.ArenaBattle: ArenaRatingDialogLT arena_rating = ArenaRating.GetMonoILRComponent <ArenaRatingDialogLT>(); arena_rating.IsWon = m_CombatResult == eCombatOutcome.Win ? true : false; arena_rating.onShownAnimCompleted = OnRatingShownAnimFinished; ArenaRating.CustomSetActive(true); LTDailyDataManager.Instance.SetDailyDataRefreshState(); if (win) { FusionTelemetry.GamePlayData.PostEvent(FusionTelemetry.GamePlayData.arena_topic, FusionTelemetry.GamePlayData.arena_event_id, FusionTelemetry.GamePlayData.arena_umengId, "reward"); } break; case eBattleType.HonorArena: var harc = HonorArenaResult.GetMonoILRComponent <HonorArenaResultController>(); harc.onShownAnimCompleted = OnRatingShownAnimFinished; HonorArenaResult.CustomSetActive(true); if (win) { FusionTelemetry.GamePlayData.PostEvent(FusionTelemetry.GamePlayData.honor_topic, FusionTelemetry.GamePlayData.honor_event_id, FusionTelemetry.GamePlayData.honor_umengId, "reward"); } break; case eBattleType.BossBattle: case eBattleType.AllianceCampaignBattle: if (_battleType == eBattleType.BossBattle) { LTDailyDataManager.Instance.SetDailyDataRefreshState(); } LTWorldBossBattleResult boss_rating = WorldBossRating.GetMonoILRComponent <LTWorldBossBattleResult>(); boss_rating.onShownAnimCompleted = OnRatingShownAnimFinished; WorldBossRating.CustomSetActive(true); break; case eBattleType.HeroBattle: heroBattleResult.mDMono.gameObject.CustomSetActive(true); heroBattleResult.onShownAnimCompleted = OnRatingShownAnimFinished; heroBattleResult.Show(m_CombatResult == eCombatOutcome.Win ? true : false); if (win) { FusionTelemetry.GamePlayData.PostEvent(FusionTelemetry.GamePlayData.clash_topic, FusionTelemetry.GamePlayData.clash_event_id, FusionTelemetry.GamePlayData.clash_umengId, "reward"); } break; case eBattleType.TransferOrRob: CommonRatingDialogLT transferOrRob = CommonCampaignRating.GetMonoILRComponent <CommonRatingDialogLT>(); transferOrRob.IsWon = m_CombatResult == eCombatOutcome.Win ? true : false; transferOrRob.onShownAnimCompleted = OnRatingShownAnimFinished; CommonCampaignRating.CustomSetActive(true); //添加自动结束战斗 timer = 5; sequence = ILRTimerManager.instance.AddTimer(1000, 10, delegate { AntoContinueClick(); }); break; case eBattleType.LadderBattle: CommonRatingDialogLT ladder_rating = CommonCampaignRating.GetMonoILRComponent <CommonRatingDialogLT>(); ladder_rating.IsWon = m_CombatResult == eCombatOutcome.Win ? true : false; ladder_rating.onShownAnimCompleted = OnRatingShownAnimFinished; CommonCampaignRating.CustomSetActive(true); timer = 3; if (win) { FusionTelemetry.GamePlayData.PostEvent(FusionTelemetry.GamePlayData.ladder_topic, FusionTelemetry.GamePlayData.ladder_event_id, FusionTelemetry.GamePlayData.ladder_umengId, "reward"); } if (LadderManager.Instance.IsTrusteeship) { sequence = ILRTimerManager.instance.AddTimer(1000, 10, delegate { AntoContinueClick(); }); } break; default: if (_battleType == eBattleType.SleepTower && win) { FusionTelemetry.GamePlayData.PostEvent(FusionTelemetry.GamePlayData.sleep_topic, FusionTelemetry.GamePlayData.sleep_event_id, FusionTelemetry.GamePlayData.sleep_umengId, "reward"); } CommonRatingDialogLT common_rating = CommonCampaignRating.GetMonoILRComponent <CommonRatingDialogLT>(); common_rating.IsWon = m_CombatResult == eCombatOutcome.Win ? true : false; common_rating.onShownAnimCompleted = OnRatingShownAnimFinished; CommonCampaignRating.CustomSetActive(true); break; } }
public void Play() { _played = true; //CameraMotionEventProperties info = _event._cameraMotionProperties; //if(info._motionTarget == CameraMotionTarget.OriginView) //{ //m_target_pos = CameraMotionPreviewManager.Instance.OriginPos; //m_target_angle = CameraMotionPreviewManager.Instance.OriginAngle; //} //else { //Vector3 pos_offset = info._posOffset; //if(info._useLocalOffset) //{ //m_target_pos = _focusObject.transform.TransformPoint(pos_offset); //} //else //{ //m_target_pos = _focusObject.transform.position + pos_offset; //} //m_target_angle = info._targetAngle; } //CombatCamera combat_camera = CameraMotionPreviewManager.Instance._previewCamera; //if(combat_camera != null) //{ // //combat_camera.OnCameraMotion(m_target_pos, m_target_angle, info._lerpCurve, info._lerpDuration); //} MoveEditor.CameraMotionEventInfo info = _event; MoveEditor.CameraMotionEventProperties motionProps = info._cameraMotionProperties; //if (motionProps._motionTrigger == MoveEditor.CameraMotionTrigger.LocalPlayerOnly) //{ // if (Index.TeamIndex != CombatLogic.Instance.LocalPlayerTeamIndex) // { // return; // } //} //else if (motionProps._motionTrigger == MoveEditor.CameraMotionTrigger.EnemyOnly) //{ // if (CombatLogic.Instance.IsPlayerOrChallengerSide(Data.TeamId)) // { // return; // } // //if (!Data.IsEnemy) // //{ // // return; // //} //} if (Camera.main != null) { CombatCamera combat_camera = Camera.main.GetComponent <CombatCamera>(); //if (!combat_camera.m_enablePlayerOrChallengerMotion && CombatLogic.Instance.IsPlayerOrChallengerSide(Index.TeamIndex)) //{ // return; //} //if (!combat_camera.m_enableOpponentMotion && CombatLogic.Instance.IsOpponentSide(Index.TeamIndex)) //{ // return; //} string camera_motion_json = motionProps._motionOptions; List <MoveEditor.CameraMotionOption> options = GM.JSON.ToObject <List <MoveEditor.CameraMotionOption> >(camera_motion_json); List <GameObject> targets = new List <GameObject>(); if (motionProps._motionTarget == MoveEditor.CameraMotionTarget.Attacker) { targets.Add(_previewGameObject); } else if (motionProps._motionTarget == MoveEditor.CameraMotionTarget.Defenders) { targets.Add(_previewHitGameObject); } else if (motionProps._motionTarget == MoveEditor.CameraMotionTarget.All) { targets.Add(_previewGameObject); targets.Add(_previewHitGameObject); } else if (motionProps._motionTarget == MoveEditor.CameraMotionTarget.DefendersCameraAnchor) { //Debug.LogError("现在不支持DefendersCameraAnchor这种类型"); //GameObject anchor = CombatEventReceiver.Instance.defenderSide.Find(CombatEventReceiver.Instance.defenderFormation + "/f2").gameObject; //if (anchor != null) //{ // targets.Add(anchor); //} //else //{ // EB.Debug.LogError("Combatant.OnCameraMotion Can not find DefendersCameraAnchor GameObject"); // return; //} } if (combat_camera != null) { if (motionProps._blendCurrentCamera) { if (motionProps._onlyLookAtTarget) { combat_camera.CurrentCameraLookAt(ref targets, motionProps._hangonDuration); } else { CameraLerp lerp = CameraLerp.Create(); lerp.lerpStyle = CameraLerp.LerpStyle.determineAtRunTime; lerp.dialogueCameraLerpSmoothing = motionProps._blendLerpSmoothing; lerp.animationCurve = motionProps._blendLerpCurve; lerp.dialogueCameraLerpTime = motionProps._lerpDuration; lerp.pitchLerpSmoothing = motionProps._blendPitchLerpSmoothing; lerp.curvePitchLerp = motionProps._blendPitchLerpCurve; lerp.yawLerpSmoothing = motionProps._blendYawLerpSmoothing; lerp.curveYawLerp = motionProps._blendYawLerpCurve; lerp.hangonTime = motionProps._hangonDuration; combat_camera.BlendCurrentCamera(ref targets, motionProps._blendDistanceOffset, motionProps._blendPitchOffset, motionProps._blendYawOffset, motionProps._blendHeightOffset, lerp); } } else { //int count = options.Count; MoveEditor.CameraMotionOption option = MoveEditor.MoveUtils.GetCamermotionLottery(ref options, false); if (option != null) { //Debug.LogError("OnCameraMotion != null cbt=" + Data.ToString()); CameraMotion motion = GlobalCameraMotionData.Instance.GetCameraMotion(option._motionName); if (motion != null) { combat_camera.State = CombatCamera.MotionState.Lerping; //MyFollowCamera.Instance.isActive = false; GameCameraParams gameCameraParams = (GameCameraParams)motion.camera; CameraLerp motion_lerp = motion.cameraLerpOverride; motion_lerp.dialogueCameraLerpTime = motionProps._lerpDuration; motion_lerp.hangonTime = motionProps._hangonDuration; combat_camera.EnterInteractionCamera(ref targets, ref gameCameraParams, motion_lerp); } } } } } }