解决相机抖动和人物移动动画不流畅的问题

This commit is contained in:
lishuo 2021-03-25 16:22:09 +08:00
parent 0ab0e99597
commit 42fa59d103
24 changed files with 154640 additions and 457 deletions

View File

@ -3,6 +3,7 @@
using System.Collections;
using Assets.Scenes.Ride.Scripts;
using Assets.Scripts.Apis;
using Assets.Scripts.Apis.Models;
using Mapbox.Unity.Location;
using UnityEngine;
@ -30,17 +31,13 @@
{
_locationProvider.OnLocationUpdated -= LocationProvider_OnLocationUpdated;
//_map.Initialize(location.LatitudeLongitude, _map.AbsoluteZoom);
MapApi mapApi = new MapApi();
var result = mapApi.GetData(5492);
if (result != null)
var mainController = transform.parent.GetComponent<MainController>();
if (mainController != null)
{
//全局保存当前路线信息
GameManger.MapData = result;
//初始化map
var point = result.List[0].Point;
var point = mainController.GetCenterCoordinate();
_map.Initialize(new Utils.Vector2d(point[0], point[1]), _map.AbsoluteZoom);
//初始化人物 TODO
}
}
}

View File

@ -1,200 +1,560 @@
fileFormatVersion: 2
guid: a9ef7ffd83d84234882fdc972caef5fd
timeCreated: 1478463940
licenseType: Store
ModelImporter:
serializedVersion: 19
fileIDToRecycleName:
100000: Back_Wheel
100002: Bike
100004: bk_handle
100006: bk_susp_child
100008: bk_susp_pare
100010: bk_suspention
100012: bk_wheel
100014: bk_wheel0
100016: body1
100018: Chest_J
100020: Cycle_body
100022: Cyclist_Lady
100024: Cyclist_Lady___cycle:Body_geo
100026: Cyclist_Lady___cycle:Eye_geo
100028: Cyclist_Lady___cycle:Gloves_geo
100030: Cyclist_Lady___cycle:Goggles_geo
100032: Cyclist_Lady___cycle:Hair_geo
100034: Cyclist_Lady___cycle:Hand_geo
100036: Cyclist_Lady___cycle:Hemet_geo
100038: Cyclist_Lady___cycle:Shoe_geo
100040: Cyclist_Lady_Character
100042: Front_Wheel
100044: FT_wheel_Ball
100046: ft_wheel_suspention
100048: handle
100050: joint2
100052: joint3
100054: //RootNode
100056: L_Ankle_J
100058: L_Arm_J
100060: L_Ball_J
100062: L_Clavicle_J
100064: L_Elbow_J
100066: L_Hip_J
100068: L_Index_01_J
100070: L_Index_02_J
100072: L_Index_03_J
100074: L_Knee_J
100076: L_Middle_01_J
100078: L_Middle_02_J
100080: L_Middle_03_J
100082: L_ProWrist_J
100084: L_Thumb_01_J
100086: L_Thumb_02_J
100088: L_Toe_J
100090: L_Wrist_J
100092: Neck_J
100094: pedal_J
100096: Peddle
100098: Pelvis_J
100100: R_Ankle_J
100102: R_Arm_J
100104: R_Ball_J
100106: R_Clavicle_J
100108: R_Elbow_J
100110: R_Hip_J
100112: R_Index_01_J
100114: R_Index_02_J
100116: R_Index_03_J
100118: R_Knee_J
100120: R_Middle_01_J
100122: R_Middle_02_J
100124: R_Middle_03_J
100126: R_ProWrist_J
100128: R_Thumb_01_J
100130: R_Thumb_02_J
100132: R_Toe_J
100134: R_Wrist_J
100136: Root_J
100138: Root_J 1
100140: Spline_01_J
100142: Spline_02_J
400000: Back_Wheel
400002: Bike
400004: bk_handle
400006: bk_susp_child
400008: bk_susp_pare
400010: bk_suspention
400012: bk_wheel
400014: bk_wheel0
400016: body1
400018: Chest_J
400020: Cycle_body
400022: Cyclist_Lady
400024: Cyclist_Lady___cycle:Body_geo
400026: Cyclist_Lady___cycle:Eye_geo
400028: Cyclist_Lady___cycle:Gloves_geo
400030: Cyclist_Lady___cycle:Goggles_geo
400032: Cyclist_Lady___cycle:Hair_geo
400034: Cyclist_Lady___cycle:Hand_geo
400036: Cyclist_Lady___cycle:Hemet_geo
400038: Cyclist_Lady___cycle:Shoe_geo
400040: Cyclist_Lady_Character
400042: Front_Wheel
400044: FT_wheel_Ball
400046: ft_wheel_suspention
400048: handle
400050: joint2
400052: joint3
400054: //RootNode
400056: L_Ankle_J
400058: L_Arm_J
400060: L_Ball_J
400062: L_Clavicle_J
400064: L_Elbow_J
400066: L_Hip_J
400068: L_Index_01_J
400070: L_Index_02_J
400072: L_Index_03_J
400074: L_Knee_J
400076: L_Middle_01_J
400078: L_Middle_02_J
400080: L_Middle_03_J
400082: L_ProWrist_J
400084: L_Thumb_01_J
400086: L_Thumb_02_J
400088: L_Toe_J
400090: L_Wrist_J
400092: Neck_J
400094: pedal_J
400096: Peddle
400098: Pelvis_J
400100: R_Ankle_J
400102: R_Arm_J
400104: R_Ball_J
400106: R_Clavicle_J
400108: R_Elbow_J
400110: R_Hip_J
400112: R_Index_01_J
400114: R_Index_02_J
400116: R_Index_03_J
400118: R_Knee_J
400120: R_Middle_01_J
400122: R_Middle_02_J
400124: R_Middle_03_J
400126: R_ProWrist_J
400128: R_Thumb_01_J
400130: R_Thumb_02_J
400132: R_Toe_J
400134: R_Wrist_J
400136: Root_J
400138: Root_J 1
400140: Spline_01_J
400142: Spline_02_J
4300000: Cyclist_Lady___cycle:Body_geo
4300002: Cyclist_Lady___cycle:Hair_geo
4300004: Cyclist_Lady___cycle:Goggles_geo
4300006: Cyclist_Lady___cycle:Eye_geo
4300008: Cyclist_Lady___cycle:Hemet_geo
4300010: Cyclist_Lady___cycle:Gloves_geo
4300012: Cyclist_Lady___cycle:Shoe_geo
4300014: Cyclist_Lady___cycle:Hand_geo
4300016: Front_Wheel
4300018: Back_Wheel
4300020: Peddle
4300022: Cycle_body
7400000: Take 001
9500000: //RootNode
13700000: Back_Wheel
13700002: Cycle_body
13700004: Cyclist_Lady___cycle:Body_geo
13700006: Cyclist_Lady___cycle:Eye_geo
13700008: Cyclist_Lady___cycle:Gloves_geo
13700010: Cyclist_Lady___cycle:Goggles_geo
13700012: Cyclist_Lady___cycle:Hair_geo
13700014: Cyclist_Lady___cycle:Hand_geo
13700016: Cyclist_Lady___cycle:Hemet_geo
13700018: Cyclist_Lady___cycle:Shoe_geo
13700020: Front_Wheel
13700022: Peddle
serializedVersion: 19301
internalIDToNameTable:
- first:
1: 100000
second: Back_Wheel
- first:
1: 100002
second: Bike
- first:
1: 100004
second: bk_handle
- first:
1: 100006
second: bk_susp_child
- first:
1: 100008
second: bk_susp_pare
- first:
1: 100010
second: bk_suspention
- first:
1: 100012
second: bk_wheel
- first:
1: 100014
second: bk_wheel0
- first:
1: 100016
second: body1
- first:
1: 100018
second: Chest_J
- first:
1: 100020
second: Cycle_body
- first:
1: 100022
second: Cyclist_Lady
- first:
1: 100024
second: Cyclist_Lady___cycle:Body_geo
- first:
1: 100026
second: Cyclist_Lady___cycle:Eye_geo
- first:
1: 100028
second: Cyclist_Lady___cycle:Gloves_geo
- first:
1: 100030
second: Cyclist_Lady___cycle:Goggles_geo
- first:
1: 100032
second: Cyclist_Lady___cycle:Hair_geo
- first:
1: 100034
second: Cyclist_Lady___cycle:Hand_geo
- first:
1: 100036
second: Cyclist_Lady___cycle:Hemet_geo
- first:
1: 100038
second: Cyclist_Lady___cycle:Shoe_geo
- first:
1: 100040
second: Cyclist_Lady_Character
- first:
1: 100042
second: Front_Wheel
- first:
1: 100044
second: FT_wheel_Ball
- first:
1: 100046
second: ft_wheel_suspention
- first:
1: 100048
second: handle
- first:
1: 100050
second: joint2
- first:
1: 100052
second: joint3
- first:
1: 100054
second: //RootNode
- first:
1: 100056
second: L_Ankle_J
- first:
1: 100058
second: L_Arm_J
- first:
1: 100060
second: L_Ball_J
- first:
1: 100062
second: L_Clavicle_J
- first:
1: 100064
second: L_Elbow_J
- first:
1: 100066
second: L_Hip_J
- first:
1: 100068
second: L_Index_01_J
- first:
1: 100070
second: L_Index_02_J
- first:
1: 100072
second: L_Index_03_J
- first:
1: 100074
second: L_Knee_J
- first:
1: 100076
second: L_Middle_01_J
- first:
1: 100078
second: L_Middle_02_J
- first:
1: 100080
second: L_Middle_03_J
- first:
1: 100082
second: L_ProWrist_J
- first:
1: 100084
second: L_Thumb_01_J
- first:
1: 100086
second: L_Thumb_02_J
- first:
1: 100088
second: L_Toe_J
- first:
1: 100090
second: L_Wrist_J
- first:
1: 100092
second: Neck_J
- first:
1: 100094
second: pedal_J
- first:
1: 100096
second: Peddle
- first:
1: 100098
second: Pelvis_J
- first:
1: 100100
second: R_Ankle_J
- first:
1: 100102
second: R_Arm_J
- first:
1: 100104
second: R_Ball_J
- first:
1: 100106
second: R_Clavicle_J
- first:
1: 100108
second: R_Elbow_J
- first:
1: 100110
second: R_Hip_J
- first:
1: 100112
second: R_Index_01_J
- first:
1: 100114
second: R_Index_02_J
- first:
1: 100116
second: R_Index_03_J
- first:
1: 100118
second: R_Knee_J
- first:
1: 100120
second: R_Middle_01_J
- first:
1: 100122
second: R_Middle_02_J
- first:
1: 100124
second: R_Middle_03_J
- first:
1: 100126
second: R_ProWrist_J
- first:
1: 100128
second: R_Thumb_01_J
- first:
1: 100130
second: R_Thumb_02_J
- first:
1: 100132
second: R_Toe_J
- first:
1: 100134
second: R_Wrist_J
- first:
1: 100136
second: Root_J
- first:
1: 100138
second: Root_J 1
- first:
1: 100140
second: Spline_01_J
- first:
1: 100142
second: Spline_02_J
- first:
4: 400000
second: Back_Wheel
- first:
4: 400002
second: Bike
- first:
4: 400004
second: bk_handle
- first:
4: 400006
second: bk_susp_child
- first:
4: 400008
second: bk_susp_pare
- first:
4: 400010
second: bk_suspention
- first:
4: 400012
second: bk_wheel
- first:
4: 400014
second: bk_wheel0
- first:
4: 400016
second: body1
- first:
4: 400018
second: Chest_J
- first:
4: 400020
second: Cycle_body
- first:
4: 400022
second: Cyclist_Lady
- first:
4: 400024
second: Cyclist_Lady___cycle:Body_geo
- first:
4: 400026
second: Cyclist_Lady___cycle:Eye_geo
- first:
4: 400028
second: Cyclist_Lady___cycle:Gloves_geo
- first:
4: 400030
second: Cyclist_Lady___cycle:Goggles_geo
- first:
4: 400032
second: Cyclist_Lady___cycle:Hair_geo
- first:
4: 400034
second: Cyclist_Lady___cycle:Hand_geo
- first:
4: 400036
second: Cyclist_Lady___cycle:Hemet_geo
- first:
4: 400038
second: Cyclist_Lady___cycle:Shoe_geo
- first:
4: 400040
second: Cyclist_Lady_Character
- first:
4: 400042
second: Front_Wheel
- first:
4: 400044
second: FT_wheel_Ball
- first:
4: 400046
second: ft_wheel_suspention
- first:
4: 400048
second: handle
- first:
4: 400050
second: joint2
- first:
4: 400052
second: joint3
- first:
4: 400054
second: //RootNode
- first:
4: 400056
second: L_Ankle_J
- first:
4: 400058
second: L_Arm_J
- first:
4: 400060
second: L_Ball_J
- first:
4: 400062
second: L_Clavicle_J
- first:
4: 400064
second: L_Elbow_J
- first:
4: 400066
second: L_Hip_J
- first:
4: 400068
second: L_Index_01_J
- first:
4: 400070
second: L_Index_02_J
- first:
4: 400072
second: L_Index_03_J
- first:
4: 400074
second: L_Knee_J
- first:
4: 400076
second: L_Middle_01_J
- first:
4: 400078
second: L_Middle_02_J
- first:
4: 400080
second: L_Middle_03_J
- first:
4: 400082
second: L_ProWrist_J
- first:
4: 400084
second: L_Thumb_01_J
- first:
4: 400086
second: L_Thumb_02_J
- first:
4: 400088
second: L_Toe_J
- first:
4: 400090
second: L_Wrist_J
- first:
4: 400092
second: Neck_J
- first:
4: 400094
second: pedal_J
- first:
4: 400096
second: Peddle
- first:
4: 400098
second: Pelvis_J
- first:
4: 400100
second: R_Ankle_J
- first:
4: 400102
second: R_Arm_J
- first:
4: 400104
second: R_Ball_J
- first:
4: 400106
second: R_Clavicle_J
- first:
4: 400108
second: R_Elbow_J
- first:
4: 400110
second: R_Hip_J
- first:
4: 400112
second: R_Index_01_J
- first:
4: 400114
second: R_Index_02_J
- first:
4: 400116
second: R_Index_03_J
- first:
4: 400118
second: R_Knee_J
- first:
4: 400120
second: R_Middle_01_J
- first:
4: 400122
second: R_Middle_02_J
- first:
4: 400124
second: R_Middle_03_J
- first:
4: 400126
second: R_ProWrist_J
- first:
4: 400128
second: R_Thumb_01_J
- first:
4: 400130
second: R_Thumb_02_J
- first:
4: 400132
second: R_Toe_J
- first:
4: 400134
second: R_Wrist_J
- first:
4: 400136
second: Root_J
- first:
4: 400138
second: Root_J 1
- first:
4: 400140
second: Spline_01_J
- first:
4: 400142
second: Spline_02_J
- first:
43: 4300000
second: Cyclist_Lady___cycle:Body_geo
- first:
43: 4300002
second: Cyclist_Lady___cycle:Hair_geo
- first:
43: 4300004
second: Cyclist_Lady___cycle:Goggles_geo
- first:
43: 4300006
second: Cyclist_Lady___cycle:Eye_geo
- first:
43: 4300008
second: Cyclist_Lady___cycle:Hemet_geo
- first:
43: 4300010
second: Cyclist_Lady___cycle:Gloves_geo
- first:
43: 4300012
second: Cyclist_Lady___cycle:Shoe_geo
- first:
43: 4300014
second: Cyclist_Lady___cycle:Hand_geo
- first:
43: 4300016
second: Front_Wheel
- first:
43: 4300018
second: Back_Wheel
- first:
43: 4300020
second: Peddle
- first:
43: 4300022
second: Cycle_body
- first:
74: 7400000
second: Take 001
- first:
95: 9500000
second: //RootNode
- first:
137: 13700000
second: Back_Wheel
- first:
137: 13700002
second: Cycle_body
- first:
137: 13700004
second: Cyclist_Lady___cycle:Body_geo
- first:
137: 13700006
second: Cyclist_Lady___cycle:Eye_geo
- first:
137: 13700008
second: Cyclist_Lady___cycle:Gloves_geo
- first:
137: 13700010
second: Cyclist_Lady___cycle:Goggles_geo
- first:
137: 13700012
second: Cyclist_Lady___cycle:Hair_geo
- first:
137: 13700014
second: Cyclist_Lady___cycle:Hand_geo
- first:
137: 13700016
second: Cyclist_Lady___cycle:Hemet_geo
- first:
137: 13700018
second: Cyclist_Lady___cycle:Shoe_geo
- first:
137: 13700020
second: Front_Wheel
- first:
137: 13700022
second: Peddle
externalObjects:
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: Cyclist_Lady___cycle_Body_face_t
second: {fileID: 2100000, guid: 6f41f21cb888a3f4ab4b29fcfcb6bb92, type: 2}
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: Cyclist_Lady___cycle_Helmet_gloves_Shoe_t
second: {fileID: 2100000, guid: 0c2661f2c8dd64c46bef90c24ec4494f, type: 2}
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: lambert7
second: {fileID: 2100000, guid: 9ff8084f124c39d44a9e1780ac962de6, type: 2}
materials:
importMaterials: 1
materialImportMode: 1
materialName: 0
materialSearch: 1
materialLocation: 0
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleRotations: 1
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 1
meshes:
@ -202,13 +562,24 @@ ModelImporter:
globalScale: 100
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 0
importBlendShapes: 1
importCameras: 0
importLights: 0
fileIdsGeneration: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
meshOptimizationFlags: -1
indexFormat: 1
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
@ -218,9 +589,14 @@ ModelImporter:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 0
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 1
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
copyAvatar: 0
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
@ -230,11 +606,16 @@ ModelImporter:
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 100
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 0
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 1
additionalBone: 0
userData:
assetBundleName:

