示例#1
0
        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);
        }
示例#2
0
        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;
        }
示例#3
0
        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);
            }
        }
示例#4
0
        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;
        }
示例#5
0
        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
        }
示例#6
0
        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();
        }
示例#7
0
        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);
        }
示例#8
0
        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);
        }
示例#9
0
 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);
 }
示例#10
0
        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;
            }
        }
示例#11
0
 public Vector3 GetEyePos(ref CameraUpdateInfo updateInfo)
 {
     return(m_curState.GetEyePos(ref updateInfo));
 }
示例#12
0
 public float GetDistance(CameraUpdateInfo updateInfo)
 {
     return(updateInfo.Distance);
 }
示例#13
0
 public float GetAdjustDistance(CameraUpdateInfo updateInfo)
 {
     return(m_curState.GetDistance(updateInfo));
 }
示例#14
0
        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;
        }
示例#15
0
 public Vector3 GetEyePos(ref CameraUpdateInfo updateInfo)
 {
     return(updateInfo.At + updateInfo.LookatDir * updateInfo.Distance);
 }
示例#16
0
        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;
            }
        }
示例#17
0
        public Vector3 GetEyeArcPos(ref CameraUpdateInfo updateInfo)
        {
            Vector3 fEyePos = updateInfo.At + updateInfo.LookatDir * updateInfo.Distance;

            return(fEyePos);
        }
示例#18
0
 public Vector3 GetEyePos(ref CameraUpdateInfo updateInfo)
 {
     return(GetEyeArcPos(ref updateInfo));
 }
示例#19
0
        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;
        }