public void Run(CamAdjustStock origin, CamAdjustStock prev, ref CameraUpdateInfo updateInfo, float deltaTime) { //rResult = crOrigin; CameraFreeState.CalcDistance(deltaTime, origin, prev, ref updateInfo, ref m_cameraStrategy.Stock.Distance); CameraFreeState.CalcDirection(deltaTime, origin, prev, ref updateInfo, ref m_cameraStrategy.Stock.Direction); }
public void Run(CameraStock stock, Vector3 targetPos, ref CameraUpdateInfo updateInfo, float elapsedTime) { m_oriStock.Stock.Copy(stock); m_oriStock.Target = targetPos; m_curState.Run(m_oriStock, m_preStock, ref updateInfo, elapsedTime); m_preStock.Stock.Copy(updateInfo); m_preStock.Target = updateInfo.Target; }
private void ApplyEffect(ref CameraUpdateInfo rUpdateInfo, float deltaTime) { if (m_lstCameraPlayers.Count <= 0) { return; } for (int i = 0; i < m_lstCameraPlayers.Count; i++) { ICameraPlayer player = m_lstCameraPlayers[i]; player.Update(ref rUpdateInfo, deltaTime); } }
public void Update(ref CameraUpdateInfo cameraUpdateInfo, float deltaTime) { if (m_lstEffectAtQuakes.Count <= 0) { return; } m_lstEffectAtQuakes.Sort(new AtQuakeUnit.Stock.Sort()); ProcessQuakeUnit(); cameraUpdateInfo.At += m_quake; }
private void SetEyePosition(CameraUpdateInfo iRUpdateInfo) { m_lstPoints.Clear(); m_lstCamera.Clear(); LimitStock crLimit = Global.CameraMgr.Impl.Limit; m_lstPoints.Add((iRUpdateInfo.At + iRUpdateInfo.LookatDir * crLimit.MinDistance)); // Last point float fDistance = iRUpdateInfo.Distance / 4.0f; float nXDir = m_effectQuake.RandLength; float nYDir = m_effectQuake.RandLength; int ran = LEMath.RandInt(2); if (m_effectQuake.RandState && ran > 0) { nXDir *= -1.0f; nYDir *= -1.0f; } for (int i = 0; i < 2; i++) { if (i % 2 > 0) { nXDir *= -1.0f; nYDir *= -1.0f; } if (m_effectQuake.RandState) { nXDir = LEMath.RandRange(0.0f, nXDir); nYDir = LEMath.RandRange(0.0f, nYDir); } float valueDst = (i + 2) * fDistance; float horAngle = (iRUpdateInfo.Horizon) + nXDir; float verAngle = (iRUpdateInfo.Vertical) + nYDir; Vector3 lookatDir = (LEMath.AngleToDirection(verAngle * LEMath.s_fDegreeToRadian, horAngle * LEMath.s_fDegreeToRadian)); m_lstPoints.Add((iRUpdateInfo.At + lookatDir * (valueDst))); } m_lstPoints.Add((iRUpdateInfo.At + iRUpdateInfo.LookatDir * iRUpdateInfo.Distance)); // Start point SetRespectiveBlending(); // Camera path setting }
private void Calculate(CameraUpdateInfo updateInfo) { updateInfo.At = updateInfo.Target + new Vector3(0.0f, updateInfo.Height, 0.0f); Vector3 lookatDir = LEMath.AngleToDirection(updateInfo.Vertical, updateInfo.Horizon); updateInfo.LookatDir = lookatDir; updateInfo.Eye = m_strategy.GetEyePos(ref updateInfo); //Vector2 v2SideDir = (LEMath.RadianToDir(updateInfo.Horizon + LEMath.s_fHalfPI)); m_direction = new Vector3(lookatDir.x, 0.0f, lookatDir.z); //m_rightDirection = -new Vector3(v2SideDir.x, 0.0f, v2SideDir.y); m_rightDirection = new Vector3(-lookatDir.z, 0.0f, lookatDir.x); m_direction.Normalize(); m_rightDirection.Normalize(); }
public Vector3 GetEyePos(ref CameraUpdateInfo updateInfo) { if (m_AtPos != updateInfo.At) { updateInfo.Distance = (m_EyeHeight - updateInfo.At.y) / (-updateInfo.LookatDir.y); Global.CameraMgr.Impl.Stock.Distance = updateInfo.Distance; //Global.CameraMgr.Impl.UpdateStock(); } Vector3 eyePos = updateInfo.At + updateInfo.LookatDir * updateInfo.Distance; m_EyeHeight = eyePos.y; m_AtPos = updateInfo.At; return(eyePos); }
private bool UpdateDecrease(ref CameraUpdateInfo iRUpdateInfo) { iRUpdateInfo.Eye = GetRespectiveBlending(m_EyeCamPost); if ((m_tickTmCount) >= m_effectQuake.TimeLength) { m_tickTmCount = m_tickTmCount - m_effectQuake.TimeLength; m_EyeCamPost -= m_effectQuake.StepCount; //return false; } if (m_EyeCamPost <= 0) { m_EyeCamPost = 0; return(true); } return(false); }
private bool UpdateFullDuplex(ref CameraUpdateInfo iRUpdateInfo) { if (m_CamEyeSwap) { if (UpdateIncrease(ref iRUpdateInfo)) { m_CamEyeSwap = false; } } else { if (UpdateDecrease(ref iRUpdateInfo)) { return(true); } } return(false); }
public void Update(ref CameraUpdateInfo cameraUpdateInfo, float deltaTime) { m_cameraUpdateInfo = cameraUpdateInfo; m_tickTmCount += deltaTime; if (m_effectQuake == null || m_CamEyePlay == false) { return; } switch (m_effectQuake.eType) { case EyeQuakeInfo.Type.Increase: { if (UpdateIncrease(ref cameraUpdateInfo)) { m_CamEyePlay = false; } } break; case EyeQuakeInfo.Type.Decrease: { if (UpdateDecrease(ref cameraUpdateInfo)) { m_CamEyePlay = false; } } break; case EyeQuakeInfo.Type.FullDuplex: { if (UpdateFullDuplex(ref cameraUpdateInfo)) { m_CamEyePlay = false; } } break; } }
public Vector3 GetEyePos(ref CameraUpdateInfo updateInfo) { return(m_curState.GetEyePos(ref updateInfo)); }
public float GetDistance(CameraUpdateInfo updateInfo) { return(updateInfo.Distance); }
public float GetAdjustDistance(CameraUpdateInfo updateInfo) { return(m_curState.GetDistance(updateInfo)); }
public static void CalcTarget(float deltaTime, CamAdjustStock origin, CamAdjustStock prev, ref CameraUpdateInfo updateInfo, ref SmoothStock smooth) { float difference = Vector3.Distance(prev.Target, origin.Target); if (difference == 0.0f) { return; } if (difference - smooth.Value > 0) { smooth.LifeTime = 0; } smooth.LifeTime += deltaTime; float elapsed = 0.1f; float smoothDiff = GetSmoothValue(elapsed, difference, smooth.Power) * 2.0f; if (smoothDiff == 0) { return; } updateInfo.Distance += smoothDiff + 0.01f; Vector3 dir = prev.Target - origin.Target; dir.Normalize(); updateInfo.Target = origin.Target + dir * smoothDiff; }
public Vector3 GetEyePos(ref CameraUpdateInfo updateInfo) { return(updateInfo.At + updateInfo.LookatDir * updateInfo.Distance); }
public static void CalcDistance(float deltaTime, CamAdjustStock origin, CamAdjustStock prev, ref CameraUpdateInfo updateInfo, ref SmoothStock smooth) { if (prev.Stock.Distance == origin.Stock.Distance) { smooth.LifeTime = 0; return; } smooth.LifeTime += deltaTime; float elapsed = (float)smooth.LifeTime / smooth.PeriodTime; float difference = Mathf.Abs(prev.Stock.Distance - origin.Stock.Distance) / smooth.Value; float smoothDiff = GetSmoothValue(elapsed, difference, smooth.Power) * smooth.Value; if (smoothDiff == 0) { return; } if (prev.Stock.Distance > origin.Stock.Distance) { updateInfo.Distance = origin.Stock.Distance + smoothDiff; } else { updateInfo.Distance = origin.Stock.Distance - smoothDiff; } }
public Vector3 GetEyeArcPos(ref CameraUpdateInfo updateInfo) { Vector3 fEyePos = updateInfo.At + updateInfo.LookatDir * updateInfo.Distance; return(fEyePos); }
public Vector3 GetEyePos(ref CameraUpdateInfo updateInfo) { return(GetEyeArcPos(ref updateInfo)); }
public static void CalcDirection(float deltaTime, CamAdjustStock origin, CamAdjustStock prev, ref CameraUpdateInfo updateInfo, ref SmoothStock smooth) { Vector2 v2Difference = Vector2.zero; v2Difference.x = LEMath.RadianDistance(origin.Stock.Horizon, prev.Stock.Horizon); v2Difference.y = LEMath.RadianDistance(origin.Stock.Vertical, prev.Stock.Vertical); float difference = v2Difference.magnitude; if (difference == 0) { smooth.LifeTime = 0; return; } smooth.LifeTime += deltaTime; float elapsed = (float)smooth.LifeTime / smooth.PeriodTime; difference = difference / smooth.Value; float smoothDiff = GetSmoothValue(elapsed, difference, smooth.Power) * smooth.Value; if (smoothDiff == 0) { return; } Vector2 v2Result = v2Difference.normalized; v2Result = v2Result * (smoothDiff); updateInfo.Horizon = origin.Stock.Horizon + v2Result.x; updateInfo.Vertical = origin.Stock.Vertical + v2Result.y; }