View File

@ -91,7 +91,7 @@ AnimatorController:
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
@ -149,9 +149,9 @@ AnimatorStateTransition:
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.85
m_TransitionDuration: 0.5
m_TransitionOffset: 1
m_ExitTime: 0.55
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0

Binary file not shown.

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 0aad4008283f74840874ef6ae0689bb1
guid: 92eed9e6a7567014cbeb4734a30aed4c
PluginImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -0,0 +1,309 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &101672080862330073
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7761026574138318944}
- component: {fileID: 7165679808791333393}
- component: {fileID: 6299565490711348546}
m_Layer: 5
m_Name: KM
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7761026574138318944
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 101672080862330073}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7514989931928351906}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 29.81, y: -9.3261}
m_SizeDelta: {x: 169.97388, y: 17.070679}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7165679808791333393
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 101672080862330073}
m_CullTransparentMesh: 0
--- !u!114 &6299565490711348546
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 101672080862330073}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.4403852, g: 0.42021182, b: 0.6698113, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 274M
--- !u!1 &1794407370506177933
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1794346583297805855}
- component: {fileID: 5602144471571144168}
- component: {fileID: 452470150458396629}
m_Layer: 5
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1794346583297805855
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1794407370506177933}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7514989931928351906}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -88.3, y: 0.000045776}
m_SizeDelta: {x: 36.461792, y: 35.7229}
m_Pivot: {x: 0.49999994, y: 0.50000083}
--- !u!222 &5602144471571144168
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1794407370506177933}
m_CullTransparentMesh: 0
--- !u!114 &452470150458396629
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1794407370506177933}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: c2103bdd982e845a0a07bc8ee6649a17, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &7388744231024804703
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2841808725324015142}
- component: {fileID: 2200794857056963190}
- component: {fileID: 4051700012431780998}
m_Layer: 5
m_Name: Name
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2841808725324015142
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7388744231024804703}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7514989931928351906}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 29.81, y: 8.5353}
m_SizeDelta: {x: 169.97388, y: 17.070679}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2200794857056963190
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7388744231024804703}
m_CullTransparentMesh: 0
--- !u!114 &4051700012431780998
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7388744231024804703}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.08868442, g: 0.06719472, b: 0.09433961, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Alan Wood
--- !u!1 &7514989931928351907
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7514989931928351906}
- component: {fileID: 7514989931928351904}
- component: {fileID: 7514989931928351905}
m_Layer: 5
m_Name: PlayerInfo
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7514989931928351906
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7514989931928351907}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1794346583297805855}
- {fileID: 2841808725324015142}
- {fileID: 7761026574138318944}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 449.1, y: 175.45998}
m_SizeDelta: {x: -912.6111, y: -603.00726}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7514989931928351904
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7514989931928351907}
m_CullTransparentMesh: 0
--- !u!114 &7514989931928351905
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7514989931928351907}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.392}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b85adb9fdb028f54aa5426489cd2588c
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: 941b43407750edb46a7532221b274dfd
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -1,40 +0,0 @@
using GeoJSON.Net.Geometry;
using Mapbox.Utils;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using TurfCS;
using UnityEngine.Networking;
using Assets.Scripts.Apis.Models;
namespace Assets.Scenes.Ride.Scripts
{
public static class GameManger
{
public static double totaldistance;
public static List<Vector2d> vl;
public static int routeId;
public static bool IsStart = true;
public static MapDataModel MapData;
//记录当前游戏一些全局数据
public static Vector2d Along(double distance)
{
if (MapData != null)
{
var list = MapData.List.Select(p => new GeoJSON.Net.Geometry.GeographicPosition(p.Point[0], p.Point[1]));
LineString lineString = new LineString(list);
var pt1 = Turf.Along(lineString, distance);
var ll = ((GeographicPosition)((GeoJSON.Net.Geometry.Point)pt1.Geometry).Coordinates);
return new Vector2d(ll.Latitude, ll.Longitude);
}
return new Vector2d(0, 0);
}
}
}

