コード例 #1
0
ファイル: TurnLeft.cs プロジェクト: junbao520/AndroidApp
        /// <summary>
        /// 检测转向灯
        /// </summary>
        protected override void LeftIndicatorCheck(IndicatorCheckState checkState)
        {
            //角度设置0时,不进行角度达到检测转向灯
            if (checkState == IndicatorCheckState.MidCheckAngle && Settings.TurnLeftAngle < 0.5)
            {
                return;
            }
            if (indicatorChecked)
            {
                return;
            }

            if (checkState == IndicatorCheckState.MidCheckAngle)
            {
                //设置了变道角度后
                if (CurrentAngle.IsValidAngle() &&
                    StartAngle.IsValidAngle() &&
                    !GeoHelper.IsBetweenDiffAngle(CurrentAngle, StartAngle, Settings.TurnLeftAngle))
                {
                    if (Settings.TurnLeftEndFlag)
                    {
                        stopDelayDistance = CurrentDistance;
                    }
                    CheckLeft();
                }
            }
            else if (checkState == IndicatorCheckState.StopCheck)
            {
                CheckLeft();
            }
        }
コード例 #2
0
        public void SetCameraBehind()
        {
            var rads = CurrentAngle.ToRads();

            var dir = new Vector3(0, (float)Math.Cos(rads), (float)Math.Sin(rads)) * CurrentDist;

            // transform by player rotation
            Camera.Dir = Vector3.Transform(dir, PhysicsObj.Position.Frame.Orientation.ToXna());
            Camera.Dir.Normalize();

            var lookAt = PhysicsObj.Position.GetWorldPos();

            lookAt.Z += PhysicsObj.GetHeight() / CurrentHeightFactor;

            // set camera position
            Camera.Position = lookAt - Camera.Dir;

            Camera.CreateLookAt();
        }