View File

@ -6,6 +6,28 @@ namespace Assets.Scenes.Ride.Scripts
{
public class Helper
{
public static string FormatTicks(int seconds)
{
int h, m, s;
h = seconds / 3600;
m = (seconds - (3600 * h)) / 60;
s = seconds - (3600 * h + 60 * m);
string H, M, S;
H = M = S = string.Empty;
if (h < 10)
H = "0" + h;
else
H = h.ToString();
if (m < 10)
M = "0" + m;
else
M = m.ToString();
if (s < 10)
S = "0" + s;
else
S = s.ToString();
return $"{H}:{M}:{S}";
}
/// <summary>
/// 计算速度
/// 参考 http://bikecalculator.com/index.html

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ec3c835a32499e84e8d2f93d713d461a
guid: 904fddf6d736a004a969cdfa63f14076
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -4,6 +4,13 @@ using Mapbox.Unity.Map;
using Mapbox.Utils;
using Assets.Scripts.Apis.Models;
using static Assets.Scripts.Apis.Models.MapDataModel;
using System;
using Random = UnityEngine.Random;
using Assets.Scripts.Apis;
using GeoJSON.Net.Geometry;
using TurfCS;
using System.Linq;
using System.Collections.Generic;
namespace Assets.Scenes.Ride.Scripts
{
@ -13,106 +20,177 @@ namespace Assets.Scenes.Ride.Scripts
[SerializeField]
GameObject character;
[SerializeField]
float characterSpeed;
[SerializeField]
Animator characterAnimator;
[SerializeField]
AbstractMap map;
Vector3 nextPos;
#region
Vector3 nextPos;
Vector3 prePos;
private Vector2d currentlatlong; //当前坐标
private Vector2d nextlatlong; //下一个点的坐标
private double totalDistance;
private int ticks;//秒数
public float timer = 1.0f;//计时器
Vector2d currentlatlong; //当前坐标
Vector2d nextlatlong; //下一个点的坐标
float timer = 1.0f;//计时器
#endregion
#region
bool isStart;
MapDataModel mapData;
int userId;
double speed;
double power;
double gradev;
double elevation;
double cadance;
double heartRate;
int ticks;
double totalDistance;
double currentSlope;
double nextSlope;
double nextSlopeDistance;
double distance;
public int UserId { get => userId; }
public bool IsStart { get => isStart; }
public double Speed { get => speed; }
public double Power { get => power; }
public double Cadance { get => cadance; }
public double HeartRate { get => heartRate; }
public int TotalTicks { get => ticks; }
public double TotalDistance { get => totalDistance; }
public double CurrentSlope { get => currentSlope; }
public double NextSlope { get => nextSlope;}
public double NextSlopeDistance { get => nextSlopeDistance; }
public double Gradev { get => gradev; }
public double Elevation { get => elevation; }
#endregion
void Start()
{
characterAnimator = GetComponentInChildren<Animator>();
InitializePlayer();
var mainController = transform.parent.GetComponent<MainController>();
mapData = mainController.GetMapData();//获取路书信息
InitializePlayer(mainController.GetCenterCoordinate());//初始人物
}
//初始化人物
void InitializePlayer()
{
//获取玩家初始距离
currentlatlong = map.WorldToGeoPosition(transform.localPosition);
nextlatlong = currentlatlong;
totalDistance = 0;
ticks = 0;
}
void Update()
{
timer -= Time.deltaTime;
if (timer <= 0 && GameManger.IsStart)//定时器
if (timer <= 0)//定时器 一秒执行一次
{
ticks++;
Riding();
Run();
timer = 1.0f;
}
}
//计算当前玩家高度和坡度
Item find(double totalDistance)
#region
//当前人物骑行状态 true 开始 false 暂停
public void SetStart(bool start)
{
isStart = start;
}
//初始化玩家距离/朝向
void InitializePlayer(double[] coordinates)
{
ticks = 0;//当前骑行时间
//初始化人物位置
totalDistance = 10;//TODO:根据骑行模式动态取值
currentlatlong = Along(totalDistance);//new Vector2d(coordinates[0], coordinates[1]);//当前坐标
nextlatlong = currentlatlong;//下一秒坐标
////初始化人物转向
//var secondPlace = mapData.List[10].Point;
//var secondVect3d = map.GeoToWorldPosition( new Vector2d(secondPlace[0], secondPlace[1]));
//Quaternion firstRotation = Quaternion.LookRotation(transform.localPosition - secondVect3d);
//character.transform.rotation = Quaternion.Euler(0, firstRotation.eulerAngles.y, 0);
}
//骑行中
void Run()
{
if (IsStart)
{
//CamControl();
ComputeMapData();//计算海拔&坡度&下一个点信息
power = 300;//功率
speed = Helper.CalculateSpeed(elevation, gradev, power, 65, 7);
distance = Math.Round(speed / 3600, 5);
totalDistance += distance;
characterAnimator.SetBool("IsRide", false);//初始化动画状态
if (totalDistance <= mapData.TotalDistance)
{
ticks++;
if (distance > 0)
{
characterAnimator.SetBool("IsRide", true);//开始移动动画
nextlatlong = Along(totalDistance);//下一个坐标
nextPos = map.GeoToWorldPosition(nextlatlong);//下一个点
prePos = transform.localPosition;//当前点
StartCoroutine(LookAtNextPos());//转向
StartCoroutine(MoveTo());//移动
}
}
else
{
//TODO保存骑行数据
}
}
else
{
characterAnimator.SetBool("IsRide", false);
}
}
//TODO骑行结束
void Finish()
{
//MapInterruptRecordApi api = new MapInterruptRecordApi();
//api.Add(null, null);
}
#endregion
#region
//当前距离所在的海拔/坡度/距离 下一个点的坡度以及剩余距离
void ComputeMapData()
{
double sumDistance = 0;
MapDataModel mapDataModel = GameManger.MapData;
foreach (var item in mapDataModel.List)
var pointList = mapData.List;
int index = 0;
for (int i = 0; i < pointList.Count; i++)
{
sumDistance += item.Distance;
if (totalDistance < sumDistance)
sumDistance += pointList[i].Distance;
if (totalDistance >= sumDistance)
{
return item;
index = i;
break;
}
}
return mapDataModel.List[0];
//计算当前海拔和坡度
elevation = pointList[index].Elevation;
gradev = pointList[index].Grade;
//计算下一个点的坡度和距离
int nextIndex = index == pointList.Count - 1 ? index : index + 1;
nextSlope = pointList[nextIndex].Grade;
nextSlopeDistance = sumDistance + pointList[nextIndex].Distance - totalDistance;
}
void Riding()
//根据距离计算坐标
Vector2d Along(double endDistance)
{
//yield return new WaitForSeconds(1.0f);
////读取当前速度以及骑行距离
MapDataModel mapDataModel = GameManger.MapData;
Item nextRange = find(totalDistance);
double elevation = nextRange.Elevation;
double gradev = nextRange.Grade;
double power = Random.Range(700, 2000);//TODO
double distance = Helper.CalculateSpeed(elevation, gradev, power, 65, 7) / 3600;
if (mapData != null)
{
var list = mapData.List.Select(p => new GeoJSON.Net.Geometry.GeographicPosition(p.Point[0], p.Point[1]));
LineString lineString = new LineString(list);
var pt1 = Turf.Along(lineString, endDistance);
var ll = ((GeographicPosition)((GeoJSON.Net.Geometry.Point)pt1.Geometry).Coordinates);
return new Vector2d(ll.Latitude, ll.Longitude);
}
return nextlatlong;
}
#endregion
characterAnimator.SetBool("IsRide", false);
totalDistance += distance;
if (totalDistance <= mapDataModel.TotalDistance)
{
if (distance > 0)
{
var v = GameManger.Along(totalDistance);
StartCoroutine(CamControl());
//设定动画状态
characterAnimator.SetBool("IsRide", true);
nextPos = map.GeoToWorldPosition(v);
prePos = transform.localPosition;
//转向
StartCoroutine(LookAtNextPos());
//移动
StartCoroutine(MoveTo());
}
}
}
IEnumerator MoveTo()
{
//让人物移动分点增加动画的流畅度
float t = 0;
while (t < 1)
{
t += Time.deltaTime;
Vector3 v = Vector3.Lerp(transform.localPosition, nextPos, t);
transform.localPosition = v;
yield return null;
}
}
#region Character : Rotation
IEnumerator LookAtNextPos()
#region
IEnumerator LookAtNextPos()
{
Quaternion neededRotation = Quaternion.LookRotation(transform.localPosition - nextPos);
Quaternion thisRotation = character.transform.localRotation;
@ -126,16 +204,30 @@ namespace Assets.Scenes.Ride.Scripts
yield return null;
}
}
//人物移动控制
IEnumerator MoveTo()
{
//让人物移动分点增加动画的流畅度
float t = 0;
while (t < 1)
{
t += Time.deltaTime;
Vector3 v = Vector3.Lerp(prePos, nextPos, t);
transform.localPosition = v;
yield return null;
}
}
#endregion
#region CameraControl
#region
[Header("CameraSettings")]
[SerializeField]
Camera cam;
Vector3 previousPos = Vector3.zero;
Vector3 deltaPos = Vector3.zero;
IEnumerator CamControl()
IEnumerator CamControl()//TODO 替换成cinemachine
{
if (cam != null)
{

View File

@ -26,6 +26,7 @@ namespace Assets.Scenes.Ride.Scripts
private int _counter;
GameObject _directionsGO;
MainController mainCotroller;
protected virtual void Awake()
{
@ -39,6 +40,7 @@ namespace Assets.Scenes.Ride.Scripts
public void Start()
{
mainCotroller = transform.parent.GetComponent<MainController>();
foreach (var modifier in MeshModifiers)
{
modifier.Initialize();
@ -66,14 +68,14 @@ namespace Assets.Scenes.Ride.Scripts
var meshData = new MeshData();
var dat = new List<Vector3>();
var mapData = GameManger.MapData;
var mapData = mainCotroller.GetMapData();
if (mapData != null)
{
foreach (var mapDataItem in mapData.List)
{
var point = mapDataItem.Point;
Vector3 item = _map.GeoToWorldPosition(new Vector2d(point[0], point[1]));
item.y += 0.4f;
item.y += 0.2f;
dat.Add(item);
}
var feat = new VectorFeatureUnity();

View File

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class StartGame : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1fb28883cdccb754f96b10ee3509d5ef
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,72 @@
using UnityEngine;
using UnityEngine.UI;
namespace Assets.Scenes.Ride.Scripts
{
public class UIManager : MonoBehaviour
{
[SerializeField]
Button startBtn;
[SerializeField]
Text speedTxt;
[SerializeField]
Text powerTxt;
[SerializeField]
Text timerTxt;
[SerializeField]
Text countDownTxt;
PlayerController playerController;
private float timeRemaining = 1f;
private int count = 0;
// Start is called before the first frame update
void Start()
{
startBtn.onClick.AddListener(StartRide);
}
private void StartRide()
{
playerController = transform.parent.Find("Player").GetComponent<PlayerController>();
//加个5秒钟倒计时
count = 5;
startBtn.gameObject.SetActive(false);
countDownTxt.gameObject.SetActive(true);
countDownTxt.text = count.ToString();
}
// Update is called once per frame
void Update()
{
if (playerController != null)
{
speedTxt.text = $"{playerController.Speed}";
powerTxt.text = $"{playerController.Power}";
timerTxt.text = Helper.FormatTicks(playerController.TotalTicks);
if (count > 0)
{
timeRemaining -= Time.deltaTime;
if (timeRemaining <= 0)//定时器
{
count--;
if (count == 0)
{
playerController.SetStart(true);
countDownTxt.gameObject.SetActive(false);
}
timeRemaining = 1.0f;
}
}
countDownTxt.text = count.ToString();
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 86aa3e408146cb248a4a5eff052ffdaa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TurfCS;
namespace Assets.Scripts.Apis.Models
{
@ -68,12 +69,14 @@ namespace Assets.Scripts.Apis.Models
private void CalcDistance()
{
//TODO:需要加上turfHelper
//for (int i = 0; i < _List.Count - 1; i++)
//{
// var value = TurfHelper.GetDistances(new double[] { _List[i].Point[1], _List[i].Point[0] }, new double[] { _List[i + 1].Point[1], _List[i + 1].Point[0] });
// _List[i].Distance = value;
//}
_List[0].Distance = 0;
for (int i = 1; i < _List.Count - 1; i++)
{
var pt1 = Turf.Point(new double[] { _List[i].Point[1], _List[i].Point[0] });
var pt2 = Turf.Point(new double[] { _List[i+1].Point[1], _List[i+1].Point[0] });
var value = Turf.Distance(pt1, pt2, "kilometers") * 1000;
_List[i].Distance = Math.Round(value, 2);
}
}
/// <summary>
/// 计算坡度数据

View File

@ -1,2 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages />
<packages>
<package id="Newtonsoft.Json" version="13.0.1" />
</packages>