共有 29 个文件被更改,包括 3316 次插入 和 805 次删除
-
6.gitignore
-
1001Assets/Prefabs/Vehicles/VehicleControl.prefab
-
362Assets/Scenes/MegaCity.unity
-
2Assets/UI/HUD/Tutorial.uxml
-
45Assets/UI/NetcodePanelStats/FiraCode-Regular SDF.asset
-
167Assets/Art/Textures/UI/AtlasUI.psd.meta
-
20Assets/Scripts/Authoring/Player/PlayerVehicleControllerAuthoring.cs
-
1Assets/Scripts/Components/Gameplay/Player/Input/PlayerVehicleInput.cs
-
2Assets/Scripts/Components/Gameplay/Vehicle/PlayerVehicleComponents.cs
-
25Assets/Scripts/Gameplay/Player/Jobs/PlayerVehicleJobs.cs
-
1Assets/Scripts/Gameplay/Player/PlayerVehicleInputSystem.cs
-
2ProjectSettings/ProjectSettings.asset
-
4ProjectSettings/ProjectVersion.txt
-
34ProjectSettings/VFXManager.asset
-
1001Assets/Art/Textures/UI/active.png
-
179Assets/Art/Textures/UI/active.png.meta
-
78Assets/Art/Textures/UI/inactive.png
-
179Assets/Art/Textures/UI/inactive.png.meta
-
9Assets/Scripts/Gameplay/UI/Animator.meta
-
39Assets/Scripts/Gameplay/UI/MonoBehaviours/HUD/HUDController.cs
-
11Assets/Scripts/Gameplay/UI/MonoBehaviours/HUD/HUDController.cs.meta
-
8Assets/StreamingAssets.meta
-
922Assets/Scripts/Gameplay/UI/Animator/UIAnimator.cs
-
12Assets/Scripts/Gameplay/UI/Animator/UIAnimator.cs.meta
-
11ProjectSettings/Packages/com.unity.learn.iet-framework/Settings.json
# Unity tutorial defaults |
|||
/Tutorial Defaults/ |
|||
InitCodeMarker |
|||
ProjectSettings/Packages/com.unity.learn.iet-framework/Settings.json |
|||
ProjectSettings/Packages/com.unity.learn.iet-framework/Settings.json |
|||
|
|||
# Plastic SCM |
|||
ignore.conf |
|||
.plastic |
1001
Assets/Prefabs/Vehicles/VehicleControl.prefab
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
m_ReflectionIntensity: 1 |
|||
m_CustomReflection: {fileID: 0} |
|||
m_Sun: {fileID: 0} |
|||
m_IndirectSpecularColor: {r: 1.9234728, g: 2.8316824, b: 4.6076746, a: 1} |
|||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} |
|||
m_UseRadianceAmbientProbe: 0 |
|||
--- !u!157 &3 |
|||
LightmapSettings: |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 67652974} |
|||
m_CullTransparentMesh: 1 |
|||
--- !u!1 &101724844 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 101724845} |
|||
m_Layer: 5 |
|||
m_Name: Accelerate |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &101724845 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 101724844} |
|||
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_ConstrainProportionsScale: 0 |
|||
m_Children: |
|||
- {fileID: 1672009427} |
|||
- {fileID: 1865256755} |
|||
m_Father: {fileID: 2004821409} |
|||
m_RootOrder: -1 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 1, y: 0} |
|||
m_AnchorMax: {x: 1, y: 0} |
|||
m_AnchoredPosition: {x: 0, y: 0} |
|||
m_SizeDelta: {x: 333, y: 300} |
|||
m_Pivot: {x: 1, y: 0} |
|||
--- !u!1 &107769877 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 103 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &1341785854 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 1341785855} |
|||
- component: {fileID: 1341785856} |
|||
m_Layer: 0 |
|||
m_Name: Animator |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!4 &1341785855 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1341785854} |
|||
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_ConstrainProportionsScale: 0 |
|||
m_Children: [] |
|||
m_Father: {fileID: 2013917104} |
|||
m_RootOrder: -1 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!114 &1341785856 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1341785854} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 9c4619afaa490b94c8c10fba9d87abe0, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
--- !u!1 &1350200980 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 100 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &1672009426 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 1672009427} |
|||
- component: {fileID: 1672009429} |
|||
- component: {fileID: 1672009428} |
|||
m_Layer: 5 |
|||
m_Name: Inactive |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &1672009427 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1672009426} |
|||
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_ConstrainProportionsScale: 0 |
|||
m_Children: [] |
|||
m_Father: {fileID: 101724845} |
|||
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: 0, y: 0} |
|||
m_SizeDelta: {x: 150, y: 150} |
|||
m_Pivot: {x: 0.5, y: 0.5} |
|||
--- !u!114 &1672009428 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1672009426} |
|||
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_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} |
|||
m_Maskable: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_Sprite: {fileID: 21300000, guid: a1248874c0de54396bbb4e767983ff6a, 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!222 &1672009429 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1672009426} |
|||
m_CullTransparentMesh: 1 |
|||
--- !u!1 &1676843609 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 16 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &1865256754 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 1865256755} |
|||
- component: {fileID: 1865256757} |
|||
- component: {fileID: 1865256756} |
|||
m_Layer: 5 |
|||
m_Name: Active |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &1865256755 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1865256754} |
|||
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_ConstrainProportionsScale: 0 |
|||
m_Children: [] |
|||
m_Father: {fileID: 101724845} |
|||
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: 0, y: 0} |
|||
m_SizeDelta: {x: 400, y: 400} |
|||
m_Pivot: {x: 0.5, y: 0.5} |
|||
--- !u!114 &1865256756 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1865256754} |
|||
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} |
|||
m_RaycastTarget: 1 |
|||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} |
|||
m_Maskable: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_Sprite: {fileID: 21300000, guid: 0cce836b8c7b74fb8b623e39ded56322, 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!222 &1865256757 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1865256754} |
|||
m_CullTransparentMesh: 1 |
|||
--- !u!1 &1918303625 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_EditorClassIdentifier: |
|||
messageText: {fileID: 319152601} |
|||
background: {fileID: 1729250206} |
|||
--- !u!1 &2004821408 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 2004821409} |
|||
- component: {fileID: 2004821412} |
|||
- component: {fileID: 2004821411} |
|||
- component: {fileID: 2004821410} |
|||
- component: {fileID: 2004821413} |
|||
m_Layer: 5 |
|||
m_Name: HUD(Legacy) |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &2004821409 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 2004821408} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 0, y: 0, z: 0} |
|||
m_ConstrainProportionsScale: 0 |
|||
m_Children: |
|||
- {fileID: 101724845} |
|||
m_Father: {fileID: 2013917104} |
|||
m_RootOrder: -1 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0, y: 0} |
|||
m_AnchorMax: {x: 0, y: 0} |
|||
m_AnchoredPosition: {x: 0, y: 0} |
|||
m_SizeDelta: {x: 0, y: 0} |
|||
m_Pivot: {x: 0, y: 0} |
|||
--- !u!114 &2004821410 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 2004821408} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_IgnoreReversedGraphics: 1 |
|||
m_BlockingObjects: 0 |
|||
m_BlockingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
--- !u!114 &2004821411 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 2004821408} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_UiScaleMode: 1 |
|||
m_ReferencePixelsPerUnit: 100 |
|||
m_ScaleFactor: 10 |
|||
m_ReferenceResolution: {x: 1920, y: 1080} |
|||
m_ScreenMatchMode: 0 |
|||
m_MatchWidthOrHeight: 0 |
|||
m_PhysicalUnit: 3 |
|||
m_FallbackScreenDPI: 96 |
|||
m_DefaultSpriteDPI: 96 |
|||
m_DynamicPixelsPerUnit: 1 |
|||
m_PresetInfoIsWorld: 0 |
|||
--- !u!223 &2004821412 |
|||
Canvas: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 2004821408} |
|||
m_Enabled: 1 |
|||
serializedVersion: 3 |
|||
m_RenderMode: 0 |
|||
m_Camera: {fileID: 0} |
|||
m_PlaneDistance: 100 |
|||
m_PixelPerfect: 0 |
|||
m_ReceivesEvents: 1 |
|||
m_OverrideSorting: 0 |
|||
m_OverridePixelPerfect: 0 |
|||
m_SortingBucketNormalizedSize: 0 |
|||
m_VertexColorAlwaysGammaSpace: 1 |
|||
m_AdditionalShaderChannelsFlag: 0 |
|||
m_UpdateRectTransformForStandalone: 0 |
|||
m_SortingLayerID: 0 |
|||
m_SortingOrder: 0 |
|||
m_TargetDisplay: 0 |
|||
--- !u!114 &2004821413 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 2004821408} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: b8a60a3d169414a878d80ab251cb0f74, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
accelerateInactive: {fileID: 1672009428} |
|||
accelerateActive: {fileID: 1865256756} |
|||
--- !u!1001 &2013917103 |
|||
PrefabInstance: |
|||
m_ObjectHideFlags: 0 |
|||
m_AddedGameObjects: |
|||
- targetCorrespondingSourceObject: {fileID: 7254134414196534391, guid: 54ffe74712b3d6c46b33b540b3890fcf, |
|||
type: 3} |
|||
insertIndex: 3 |
|||
addedObject: {fileID: 2004821409} |
|||
- targetCorrespondingSourceObject: {fileID: 7254134414196534391, guid: 54ffe74712b3d6c46b33b540b3890fcf, |
|||
type: 3} |
|||
insertIndex: -1 |
|||
addedObject: {fileID: 1027201886} |
|||
- targetCorrespondingSourceObject: {fileID: 7254134414196534391, guid: 54ffe74712b3d6c46b33b540b3890fcf, |
|||
type: 3} |
|||
insertIndex: -1 |
|||
addedObject: {fileID: 1279363443} |
|||
- targetCorrespondingSourceObject: {fileID: 7254134414196534391, guid: 54ffe74712b3d6c46b33b540b3890fcf, |
|||
type: 3} |
|||
insertIndex: -1 |
|||
addedObject: {fileID: 1341785855} |
|||
m_AddedComponents: [] |
|||
m_SourcePrefab: {fileID: 100100000, guid: 54ffe74712b3d6c46b33b540b3890fcf, type: 3} |
|||
--- !u!4 &2013917104 stripped |
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False"> |
|||
<ui:VisualElement name="tutorial-screen" style="background-color: rgba(0, 0, 0, 0.95); position: absolute; width: 100%; height: 100%; -unity-background-image-tint-color: rgb(255, 255, 255); align-items: center; justify-content: center; display: flex;"> |
|||
<ui:VisualElement name="VisualElement" style="background-color: rgba(0, 0, 0, 0); background-image: url('project://database/Assets/Art/Textures/UI/AtlasUI.psd?fileID=-2802337693578396967&guid=31e77ef23200a8842b3829370f52c886&type=3#controls'); width: 1600px; -unity-background-scale-mode: scale-to-fit; height: 800px;" /> |
|||
<ui:VisualElement name="VisualElement" style="background-color: rgba(0, 0, 0, 0); background-image: url('project://database/Assets/Art/Textures/UI/AtlasUI.psd?fileID=6325595110910027034&guid=31e77ef23200a8842b3829370f52c886&type=3#controls'); width: 1600px; -unity-background-scale-mode: scale-to-fit; height: 800px;" /> |
|||
<ui:Label tabindex="-1" text="Press any key to continue" name="click-anywhere-label" class="big-label-centered" style="font-size: 40px; opacity: 1; -unity-font-style: normal; color: rgb(233, 233, 233); -unity-font-definition: url('project://database/Assets/UI/Fonts/ChakraPetch-Medium%20SDF.asset?fileID=11400000&guid=f3103ff426df8704595bd7db20530273&type=2#ChakraPetch-Medium SDF'); -unity-font: url('project://database/Assets/UI/Fonts/ChakraPetch-Medium.ttf?fileID=12800000&guid=25f588e56b0a32d4ca3779fef2ecb271&type=3#ChakraPetch-Medium');" /> |
|||
</ui:VisualElement> |
|||
</ui:UXML> |
45
Assets/UI/NetcodePanelStats/FiraCode-Regular SDF.asset
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
serializedVersion: 2 |
|||
x: 4 |
|||
y: 4 |
|||
width: 2552 |
|||
width: 2553 |
|||
spriteID: 5b3e64251c238b84881d57d9c20537bd |
|||
spriteID: 59c04cac3ed8b47bc92d08393b8026ce |
|||
spriteBone: [] |
|||
spriteOutline: [] |
|||
vertices: [] |
|||
tessellationDetail: 0 |
|||
uvTransform: {x: 4, y: 4} |
|||
spritePosition: {x: 45, y: 1196} |
|||
spritePosition: {x: 44, y: 1196} |
|||
- name: "\u5F62\u72B6 1" |
|||
originalName: |
|||
pivot: {x: 0.5, y: 0.5} |
|||
alignment: 0 |
|||
border: {x: 0, y: 0, z: 0, w: 0} |
|||
rect: |
|||
serializedVersion: 2 |
|||
x: 4074 |
|||
y: 546 |
|||
width: 1 |
|||
height: 1 |
|||
spriteID: 304619eb522804de2894cdfcf0c78c43 |
|||
spriteBone: [] |
|||
spriteOutline: [] |
|||
vertices: [] |
|||
spritePhysicsOutline: [] |
|||
indices: |
|||
edges: [] |
|||
tessellationDetail: 0 |
|||
uvTransform: {x: 4074, y: 546} |
|||
spritePosition: {x: 0, y: 4096} |
|||
- name: life |
|||
originalName: |
|||
pivot: {x: 0.5, y: 0.5} |
|||
border: {x: 196, y: 263, z: 396, w: 268} |
|||
rect: |
|||
serializedVersion: 2 |
|||
x: 2564 |
|||
x: 2565 |
|||
y: 4 |
|||
width: 702 |
|||
height: 692 |
|||
indices: |
|||
edges: [] |
|||
tessellationDetail: 0 |
|||
uvTransform: {x: 2564, y: 4} |
|||
uvTransform: {x: 2565, y: 4} |
|||
spritePosition: {x: 2953, y: 2188} |
|||
- name: settings |
|||
originalName: |
|||
rect: |
|||
serializedVersion: 2 |
|||
x: 3885 |
|||
x: 3886 |
|||
y: 4 |
|||
width: 199 |
|||
height: 199 |
|||
indices: |
|||
edges: [] |
|||
tessellationDetail: 0 |
|||
uvTransform: {x: 3885, y: 4} |
|||
uvTransform: {x: 3886, y: 4} |
|||
spritePosition: {x: 993, y: 520} |
|||
- name: decoration |
|||
originalName: |
|||
border: {x: 0, y: 0, z: 0, w: 0} |
|||
rect: |
|||
serializedVersion: 2 |
|||
x: 3885 |
|||
x: 3886 |
|||
y: 211 |
|||
width: 177 |
|||
height: 177 |
|||
indices: |
|||
edges: [] |
|||
tessellationDetail: 0 |
|||
uvTransform: {x: 3885, y: 211} |
|||
uvTransform: {x: 3886, y: 211} |
|||
spritePosition: {x: 239, y: 523} |
|||
- name: Background |
|||
originalName: |
|||
border: {x: 0, y: 0, z: 0, w: 0} |
|||
rect: |
|||
serializedVersion: 2 |
|||
x: 4021 |
|||
x: 4022 |
|||
y: 473 |
|||
width: 65 |
|||
height: 65 |
|||
indices: |
|||
edges: [] |
|||
tessellationDetail: 0 |
|||
uvTransform: {x: 4021, y: 473} |
|||
uvTransform: {x: 4022, y: 473} |
|||
spritePosition: {x: 336, y: 2669} |
|||
- name: MadeWithUnity |
|||
originalName: |
|||
border: {x: 0, y: 0, z: 0, w: 0} |
|||
rect: |
|||
serializedVersion: 2 |
|||
x: 3987 |
|||
x: 3988 |
|||
y: 619 |
|||
width: 37 |
|||
height: 17 |
|||
indices: |
|||
edges: [] |
|||
tessellationDetail: 0 |
|||
uvTransform: {x: 3987, y: 619} |
|||
uvTransform: {x: 3988, y: 619} |
|||
spritePosition: {x: 774, y: 2310} |
|||
- name: decoration-7 |
|||
originalName: |
|||
rect: |
|||
serializedVersion: 2 |
|||
x: 4021 |
|||
x: 4022 |
|||
y: 396 |
|||
width: 69 |
|||
height: 69 |
|||
indices: |
|||
edges: [] |
|||
tessellationDetail: 0 |
|||
uvTransform: {x: 4021, y: 396} |
|||
uvTransform: {x: 4022, y: 396} |
|||
spritePosition: {x: 774, y: 2207} |
|||
- name: decoration-6 |
|||
originalName: |
|||
border: {x: 0, y: 0, z: 0, w: 0} |
|||
rect: |
|||
serializedVersion: 2 |
|||
x: 2564 |
|||
x: 2565 |
|||
y: 893 |
|||
width: 373 |
|||
height: 33 |
|||
indices: |
|||
edges: [] |
|||
tessellationDetail: 0 |
|||
uvTransform: {x: 2564, y: 893} |
|||
uvTransform: {x: 2565, y: 893} |
|||
spritePosition: {x: 917, y: 2191} |
|||
- name: decoration-4 |
|||
originalName: |
|||
border: {x: 0, y: 0, z: 0, w: 0} |
|||
rect: |
|||
serializedVersion: 2 |
|||
x: 3987 |
|||
x: 3988 |
|||
y: 594 |
|||
width: 38 |
|||
height: 17 |
|||
indices: |
|||
edges: [] |
|||
tessellationDetail: 0 |
|||
uvTransform: {x: 3987, y: 594} |
|||
uvTransform: {x: 3988, y: 594} |
|||
spritePosition: {x: 810, y: 2310} |
|||
- name: decoration-1 |
|||
originalName: |
|||
rect: |
|||
serializedVersion: 2 |
|||
x: 3274 |
|||
x: 3275 |
|||
y: 4 |
|||
width: 603 |
|||
height: 582 |
|||
indices: |
|||
edges: [] |
|||
tessellationDetail: 0 |
|||
uvTransform: {x: 3274, y: 4} |
|||
uvTransform: {x: 3275, y: 4} |
|||
spritePosition: {x: 1520, y: 2301} |
|||
- name: checkbox-sq-uncheck |
|||
originalName: |
|||
border: {x: 0, y: 0, z: 0, w: 0} |
|||
rect: |
|||
serializedVersion: 2 |
|||
x: 3885 |
|||
x: 3886 |
|||
y: 396 |
|||
width: 128 |
|||
height: 170 |
|||
indices: |
|||
edges: [] |
|||
tessellationDetail: 0 |
|||
uvTransform: {x: 3885, y: 396} |
|||
uvTransform: {x: 3886, y: 396} |
|||
spritePosition: {x: 80, y: 537} |
|||
- name: combobox |
|||
originalName: |
|||
rect: |
|||
serializedVersion: 2 |
|||
x: 3274 |
|||
x: 3275 |
|||
y: 794 |
|||
width: 664 |
|||
height: 132 |
|||
indices: |
|||
edges: [] |
|||
tessellationDetail: 0 |
|||
uvTransform: {x: 3274, y: 794} |
|||
uvTransform: {x: 3275, y: 794} |
|||
spritePosition: {x: 792, y: 2355} |
|||
- name: checkbox-sq |
|||
originalName: |
|||
rect: |
|||
serializedVersion: 2 |
|||
x: 3946 |
|||
x: 3947 |
|||
y: 794 |
|||
width: 130 |
|||
height: 137 |
|||
indices: |
|||
edges: [] |
|||
tessellationDetail: 0 |
|||
uvTransform: {x: 3946, y: 794} |
|||
uvTransform: {x: 3947, y: 794} |
|||
spritePosition: {x: 178, y: 2624} |
|||
- name: checkbox-enable |
|||
originalName: |
|||
border: {x: 0, y: 0, z: 0, w: 0} |
|||
rect: |
|||
serializedVersion: 2 |
|||
x: 3274 |
|||
x: 3275 |
|||
y: 594 |
|||
width: 705 |
|||
height: 192 |
|||
indices: |
|||
edges: [] |
|||
tessellationDetail: 0 |
|||
uvTransform: {x: 3274, y: 594} |
|||
uvTransform: {x: 3275, y: 594} |
|||
spritePosition: {x: 761, y: 2716} |
|||
- name: button |
|||
originalName: |
|||
rect: |
|||
serializedVersion: 2 |
|||
x: 2564 |
|||
x: 2565 |
|||
y: 704 |
|||
width: 691 |
|||
height: 181 |
|||
indices: |
|||
edges: [] |
|||
tessellationDetail: 0 |
|||
uvTransform: {x: 2564, y: 704} |
|||
uvTransform: {x: 2565, y: 704} |
|||
spritePosition: {x: 765, y: 2515} |
|||
- name: arrow |
|||
originalName: |
|||
rect: |
|||
serializedVersion: 2 |
|||
x: 4021 |
|||
x: 4022 |
|||
y: 546 |
|||
width: 44 |
|||
height: 24 |
|||
indices: |
|||
edges: [] |
|||
tessellationDetail: 0 |
|||
uvTransform: {x: 4021, y: 546} |
|||
uvTransform: {x: 4022, y: 546} |
|||
spritePosition: {x: 875, y: 2303} |
|||
rigSpriteImportData: |
|||
- name: Background |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
- name: Android |
|||
overridden: 0 |
|||
ignorePlatformSupport: 0 |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
- name: iPhone |
|||
overridden: 0 |
|||
ignorePlatformSupport: 0 |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
- name: WebGL |
|||
overridden: 0 |
|||
ignorePlatformSupport: 0 |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
mosaicLayers: 1 |
|||
characterMode: 0 |
|||
documentPivot: {x: 0, y: 0} |
|||
spriteName: controls |
|||
isGroup: 0 |
|||
parentIndex: -1 |
|||
spriteID: 5b3e64251c238b84881d57d9c20537bd |
|||
layerID: 471 |
|||
spriteID: 59c04cac3ed8b47bc92d08393b8026ce |
|||
layerID: 558 |
|||
- name: "\u5F62\u72B6 1" |
|||
spriteName: "\u5F62\u72B6 1" |
|||
isGroup: 0 |
|||
parentIndex: -1 |
|||
spriteID: 304619eb522804de2894cdfcf0c78c43 |
|||
layerID: 527 |
|||
mosaicPosition: {x: 4074, y: 546} |
|||
flatten: 0 |
|||
isImported: 1 |
|||
isVisible: 1 |
|||
- name: life |
|||
spriteName: life |
|||
isGroup: 0 |
|||
parentIndex: -1 |
|||
spriteID: 5829b2ee208ddae48a3e99341f364844 |
|||
layerID: 290 |
|||
mosaicPosition: {x: 2564, y: 4} |
|||
mosaicPosition: {x: 2565, y: 4} |
|||
flatten: 0 |
|||
isImported: 1 |
|||
isVisible: 1 |
|||
parentIndex: -1 |
|||
spriteID: 34096bb7faf11ed4e9b51eb1e4b1d9a7 |
|||
layerID: 377 |
|||
mosaicPosition: {x: 3885, y: 4} |
|||
mosaicPosition: {x: 3886, y: 4} |
|||
flatten: 0 |
|||
isImported: 1 |
|||
isVisible: 1 |
|||
parentIndex: -1 |
|||
spriteID: d5db8ed88ed311240a0d1d10bf8caac8 |
|||
layerID: 205 |
|||
mosaicPosition: {x: 3885, y: 211} |
|||
mosaicPosition: {x: 3886, y: 211} |
|||
flatten: 0 |
|||
isImported: 1 |
|||
isVisible: 1 |
|||
parentIndex: -1 |
|||
spriteID: 9f02a233b72681b4186919111c7746f1 |
|||
layerID: 25 |
|||
mosaicPosition: {x: 4021, y: 473} |
|||
mosaicPosition: {x: 4022, y: 473} |
|||
flatten: 0 |
|||
isImported: 1 |
|||
isVisible: 1 |
|||
parentIndex: -1 |
|||
spriteID: acc6504501532c64eb9db041181ac163 |
|||
layerID: 22 |
|||
mosaicPosition: {x: 3987, y: 619} |
|||
mosaicPosition: {x: 3988, y: 619} |
|||
flatten: 0 |
|||
isImported: 1 |
|||
isVisible: 1 |
|||
parentIndex: -1 |
|||
spriteID: 3f227ce5a5b9fdb4386091560519a02c |
|||
layerID: 21 |
|||
mosaicPosition: {x: 4021, y: 396} |
|||
mosaicPosition: {x: 4022, y: 396} |
|||
flatten: 0 |
|||
isImported: 1 |
|||
isVisible: 1 |
|||
parentIndex: -1 |
|||
spriteID: 3f44222d5b0141643957180acd8be166 |
|||
layerID: 234 |
|||
mosaicPosition: {x: 2564, y: 893} |
|||
mosaicPosition: {x: 2565, y: 893} |
|||
flatten: 0 |
|||
isImported: 1 |
|||
isVisible: 1 |
|||
parentIndex: -1 |
|||
spriteID: 210a59f432bca394d902f0673ba5bf05 |
|||
layerID: 16 |
|||
mosaicPosition: {x: 3987, y: 594} |
|||
mosaicPosition: {x: 3988, y: 594} |
|||
flatten: 0 |
|||
isImported: 1 |
|||
isVisible: 1 |
|||
parentIndex: -1 |
|||
spriteID: 69137aea8dfacbc4b90479da32b97d41 |
|||
layerID: 15 |
|||
mosaicPosition: {x: 3274, y: 4} |
|||
mosaicPosition: {x: 3275, y: 4} |
|||
flatten: 0 |
|||
isImported: 1 |
|||
isVisible: 1 |
|||
parentIndex: -1 |
|||
spriteID: 90e45248a2b5fb342bd81584f0755867 |
|||
layerID: 141 |
|||
mosaicPosition: {x: 3885, y: 396} |
|||
mosaicPosition: {x: 3886, y: 396} |
|||
flatten: 0 |
|||
isImported: 1 |
|||
isVisible: 1 |
|||
parentIndex: -1 |
|||
spriteID: 9618182518e16f441954a55bcbdac20a |
|||
layerID: 13 |
|||
mosaicPosition: {x: 3274, y: 794} |
|||
mosaicPosition: {x: 3275, y: 794} |
|||
flatten: 0 |
|||
isImported: 1 |
|||
isVisible: 1 |
|||
parentIndex: -1 |
|||
spriteID: d29aa595b4d7af14387a00c287614bfd |
|||
layerID: 11 |
|||
mosaicPosition: {x: 3946, y: 794} |
|||
mosaicPosition: {x: 3947, y: 794} |
|||
flatten: 0 |
|||
isImported: 1 |
|||
isVisible: 1 |
|||
parentIndex: -1 |
|||
spriteID: e855a4284654ed24790e1ff3e34b4682 |
|||
layerID: 8 |
|||
mosaicPosition: {x: 3274, y: 594} |
|||
mosaicPosition: {x: 3275, y: 594} |
|||
flatten: 0 |
|||
isImported: 1 |
|||
isVisible: 1 |
|||
parentIndex: -1 |
|||
spriteID: 7b424bdf04b16234e9e5d31ff8df836b |
|||
layerID: 7 |
|||
mosaicPosition: {x: 2564, y: 704} |
|||
mosaicPosition: {x: 2565, y: 704} |
|||
flatten: 0 |
|||
isImported: 1 |
|||
isVisible: 1 |
|||
parentIndex: -1 |
|||
spriteID: 589c2759a37a50241937a9340e5fa7de |
|||
layerID: 3 |
|||
mosaicPosition: {x: 4021, y: 546} |
|||
mosaicPosition: {x: 4022, y: 546} |
|||
flatten: 0 |
|||
isImported: 1 |
|||
isVisible: 1 |
{ |
|||
[Header("Speed")] |
|||
public float MaxSpeed = 50.0f; |
|||
public float Acceleration = 5.0f; |
|||
public float Deceleration = 10.0f; |
|||
public float SteeringSpeed = 5.0f; |
|||
public float Acceleration = 20.0f; |
|||
public float Deceleration = 25.0f; |
|||
public float SteeringSpeed = 1.8f; |
|||
[Header("Boost")] |
|||
public float BoostMaxSpeed = 100.0f; |
|||
public float BoostAcceleration = 100.0f; |
|||
|
|||
[Header("Cosmetic Yaw")] |
|||
public float MaxYawAngle = 45.0f; |
|||
public float YawKickBack = 2.0f; |
|||
public AnimationCurve PitchVolatilityCurve = new(); |
|||
|
|||
[Header("Cosmetic Roll")] |
|||
public float ManualRollMaxSpeed = 4.0f; |
|||
public float ManualRollAcceleration = 0.5f; |
|||
public float RollAutoLevelVelocity = 5.0f; |
|||
public float ManualRollMaxSpeed = 3.0f; |
|||
public float ManualRollAcceleration = 0.1f; |
|||
public float RollAutoLevelVelocity = 10.0f; |
|||
|
|||
[Header("Cosmetic Banking")] |
|||
public float MaxBankAngle = 45.0f; |
|||
public float ForwardOffset = 5f; |
|||
public float LaserLength = 100f; |
|||
public float InitialEnergy = 100f; |
|||
public float ChargeSpeed = 2.5f; |
|||
public float ChargeSpeed = 16f; |
|||
|
|||
[Header("Immunity")] |
|||
public float ImmunityTickAmount = 600.0f; |
|||
// Add vehicle settings component
|
|||
var settings = new PlayerVehicleSettings |
|||
{ |
|||
BoostAcceleration = authoring.BoostAcceleration, |
|||
BoostMaxSpeed = authoring.BoostMaxSpeed, |
|||
Acceleration = authoring.Acceleration, |
|||
Deceleration = authoring.Deceleration, |
|||
MaxSpeed = authoring.MaxSpeed, |
public float RightRoll; // manual roll to right
|
|||
public float LeftRoll; // manual roll to left
|
|||
public bool Shoot; // Shoot laser (X or A)
|
|||
public bool Boost; // Boost (Shift)
|
|||
|
|||
// Cheats
|
|||
public bool Cheat_1; // Autohurt
|
/// </summary>
|
|||
public struct PlayerVehicleSettings : IComponentData |
|||
{ |
|||
public float BoostAcceleration; |
|||
public float BoostMaxSpeed; |
|||
public float Acceleration; |
|||
public float Deceleration; |
|||
public float MaxSpeed; |
ref VehicleThrust vehicleThrust, |
|||
ref PhysicsDamping damping) |
|||
{ |
|||
vehicleThrust.Thrust += vehicleSettings.Acceleration * deltaTime * controlInput.Acceleration; |
|||
vehicleThrust.Thrust += (controlInput.Boost ? vehicleSettings.BoostAcceleration : vehicleSettings.Acceleration) * deltaTime * controlInput.Acceleration; |
|||
|
|||
if (controlInput.Brake > 0) |
|||
{ |
|||
damping.Linear = vehicleSettings.Damping.Linear; |
|||
} |
|||
|
|||
var maxThrust = vehicleSettings.MaxSpeed * controlInput.Acceleration; |
|||
var maxThrust = (controlInput.Boost ? vehicleSettings.BoostMaxSpeed : vehicleSettings.MaxSpeed) * controlInput.Acceleration; |
|||
|
|||
if (math.abs(vehicleThrust.Thrust) > math.abs(maxThrust)) |
|||
{ |
|||
vehicleThrust.Thrust = maxThrust; |
|||
var newRotation = math.mul(math.mul(localTransform.Rotation, xRotation), yRotation); |
|||
localTransform.Rotation = math.slerp(localTransform.Rotation, newRotation, DeltaTime * vehicleSettings.SteeringSpeed); |
|||
|
|||
velocity.Linear += localToWorld.Forward * vehicleThrust.Thrust * DeltaTime * mass.InverseMass; |
|||
// Check for boost
|
|||
// float speedMultiplier = controlInput.Boost ? 2.0f : 1.0f; // 2 times speed when boosting
|
|||
if (math.lengthsq(velocity.Linear) > vehicleSettings.MaxSpeed * vehicleSettings.MaxSpeed) |
|||
// Modify thrust based on boost
|
|||
velocity.Linear += localToWorld.Forward * vehicleThrust.Thrust * DeltaTime * mass.InverseMass; // * speedMultiplier;
|
|||
|
|||
// Optionally, limit max speed when boosting
|
|||
float maxPossibleSpeed = controlInput.Boost ? vehicleSettings.BoostMaxSpeed : vehicleSettings.MaxSpeed; |
|||
|
|||
if (math.lengthsq(velocity.Linear) > maxPossibleSpeed * maxPossibleSpeed) |
|||
velocity.Linear = math.normalize(velocity.Linear) * vehicleSettings.MaxSpeed; |
|||
velocity.Linear = math.normalize(velocity.Linear) * maxPossibleSpeed; |
|||
|
|||
/* velocity.Linear += localToWorld.Forward * vehicleThrust.Thrust * DeltaTime * mass.InverseMass; |
|||
|
|||
if (math.lengthsq(velocity.Linear) > vehicleSettings.MaxSpeed * vehicleSettings.MaxSpeed) |
|||
{ |
|||
velocity.Linear = math.normalize(velocity.Linear) * vehicleSettings.MaxSpeed; |
|||
}*/ |
|||
|
|||
grav.Value = 0; |
|||
} |
GamepadDirection = new float3(Input.GetAxis("RightStickY") * invertVertical, |
|||
Input.GetAxis("RightStickX") * invertHorizontal, 0) * controlSettings.MouseSensitivity, |
|||
Shoot = Input.GetButton("Jump"), |
|||
Boost = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift), |
|||
#if DEVELOPMENT_BUILD || UNITY_EDITOR
|
|||
Cheat_1 = Input.GetKey(KeyCode.Alpha1) |
|||
#endif
|
platformArchitecture: {} |
|||
scriptingBackend: |
|||
Server: 1 |
|||
Standalone: 1 |
|||
Standalone: 0 |
|||
il2cppCompilerConfiguration: |
|||
Server: 2 |
|||
Standalone: 2 |
m_EditorVersion: 2022.3.3f1c1 |
|||
m_EditorVersionWithRevision: 2022.3.3f1c1 (52938cbb626d) |
|||
m_EditorVersion: 2022.3.3f1c1 |
|||
m_EditorVersionWithRevision: 2022.3.3f1c1 (52938cbb626d) |
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!937362698 &1 |
|||
VFXManager: |
|||
m_ObjectHideFlags: 0 |
|||
m_IndirectShader: {fileID: 7200000, guid: 84a17cfa13e40ae4082ef42714f0a81c, type: 3} |
|||
m_CopyBufferShader: {fileID: 7200000, guid: 23c51f21a3503f6428b527b01f8a2f4e, type: 3} |
|||
m_SortShader: {fileID: 7200000, guid: ea257ca3cfb12a642a5025e612af6b2a, type: 3} |
|||
m_StripUpdateShader: {fileID: 7200000, guid: 8fa6c4009fe2a4d4486c62736fc30ad8, type: 3} |
|||
m_RenderPipeSettingsPath: |
|||
m_FixedTimeStep: 0.016666668 |
|||
m_MaxDeltaTime: 0.05 |
|||
m_MaxScrubTime: 30 |
|||
m_CompiledVersion: 7 |
|||
m_RuntimeVersion: 33 |
|||
m_RuntimeResources: {fileID: 11400000, guid: bc10b42afe3813544bffd38ae2cd893d, type: 2} |
|||
m_BatchEmptyLifetime: 300 |
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!937362698 &1 |
|||
VFXManager: |
|||
m_ObjectHideFlags: 0 |
|||
m_IndirectShader: {fileID: 7200000, guid: 84a17cfa13e40ae4082ef42714f0a81c, type: 3} |
|||
m_CopyBufferShader: {fileID: 7200000, guid: 23c51f21a3503f6428b527b01f8a2f4e, type: 3} |
|||
m_SortShader: {fileID: 7200000, guid: ea257ca3cfb12a642a5025e612af6b2a, type: 3} |
|||
m_StripUpdateShader: {fileID: 7200000, guid: 8fa6c4009fe2a4d4486c62736fc30ad8, type: 3} |
|||
m_RenderPipeSettingsPath: |
|||
m_FixedTimeStep: 0.016666668 |
|||
m_MaxDeltaTime: 0.05 |
|||
m_MaxScrubTime: 30 |
|||
m_CompiledVersion: 7 |
|||
m_RuntimeVersion: 33 |
|||
m_RuntimeResources: {fileID: 11400000, guid: bc10b42afe3813544bffd38ae2cd893d, type: 2} |
|||
m_BatchEmptyLifetime: 300 |
1001
Assets/Art/Textures/UI/active.png
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
fileFormatVersion: 2 |
|||
guid: 0cce836b8c7b74fb8b623e39ded56322 |
|||
TextureImporter: |
|||
internalIDToNameTable: [] |
|||
externalObjects: {} |
|||
serializedVersion: 12 |
|||
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 |
|||
flipGreenChannel: 0 |
|||
isReadable: 0 |
|||
streamingMipmaps: 0 |
|||
streamingMipmapsPriority: 0 |
|||
vTOnly: 0 |
|||
ignoreMipmapLimit: 0 |
|||
grayScaleToAlpha: 0 |
|||
generateCubemap: 6 |
|||
cubemapConvolution: 0 |
|||
seamlessCubemap: 0 |
|||
textureFormat: 1 |
|||
maxTextureSize: 2048 |
|||
textureSettings: |
|||
serializedVersion: 2 |
|||
filterMode: 1 |
|||
aniso: 4 |
|||
mipBias: -1 |
|||
wrapU: 1 |
|||
wrapV: 1 |
|||
wrapW: 0 |
|||
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 |
|||
flipbookRows: 1 |
|||
flipbookColumns: 1 |
|||
maxTextureSizeSet: 0 |
|||
compressionQualitySet: 0 |
|||
textureFormatSet: 0 |
|||
ignorePngGamma: 0 |
|||
applyGammaDecoding: 0 |
|||
swizzle: 50462976 |
|||
cookieLightType: 0 |
|||
platformSettings: |
|||
- serializedVersion: 3 |
|||
buildTarget: DefaultTexturePlatform |
|||
maxTextureSize: 8192 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
ignorePlatformSupport: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: Standalone |
|||
maxTextureSize: 8192 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
ignorePlatformSupport: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: iPhone |
|||
maxTextureSize: 8192 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
ignorePlatformSupport: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: Android |
|||
maxTextureSize: 8192 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
ignorePlatformSupport: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: Windows Store Apps |
|||
maxTextureSize: 8192 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
ignorePlatformSupport: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: Server |
|||
maxTextureSize: 8192 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
ignorePlatformSupport: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: WebGL |
|||
maxTextureSize: 8192 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
ignorePlatformSupport: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
physicsShape: [] |
|||
bones: [] |
|||
spriteID: 5e97eb03825dee720800000000000000 |
|||
internalID: 0 |
|||
vertices: [] |
|||
indices: |
|||
edges: [] |
|||
weights: [] |
|||
secondaryTextures: [] |
|||
nameFileIdTable: {} |
|||
mipmapLimitGroupName: |
|||
pSDRemoveMatte: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
fileFormatVersion: 2 |
|||
guid: a1248874c0de54396bbb4e767983ff6a |
|||
TextureImporter: |
|||
internalIDToNameTable: [] |
|||
externalObjects: {} |
|||
serializedVersion: 12 |
|||
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 |
|||
flipGreenChannel: 0 |
|||
isReadable: 0 |
|||
streamingMipmaps: 0 |
|||
streamingMipmapsPriority: 0 |
|||
vTOnly: 0 |
|||
ignoreMipmapLimit: 0 |
|||
grayScaleToAlpha: 0 |
|||
generateCubemap: 6 |
|||
cubemapConvolution: 0 |
|||
seamlessCubemap: 0 |
|||
textureFormat: 1 |
|||
maxTextureSize: 2048 |
|||
textureSettings: |
|||
serializedVersion: 2 |
|||
filterMode: 1 |
|||
aniso: 4 |
|||
mipBias: -1 |
|||
wrapU: 1 |
|||
wrapV: 1 |
|||
wrapW: 0 |
|||
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 |
|||
flipbookRows: 1 |
|||
flipbookColumns: 1 |
|||
maxTextureSizeSet: 0 |
|||
compressionQualitySet: 0 |
|||
textureFormatSet: 0 |
|||
ignorePngGamma: 0 |
|||
applyGammaDecoding: 0 |
|||
swizzle: 50462976 |
|||
cookieLightType: 0 |
|||
platformSettings: |
|||
- serializedVersion: 3 |
|||
buildTarget: DefaultTexturePlatform |
|||
maxTextureSize: 8192 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
ignorePlatformSupport: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: Standalone |
|||
maxTextureSize: 8192 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
ignorePlatformSupport: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: iPhone |
|||
maxTextureSize: 8192 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
ignorePlatformSupport: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: Android |
|||
maxTextureSize: 8192 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
ignorePlatformSupport: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: Windows Store Apps |
|||
maxTextureSize: 8192 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
ignorePlatformSupport: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: Server |
|||
maxTextureSize: 8192 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
ignorePlatformSupport: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: WebGL |
|||
maxTextureSize: 8192 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
ignorePlatformSupport: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
physicsShape: [] |
|||
bones: [] |
|||
spriteID: 5e97eb03825dee720800000000000000 |
|||
internalID: 0 |
|||
vertices: [] |
|||
indices: |
|||
edges: [] |
|||
weights: [] |
|||
secondaryTextures: [] |
|||
nameFileIdTable: {} |
|||
mipmapLimitGroupName: |
|||
pSDRemoveMatte: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
fileFormatVersion: 2 |
|||
guid: bb15bc296cf3b0640a2556673f196f63 |
|||
folderAsset: yes |
|||
timeCreated: 1494505850 |
|||
licenseType: Store |
|||
DefaultImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
using EasyUIAnimator; |
|||
using UnityEngine; |
|||
using UnityEngine.UI; |
|||
|
|||
namespace Unity.MegaCity.Gameplay |
|||
{ |
|||
public class HUDController : MonoBehaviour |
|||
{ |
|||
public Image accelerateInactive; |
|||
public Image accelerateActive; |
|||
private bool _accelerateStatus; |
|||
|
|||
private const float Duration = 0.3f; |
|||
// Update is called once per frame
|
|||
void LateUpdate() |
|||
{ |
|||
if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) |
|||
{ |
|||
if (!_accelerateStatus) |
|||
{ |
|||
// 按下加速,且之前非加速状态
|
|||
UIAnimator.FadeOut(accelerateInactive, Duration).Play(); |
|||
UIAnimator.FadeIn(accelerateActive, Duration).Play(); |
|||
_accelerateStatus = true; |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
if (_accelerateStatus) |
|||
{ |
|||
// 没按加速,且之前为加速状态
|
|||
UIAnimator.FadeOut(accelerateActive, Duration).Play(); |
|||
UIAnimator.FadeIn(accelerateInactive, Duration).Play(); |
|||
_accelerateStatus = false; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
fileFormatVersion: 2 |
|||
guid: b8a60a3d169414a878d80ab251cb0f74 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
fileFormatVersion: 2 |
|||
guid: 4406f49ad80a3b344b0b09cd094df68f |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
/* |
|||
* Copyright (c) 2017 Gabriel Reis e Silva |
|||
* |
|||
* Simplified it so that it doesn't throw exceptions. |
|||
* |
|||
* Permission is hereby granted, free of charge, to any person obtaining |
|||
* a copy of this software and associated documentation files (the |
|||
* "Software"), to deal in the Software without restriction, including |
|||
* without limitation the rights to use, copy, modify, merge, publish, |
|||
* distribute, sublicense, and/or sell copies of the Software, and to |
|||
* permit persons to whom the Software is furnished to do so, subject to |
|||
* the following conditions: |
|||
* |
|||
* The above copyright notice and this permission notice shall be |
|||
* included in all copies or substantial portions of the Software. |
|||
* |
|||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
|||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
|||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
|||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|||
*/ |
|||
|
|||
using UnityEngine; |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine.UI; |
|||
|
|||
namespace EasyUIAnimator |
|||
{ |
|||
/*! UI Animator |
|||
* Main class - private Singleton. |
|||
* |
|||
* Updatable in-game object, responsible |
|||
* for updating all animation. It holds |
|||
* an instance of each while animating. |
|||
*/ |
|||
[ExecuteInEditMode] |
|||
public class UIAnimator : MonoBehaviour { |
|||
private static UIAnimator instance; |
|||
private List<UIAnimation> animations; |
|||
private List<UIAnimation> removeList; |
|||
private Vector2 screenDimension; |
|||
private Vector2 invertedScreenDimension; |
|||
|
|||
private static UIAnimator Instance { get {return instance;} } |
|||
public static Vector2 ScreenDimension { get {return instance.screenDimension; } } |
|||
public static Vector2 InvertedScreenDimension { get {return instance.invertedScreenDimension; } } |
|||
public static List<UIAnimation> Animations { get {return instance.animations;}} |
|||
#region UNITY
|
|||
|
|||
/* Awake, Start, Update |
|||
* Unity functions. |
|||
* Update is called each frame. It |
|||
* updates all unfinished animations. |
|||
*/ |
|||
void Awake () |
|||
{ |
|||
if (instance == null){ |
|||
instance = this; |
|||
animations = new List<UIAnimation>(); |
|||
removeList = new List<UIAnimation>(); |
|||
screenDimension = new Vector2(Screen.width, Screen.height); |
|||
invertedScreenDimension = new Vector2(1f / Screen.width, 1f / Screen.height); |
|||
} |
|||
} |
|||
|
|||
void Start () |
|||
{ |
|||
} |
|||
|
|||
void Update() |
|||
{ |
|||
#if UNITY_EDITOR
|
|||
if (animations == null) |
|||
Awake(); |
|||
if (!Application.isPlaying) |
|||
{ |
|||
screenDimension = new Vector2(Screen.width, Screen.height); |
|||
invertedScreenDimension = new Vector2(1f / Screen.width, 1f / Screen.height); |
|||
} |
|||
#endif
|
|||
if (animations.Count > 0){ |
|||
for (int i = 0; i < animations.Count; i++) { |
|||
if(!animations[i].Update(Time.deltaTime)){ |
|||
removeList.Add(animations[i]); |
|||
} |
|||
} |
|||
} |
|||
RemoveSafely(); |
|||
} |
|||
|
|||
#endregion
|
|||
|
|||
#region PUBLIC
|
|||
/* Get Center |
|||
* Used to get the anchor center of <transform>. |
|||
*/ |
|||
public static Vector2 GetCenter(RectTransform transform){ |
|||
return Vector2.Scale(transform.position,Instance.invertedScreenDimension); |
|||
} |
|||
|
|||
/* Add Animation |
|||
* Animation uses to add itself to the Animator. |
|||
*/ |
|||
public static UIAnimation AddAnimation(UIAnimation animation){ |
|||
instance.animations.Add(animation); |
|||
return animation; |
|||
} |
|||
|
|||
/* Remove Animation |
|||
* Removes animations from updating list. |
|||
*/ |
|||
public static void RemoveAnimation(UIAnimation anim){ |
|||
foreach(UIAnimation animation in instance.animations){ |
|||
if(animation == anim){ |
|||
instance.removeList.Add(animation); |
|||
return; |
|||
} |
|||
} |
|||
} |
|||
|
|||
#endregion
|
|||
|
|||
#region PRIVATE
|
|||
/* Remove Safely. |
|||
* After finished, the animation cannot be removed |
|||
* inside the iterator. It is store in another list |
|||
* to be remove with safety. |
|||
*/ |
|||
private void RemoveSafely(){ |
|||
if(removeList.Count > 0){ |
|||
foreach (var item in removeList) { |
|||
animations.Remove(item); |
|||
if (item.OnFinish != null) |
|||
item.OnFinish(); |
|||
} |
|||
removeList.Clear(); |
|||
} |
|||
} |
|||
|
|||
#endregion
|
|||
|
|||
#region MOVE_ANIMATION
|
|||
/* Move* |
|||
* Movement animations. |
|||
* |
|||
* It creates an animation to move <transform> |
|||
* from <origin> to <target> in <duration> |
|||
* seconds. |
|||
* - MOVE TO: From (current position) to (Vector2 target). |
|||
* - MOVE HORIZONTAL: From (float origin) to (float target) with fixed y. |
|||
* - MOVE HORIZONTAL TO: From (current position) to (float target) with fixed y. |
|||
* - MOVE HORIZONTAL: From (float origin) to (float target) with fixed x. |
|||
* - MOVE HORIZONTAL TO: From (current position) to (float target) with fixed x. |
|||
* - MOVE OFFSET: From (current position) to (current position + Vector2 offset). |
|||
*/ |
|||
public static UIPositionAnimation Move(RectTransform transform, Vector2 origin, Vector2 target, float duration){ |
|||
return new UIPositionAnimation( |
|||
transform: transform, |
|||
origin: origin, |
|||
target: target, |
|||
duration: duration |
|||
); |
|||
} |
|||
|
|||
public static UIPositionAnimation MoveTo(RectTransform transform, Vector2 target, float duration){ |
|||
return Move (transform, GetCenter(transform), target, duration); |
|||
} |
|||
|
|||
public static UIPositionAnimation MoveHorizontal(RectTransform transform, float origin, float target, float duration){ |
|||
return Move (transform, new Vector2(origin,GetCenter(transform).y), new Vector2(target,GetCenter(transform).y), duration); |
|||
} |
|||
|
|||
public static UIPositionAnimation MoveHorizontalTo(RectTransform transform, float target, float duration){ |
|||
return Move (transform, GetCenter(transform), new Vector2(target,GetCenter(transform).y), duration); |
|||
} |
|||
|
|||
public static UIPositionAnimation MoveVertical(RectTransform transform, float origin, float target, float duration){ |
|||
return Move (transform, new Vector2(GetCenter(transform).x,origin), new Vector2(GetCenter(transform).x,target), duration); |
|||
} |
|||
|
|||
public static UIPositionAnimation MoveVerticalTo(RectTransform transform, float target, float duration){ |
|||
return Move (transform, GetCenter(transform), new Vector2(GetCenter(transform).x,target), duration); |
|||
} |
|||
|
|||
public static UIPositionAnimation MoveOffset(RectTransform transform, Vector2 offset, float duration){ |
|||
return Move (transform, GetCenter(transform), GetCenter(transform) + offset, duration); |
|||
} |
|||
|
|||
public static UIPositionAnimation MoveBezier(RectTransform transform, Vector2 origin, Vector2 target, Vector2 p1, Vector2 p2, float duration) |
|||
{ |
|||
return new UIBezierAnimation( |
|||
transform: transform, |
|||
origin: origin, |
|||
target: target, |
|||
p1: p1, |
|||
p2: p2, |
|||
duration: duration |
|||
); |
|||
} |
|||
|
|||
public static UIPositionAnimation MoveBezier(RectTransform transform, Vector2 origin, Vector2 target, Vector2 p1, float duration) |
|||
{ |
|||
return new UIBezierAnimation( |
|||
transform: transform, |
|||
origin: origin, |
|||
target: target, |
|||
p1: p1, |
|||
duration: duration |
|||
); |
|||
} |
|||
|
|||
#endregion
|
|||
#region SCALE_ANIMATION
|
|||
/* Scale* |
|||
* Scale animations. |
|||
* |
|||
* It creates an animation to scale <transform> |
|||
* from <origin> to <target> in <duration> |
|||
* seconds. |
|||
* - SCALE TO: From (current scale) to (Vector3 target). |
|||
* - SCALE OFFSET: From (current scale) to (current scale + Vector3 offset). |
|||
*/ |
|||
|
|||
public static UIScaleAnimation Scale(RectTransform transform, Vector3 origin, Vector3 target, float duration){ |
|||
return new UIScaleAnimation( |
|||
transform: transform, |
|||
origin: origin, |
|||
target: target, |
|||
duration: duration |
|||
); |
|||
} |
|||
|
|||
public static UIScaleAnimation ScaleTo(RectTransform transform, Vector3 target, float duration){ |
|||
return Scale(transform, transform.localScale, target, duration); |
|||
} |
|||
|
|||
public static UIScaleAnimation ScaleOffset(RectTransform transform, Vector3 offset, float duration){ |
|||
return Scale(transform, transform.localScale, transform.localScale + offset, duration); |
|||
} |
|||
|
|||
#endregion
|
|||
#region ROTATION_ANIMATION
|
|||
/* Rotation* |
|||
* Rotation animations. |
|||
* |
|||
* It creates an animation to rotate <transform> |
|||
* from <origin> to <target> in <duration> |
|||
* seconds. |
|||
* - ROTATE TO: From (current rotation) to (Quaternion target). |
|||
* - ROTATE OFFSET: From (current rotation) to (current rotation + Quaterion offset). |
|||
*/ |
|||
|
|||
public static UIRotationAnimation Rotate(RectTransform transform, Quaternion origin, Quaternion target, float duration){ |
|||
return new UIRotationAnimation( |
|||
transform: transform, |
|||
origin: origin, |
|||
target: target, |
|||
duration: duration |
|||
); |
|||
} |
|||
|
|||
public static UIRotationAnimation RotateTo(RectTransform transform, Quaternion target, float duration){ |
|||
return Rotate(transform, transform.localRotation, target, duration); |
|||
} |
|||
|
|||
public static UIRotationAnimation RotateOffset(RectTransform transform, Quaternion offset, float duration){ |
|||
return Rotate(transform, transform.localRotation, transform.localRotation * offset, duration); |
|||
} |
|||
|
|||
//UNCLAMPED : THE ROTATION IS NOT LIMITED TO THE 360 DEGREES, BUT LIMITED TO THE Z AXIS
|
|||
public static UIRotationAnimation Rotate(RectTransform transform, float originAngle, float targetAngle, float duration) |
|||
{ |
|||
return new UIRotationAnimation( |
|||
transform: transform, |
|||
origin: originAngle, |
|||
target: targetAngle, |
|||
duration: duration |
|||
); |
|||
} |
|||
|
|||
public static UIRotationAnimation RotateTo(RectTransform transform, float targetAngle, float duration) |
|||
{ |
|||
return Rotate(transform, transform.localRotation.eulerAngles.z, targetAngle, duration); |
|||
} |
|||
|
|||
public static UIRotationAnimation RotateOffset(RectTransform transform, float offsetAngle, float duration) |
|||
{ |
|||
return Rotate(transform, transform.localRotation.eulerAngles.z, transform.localRotation.eulerAngles.z + offsetAngle, duration); |
|||
} |
|||
|
|||
#endregion
|
|||
#region IMAGE_ANIMATION
|
|||
/* ChangeColor*, Fade* |
|||
* Image animations. |
|||
* |
|||
* It creates an animation to change color |
|||
* of <image> from <originColor> to <targetColor> |
|||
* in <duration> seconds. |
|||
* - CHANGE COLOR TO: From (current color) to (Color targetColor). |
|||
* - FADE IN: Creates a fade in effect. |
|||
* - FADE OUT: Creates a fade out effect. |
|||
*/ |
|||
|
|||
public static UISpriteAnimation ChangeColor(Graphic image, Color originColor, Color targetColor, float duration){ |
|||
return new UISpriteAnimation( |
|||
image: image, |
|||
originColor: originColor, |
|||
targetColor: targetColor, |
|||
duration: duration |
|||
); |
|||
} |
|||
|
|||
public static UISpriteAnimation ChangeColorTo(Graphic image, Color targetColor, float duration){ |
|||
return ChangeColor(image,image.color,targetColor,duration); |
|||
} |
|||
|
|||
public static UISpriteAnimation FadeIn(Graphic image, float duration){ |
|||
Color originColor = image.color; |
|||
originColor.a = 0; |
|||
Color targetColor = image.color; |
|||
targetColor.a = 1; |
|||
return ChangeColor(image,originColor,targetColor,duration); |
|||
} |
|||
|
|||
public static UISpriteAnimation FadeOut(Graphic image, float duration){ |
|||
Color originColor = image.color; |
|||
originColor.a = 1; |
|||
Color targetColor = image.color; |
|||
targetColor.a = 0; |
|||
return ChangeColor(image,originColor,targetColor,duration); |
|||
} |
|||
|
|||
#endregion
|
|||
} |
|||
|
|||
/*! UI Animation |
|||
* Abstract - Animations base class. |
|||
* |
|||
* Holds common features for all animations. |
|||
*/ |
|||
public abstract class UIAnimation{ |
|||
|
|||
public delegate void AnimationCallback(); |
|||
|
|||
private float timer = 0; |
|||
private float delay = 0; |
|||
private bool paused = false; |
|||
private AnimationCallback onFinish; |
|||
protected float duration; |
|||
protected UpdateBehaviour updateBehaviour; |
|||
|
|||
public float Duration {get {return duration;}} |
|||
public float Delay {get {return delay;}} |
|||
public AnimationCallback OnFinish {get {return onFinish;}} |
|||
|
|||
/* Update |
|||
* Updates the animation. |
|||
* |
|||
* Sums the time variation to the timer. Then |
|||
* calls the abstract function OnUpdate so each |
|||
* animation tells what need to be update. |
|||
* Timer goes from (-delay/duration) to 1 in |
|||
* (delay + duration) seconds. |
|||
*/ |
|||
public bool Update(float deltaTime){ |
|||
if(paused) |
|||
return true; |
|||
|
|||
timer += deltaTime / duration; |
|||
//Debug.Log("timer: " + timer);
|
|||
|
|||
if (timer < 0) |
|||
OnUpdate(0); |
|||
else if(timer < 1){ |
|||
OnUpdate(timer); |
|||
} |
|||
else{ |
|||
OnEnd(); |
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
/* On Update, On End |
|||
* Abstract class. |
|||
* |
|||
* Must be override by subclass. |
|||
*/ |
|||
public abstract void OnUpdate(float timer); |
|||
|
|||
public abstract void OnEnd(); |
|||
|
|||
public abstract void Reverse(); |
|||
|
|||
/* Set Effect |
|||
* Add effect to animation |
|||
* |
|||
* Effects may behave differently depending |
|||
* on the animation, so it can be might be |
|||
* overridden by subclass. |
|||
*/ |
|||
public virtual UIAnimation SetEffect(Effect.EffectUpdate effect, Quaternion rotation = default(Quaternion)){return this;} |
|||
|
|||
/* Set Callback |
|||
* Add callback to animation. |
|||
* |
|||
* Callbacks are called when the animation ends. |
|||
*/ |
|||
public UIAnimation SetCallback(AnimationCallback callback, bool add = false){ |
|||
if (add) onFinish += callback; |
|||
else onFinish = callback; |
|||
return this; |
|||
} |
|||
|
|||
/* Set Modifier |
|||
* Add modifier to animation. |
|||
* |
|||
* Modifier change how the timer affects the animation. |
|||
*/ |
|||
public UIAnimation SetModifier(UpdateBehaviour updateBehaviour){ |
|||
this.updateBehaviour = updateBehaviour; |
|||
return this; |
|||
} |
|||
|
|||
/* Set Delay |
|||
* Add delay to animation. |
|||
*/ |
|||
public UIAnimation SetDelay(float delay){ |
|||
this.delay = delay; |
|||
timer = - delay / duration; |
|||
return this; |
|||
} |
|||
|
|||
/* Set Loop |
|||
* Set the animation to be a loop. |
|||
* The animation can also be PingPong |
|||
* (replays from the end to beginning). |
|||
* A value can be set as a delay. |
|||
* Please notice that overrides any previously setted callback. |
|||
*/ |
|||
public UIAnimation SetLoop(bool pingPong = false) |
|||
{ |
|||
SetCallback(()=> |
|||
{ |
|||
if(pingPong) Reverse(); |
|||
Play(); |
|||
}); |
|||
return this; |
|||
} |
|||
|
|||
/* Play |
|||
* Play animation. |
|||
*/ |
|||
public void Play(){ |
|||
if(paused) |
|||
paused = false; |
|||
else |
|||
Restart(); |
|||
} |
|||
|
|||
/* Pause |
|||
* Pause animation. |
|||
*/ |
|||
public void Pause(bool playIfPaused = false){ |
|||
if (playIfPaused) |
|||
if (paused) |
|||
Play(); |
|||
else |
|||
paused = true; |
|||
else |
|||
paused = true; |
|||
} |
|||
|
|||
/* Restart |
|||
* Restart animation. |
|||
*/ |
|||
public void Restart(){ |
|||
SetDelay(delay); |
|||
if(!UIAnimator.Animations.Contains(this)) |
|||
UIAnimator.AddAnimation(this); |
|||
} |
|||
|
|||
/* Stop |
|||
* Stop animation. |
|||
*/ |
|||
public void Stop(){ |
|||
UIAnimator.RemoveAnimation(this); |
|||
} |
|||
} |
|||
|
|||
/*! UI Position Animation |
|||
* UI Animation - Movement Animation |
|||
* |
|||
* Overrides superclass abstract methods. |
|||
* Updates transform position. |
|||
*/ |
|||
public class UIPositionAnimation : UIAnimation{ |
|||
protected RectTransform transform; |
|||
private Vector2 originPosition; |
|||
private Vector2 targetPosition; |
|||
protected Effect.EffectBehaviour effectBehaviour; |
|||
|
|||
public UIPositionAnimation(RectTransform transform, UIPositionAnimation animation) : |
|||
this (transform, animation.originPosition, animation.targetPosition, animation.duration){ |
|||
originPosition = animation.originPosition; |
|||
targetPosition = animation.targetPosition; |
|||
updateBehaviour = animation.updateBehaviour; |
|||
effectBehaviour = animation.effectBehaviour; |
|||
} |
|||
|
|||
public UIPositionAnimation(RectTransform transform, Vector2 origin, Vector2 target, float duration){ |
|||
this.transform = transform; |
|||
this.duration = duration < 0.0000001f ? 0.0000001f : duration; |
|||
this.originPosition = Vector2.Scale(origin,UIAnimator.ScreenDimension) - (Vector2)transform.position + transform.anchoredPosition; |
|||
this.targetPosition = Vector2.Scale(target,UIAnimator.ScreenDimension) - (Vector2)transform.position + transform.anchoredPosition; |
|||
updateBehaviour = Modifier.Linear; |
|||
effectBehaviour = Effect.NoEffect; |
|||
} |
|||
|
|||
public override void OnUpdate (float timer){ |
|||
transform.anchoredPosition = Vector2.Lerp(originPosition, targetPosition, updateBehaviour(timer)) + effectBehaviour(timer); |
|||
} |
|||
|
|||
public override void OnEnd (){ |
|||
transform.anchoredPosition = targetPosition; |
|||
} |
|||
|
|||
public override void Reverse() |
|||
{ |
|||
Vector3 aux = originPosition; |
|||
originPosition = targetPosition; |
|||
targetPosition = aux; |
|||
} |
|||
|
|||
/* Set Effect |
|||
* Sets effect |
|||
* |
|||
* For more on Effects, please see Effects class |
|||
*/ |
|||
public override UIAnimation SetEffect (Effect.EffectUpdate effect, Quaternion rotation = default(Quaternion)){ |
|||
Vector2 direction = (targetPosition-originPosition).normalized; |
|||
direction = (direction == Vector2.zero) ? Vector2.right : direction; |
|||
Vector2 directionVector = rotation * direction; |
|||
directionVector *= UIAnimator.ScreenDimension.y; |
|||
this.effectBehaviour = Effect.GetBehaviour(effect, directionVector); |
|||
return this; |
|||
} |
|||
} |
|||
|
|||
public class UIBezierAnimation : UIPositionAnimation |
|||
{ |
|||
public UIBezierAnimation(RectTransform transform, Vector2 origin, Vector2 target, float duration, Vector2 p1, Vector2 p2) : base (transform,origin,target,duration) |
|||
{ |
|||
Vector2 mP0 = Vector2.Scale(origin, UIAnimator.ScreenDimension) - (Vector2)transform.position + transform.anchoredPosition; |
|||
Vector2 mP1 = Vector2.Scale(p1, UIAnimator.ScreenDimension) - (Vector2)transform.position + transform.anchoredPosition; |
|||
Vector2 mP2 = Vector2.Scale(p2, UIAnimator.ScreenDimension) - (Vector2)transform.position + transform.anchoredPosition; |
|||
Vector2 mP3 = Vector2.Scale(target, UIAnimator.ScreenDimension) - (Vector2)transform.position + transform.anchoredPosition; |
|||
effectBehaviour = Effect.BezierEffectBehaviour(mP0, mP1, mP2, mP3); |
|||
} |
|||
|
|||
public UIBezierAnimation(RectTransform transform, Vector2 origin, Vector2 target, float duration, Vector2 p1) : base(transform, origin, target, duration) |
|||
{ |
|||
Vector2 mP0 = Vector2.Scale(origin, UIAnimator.ScreenDimension) - (Vector2)transform.position + transform.anchoredPosition; |
|||
Vector2 mP1 = Vector2.Scale(p1, UIAnimator.ScreenDimension) - (Vector2)transform.position + transform.anchoredPosition; |
|||
Vector2 mP2 = Vector2.Scale(target, UIAnimator.ScreenDimension) - (Vector2)transform.position + transform.anchoredPosition; |
|||
effectBehaviour = Effect.BezierEffectBehaviour(mP0, mP1, mP2); |
|||
} |
|||
|
|||
public override void OnUpdate(float timer) |
|||
{ |
|||
transform.anchoredPosition = effectBehaviour(timer); |
|||
} |
|||
} |
|||
|
|||
/*! UI Scale Animation |
|||
* UI Animation - Scale Animation |
|||
* |
|||
* Overrides superclass abstract methods. |
|||
* Updates transform localScale. |
|||
*/ |
|||
public class UIScaleAnimation : UIAnimation{ |
|||
private RectTransform transform; |
|||
private Vector3 originScale; |
|||
private Vector3 targetScale; |
|||
private Effect.EffectBehaviour effectBehaviour; |
|||
|
|||
public UIScaleAnimation(RectTransform transform, UIScaleAnimation animation) : |
|||
this (transform, animation.originScale, animation.targetScale, animation.duration){} |
|||
|
|||
public UIScaleAnimation(RectTransform transform, Vector3 origin, Vector3 target, float duration){ |
|||
this.transform = transform; |
|||
this.duration = duration < 0.0000001f ? 0.0000001f : duration; |
|||
this.originScale = origin; |
|||
this.targetScale = target; |
|||
updateBehaviour = Modifier.Linear; |
|||
effectBehaviour = Effect.NoEffect; |
|||
} |
|||
|
|||
public override void OnUpdate (float timer){ |
|||
transform.localScale = Vector3.Lerp(originScale, targetScale, updateBehaviour(timer)) + (Vector3)effectBehaviour(timer); |
|||
} |
|||
|
|||
public override void OnEnd (){ |
|||
transform.localScale = targetScale; |
|||
} |
|||
|
|||
public override void Reverse() |
|||
{ |
|||
Vector3 aux = originScale; |
|||
originScale = targetScale; |
|||
targetScale = aux; |
|||
} |
|||
|
|||
/* Set Effect |
|||
* Sets effect |
|||
* |
|||
* For more on Effects, please see Effects class |
|||
*/ |
|||
public override UIAnimation SetEffect (Effect.EffectUpdate effect, Quaternion rotation = default(Quaternion)){ |
|||
this.effectBehaviour = Effect.GetBehaviour(effect,rotation * (targetScale-originScale)); |
|||
return this; |
|||
} |
|||
} |
|||
|
|||
/*! UI Rotation Animation |
|||
* UI Animation - Rotation Animation |
|||
* |
|||
* Overrides superclass abstract methods. |
|||
* Updates transform localRotation. |
|||
*/ |
|||
public class UIRotationAnimation : UIAnimation{ |
|||
private RectTransform transform; |
|||
private float originAngle; |
|||
private float targetAngle; |
|||
private Quaternion originRotation; |
|||
private Quaternion targetRotation; |
|||
private Effect.EffectBehaviour effectBehaviour; |
|||
private bool unclamped = true; |
|||
|
|||
public UIRotationAnimation(RectTransform transform, UIRotationAnimation animation) : |
|||
this (transform, animation.originAngle, animation.targetAngle, animation.duration){} |
|||
|
|||
public UIRotationAnimation(RectTransform transform, Quaternion origin, Quaternion target, float duration){ |
|||
this.transform = transform; |
|||
this.duration = duration < 0.0000001f ? 0.0000001f : duration; |
|||
this.originRotation = origin; |
|||
this.targetRotation = target; |
|||
updateBehaviour = Modifier.Linear; |
|||
effectBehaviour = Effect.NoEffect; |
|||
unclamped = false; |
|||
} |
|||
|
|||
public UIRotationAnimation(RectTransform transform, float origin, float target, float duration) |
|||
{ |
|||
this.transform = transform; |
|||
this.duration = duration < 0.0000001f ? 0.0000001f : duration; |
|||
this.originAngle = origin; |
|||
this.targetAngle = target; |
|||
updateBehaviour = Modifier.Linear; |
|||
effectBehaviour = Effect.NoEffect; |
|||
unclamped = true; |
|||
} |
|||
|
|||
public override void OnUpdate (float timer){ |
|||
if (unclamped) |
|||
{ |
|||
transform.localRotation = Quaternion.AngleAxis(Mathf.Lerp(originAngle, targetAngle, timer), Vector3.forward) * Quaternion.Euler(Vector3.forward * effectBehaviour(timer).x); |
|||
} |
|||
else |
|||
{ |
|||
transform.localRotation = Quaternion.Lerp(originRotation, targetRotation, updateBehaviour(timer)) * Quaternion.Euler(Vector3.forward * effectBehaviour(timer).x); |
|||
} |
|||
} |
|||
|
|||
public override void OnEnd (){ |
|||
if (unclamped) |
|||
{ |
|||
transform.localRotation = Quaternion.AngleAxis(targetAngle, Vector3.forward); |
|||
} |
|||
else |
|||
{ |
|||
transform.localRotation = targetRotation; |
|||
} |
|||
} |
|||
|
|||
public override void Reverse() |
|||
{ |
|||
if (unclamped) |
|||
{ |
|||
float aux = originAngle; |
|||
originAngle = targetAngle; |
|||
targetAngle = aux; |
|||
} |
|||
else |
|||
{ |
|||
Quaternion aux = originRotation; |
|||
originRotation = targetRotation; |
|||
targetRotation = aux; |
|||
} |
|||
} |
|||
|
|||
public override UIAnimation SetEffect (Effect.EffectUpdate effect, Quaternion rotation = default(Quaternion)){ |
|||
this.effectBehaviour = Effect.GetBehaviour(effect, Vector2.right); |
|||
return this; |
|||
} |
|||
} |
|||
|
|||
/*! UI Sprite Animation |
|||
* UI Animation - Color Animation |
|||
* |
|||
* Overrides superclass abstract methods. |
|||
* Updates image color. |
|||
*/ |
|||
public class UISpriteAnimation : UIAnimation{ |
|||
private Graphic image; |
|||
private Color originColor; |
|||
private Color targetColor; |
|||
|
|||
public UISpriteAnimation(Graphic img, UISpriteAnimation animation) : |
|||
this (img, animation.originColor, animation.targetColor, animation.duration){} |
|||
|
|||
public UISpriteAnimation(Graphic image, Color originColor, Color targetColor, float duration){ |
|||
this.image = image; |
|||
this.duration = duration; |
|||
this.originColor = originColor; |
|||
this.targetColor = targetColor; |
|||
updateBehaviour = Modifier.Linear; |
|||
} |
|||
|
|||
public override void OnUpdate (float timer){ |
|||
image.color = Color.Lerp(originColor, targetColor, updateBehaviour(timer)); |
|||
} |
|||
|
|||
public override void OnEnd (){ |
|||
image.color = targetColor; |
|||
} |
|||
|
|||
public override void Reverse() |
|||
{ |
|||
Color aux = originColor; |
|||
originColor = targetColor; |
|||
targetColor = aux; |
|||
} |
|||
} |
|||
|
|||
/*! UI Group Animation |
|||
* UI Animation - Group Animation |
|||
* |
|||
* Overrides superclass abstract methods. |
|||
* Updates multiple UI Animation. Used as reusable animation. |
|||
*/ |
|||
public class UIGroupAnimation : UIAnimation{ |
|||
private UIAnimation[] animations; |
|||
private bool[] finished; |
|||
private float lastTime; |
|||
|
|||
public UIGroupAnimation(RectTransform[] rects, UIPositionAnimation transformAnimation){ |
|||
animations = new UIAnimation[rects.Length]; |
|||
for (int i = 0; i < animations.Length; i++) { |
|||
animations[i] = new UIPositionAnimation(rects[i],transformAnimation); |
|||
} |
|||
duration = animations[0].Duration; |
|||
finished = new bool[animations.Length]; |
|||
} |
|||
|
|||
public UIGroupAnimation(RectTransform[] rects, UIScaleAnimation transformAnimation){ |
|||
animations = new UIAnimation[rects.Length]; |
|||
for (int i = 0; i < animations.Length; i++) { |
|||
animations[i] = new UIScaleAnimation(rects[i],transformAnimation); |
|||
} |
|||
duration = animations[0].Duration; |
|||
finished = new bool[animations.Length]; |
|||
} |
|||
|
|||
public UIGroupAnimation(Image[] imgs, UISpriteAnimation spriteAnimation){ |
|||
animations = new UIAnimation[imgs.Length]; |
|||
for (int i = 0; i < animations.Length; i++) { |
|||
animations[i] = new UISpriteAnimation(imgs[i],spriteAnimation); |
|||
} |
|||
duration = animations[0].Duration; |
|||
finished = new bool[animations.Length]; |
|||
} |
|||
|
|||
public UIGroupAnimation(params UIAnimation[] animations){ |
|||
for (int i = 0; i < animations.Length; i++) { |
|||
duration = Mathf.Max(duration,animations[i].Duration + animations[i].Delay); |
|||
} |
|||
this.animations = animations; |
|||
finished = new bool[animations.Length]; |
|||
} |
|||
|
|||
public override void OnUpdate (float timer){ |
|||
float deltaTime = (timer - lastTime) * duration; |
|||
for (int i = 0; i < animations.Length; i++) { |
|||
if(!finished[i]) |
|||
finished[i] = !animations[i].Update(deltaTime); |
|||
} |
|||
lastTime = timer; |
|||
} |
|||
|
|||
public override void OnEnd (){ |
|||
for (int i = 0; i < animations.Length; i++) { |
|||
animations[i].OnEnd(); |
|||
finished[i] = false; |
|||
animations[i].SetDelay(animations[i].Delay); |
|||
lastTime = 0; |
|||
} |
|||
} |
|||
|
|||
public override void Reverse() |
|||
{ |
|||
for (int i = 0; i < animations.Length; i++) |
|||
{ |
|||
animations[i].Reverse(); |
|||
} |
|||
} |
|||
|
|||
public override UIAnimation SetEffect (Effect.EffectUpdate effect, Quaternion rotation = default(Quaternion)) |
|||
{ |
|||
for (int i = 0; i < animations.Length; i++) { |
|||
animations[i].SetEffect(effect,rotation); |
|||
} |
|||
return this; |
|||
} |
|||
|
|||
/* Set Group Modifier |
|||
* Set same modifier for all animations |
|||
*/ |
|||
public UIGroupAnimation SetGroupModifier(UpdateBehaviour mod){ |
|||
for (int i = 0; i < animations.Length; i++) { |
|||
animations[i].SetModifier(mod); |
|||
} |
|||
return this; |
|||
} |
|||
|
|||
/* Set Group Effect |
|||
* Set same effect for all animations |
|||
*/ |
|||
public UIGroupAnimation SetGroupEffect(Effect.EffectGroup effectGroup, float max = 0.2f, float min = 0.0f, int maxBounce = 2, int minBounce = 1, int minAngle = 0, int maxAngle = 0){ |
|||
for (int i = 0; i < animations.Length; i++) { |
|||
animations[i].SetEffect(effectGroup (Random.Range(min,max), Random.Range(minBounce,maxBounce)), Quaternion.Euler(Vector3.forward * Random.Range(minAngle,maxAngle))); |
|||
} |
|||
return this; |
|||
} |
|||
} |
|||
|
|||
public delegate float UpdateBehaviour(float deltaTime); |
|||
|
|||
/*! Modifier |
|||
* Change animation behaviour. |
|||
* |
|||
* Returns a float value used in inside |
|||
* UIAnimation.OnUpdate to change the timer |
|||
* growth curve, changing the animation. |
|||
* To add a new modifier simply create a new |
|||
* UpdateBehaviour function. |
|||
* CAUTION: |
|||
* 1. Functions must attend: f(0) = 0 & f(1) = 1. |
|||
* 2. It is used inside a Lerp function, any |
|||
* values above 1 may have unexpected behaviour. |
|||
*/ |
|||
public static class Modifier{ |
|||
public static float Linear (float time) {return time;} |
|||
public static float QuadOut (float time) {return time * time;} |
|||
public static float QuadIn (float time) {return (float)Mathf.Pow(time,0.50f);} |
|||
public static float CubOut (float time) {return time * time * time;} |
|||
public static float CubIn (float time) {return Mathf.Pow(time,0.33f);} |
|||
public static float PolyOut (float time) {return time * time * time * time;} |
|||
public static float PolyIn (float time) {return Mathf.Pow(time,0.25f);} |
|||
public static float Sin (float time) {return 0.5f + 0.5f * Mathf.Cos((1-time)*Mathf.PI);} |
|||
public static float Tan (float time) {return 2 * time - Sin(time);} |
|||
public static float CircularIn (float time){return Mathf.Sqrt(Mathf.Sin(time*Mathf.PI/2));} |
|||
public static float CircularOut (float time){return 1 - Mathf.Sqrt(Mathf.Cos(-time*Mathf.PI/2));} |
|||
} |
|||
|
|||
/*! Effect |
|||
* Add new values to the animation. |
|||
* |
|||
* Returns a Vector2 from (float time) adding a new behaviour |
|||
* to the animation. |
|||
* To add a new effect you must create a new EffectUpdate function |
|||
* You can use a float and a int parameter to adjust your effect |
|||
* CAUTION: |
|||
* 1. Functions must attend: f(0) = 0 & f(1) = 0. |
|||
* 2. You must also create a EffectGroup, so the effect can be |
|||
* used in a GroupAnimation |
|||
*/ |
|||
public static class Effect{ |
|||
public delegate EffectUpdate EffectGroup(float max, int bounce); |
|||
public delegate Vector2 EffectBehaviour(float time); |
|||
public delegate float EffectUpdate(float time); |
|||
public static Vector2 NoEffect(float time){return Vector2.zero;} |
|||
|
|||
public static EffectUpdate Spring(float max = 0.2f, int bounce = 2) {return (float time) => {return max * (1- time * time) * Mathf.Sin(Mathf.PI * bounce * time * time);};} |
|||
public static EffectUpdate Wave(float max = 0.2f, int bounce = 2) {return (float time) => {return max * Mathf.Sin(Mathf.PI * bounce * time);};} |
|||
public static EffectUpdate Explosion(float max = 0.2f) {return (float time) => {return max * Mathf.Sqrt(Mathf.Sin(Mathf.Pow(time,0.75f)*Mathf.PI));};} |
|||
|
|||
public static EffectGroup SpringGroup (){return (float max, int bounce) => {return Spring(max,bounce);};} |
|||
public static EffectGroup WaveGroup (){return (float max, int bounce) => {return Wave(max,bounce);};} |
|||
public static EffectGroup ExplosionGroup(){return (float max, int bounce) => {return Explosion(max);};} |
|||
|
|||
/* Get Behaviour |
|||
* NOTE: For movement animations, changing the directionVector can |
|||
* modify you effect. |
|||
*/ |
|||
public static EffectBehaviour GetBehaviour(EffectUpdate update, Vector2 directionVector){ |
|||
return ((float time) => {return directionVector * update(time);}); |
|||
} |
|||
public static EffectBehaviour BezierEffectBehaviour(Vector2 p0, Vector2 p1, Vector2 p2, Vector2 p3) |
|||
{ |
|||
return (float time) => { return (1 - time) * (1 - time) * (1 - time) * p0 + 3 * (1 - time) * (1 - time) * time * p1 + 3 * (1 - time) * time * time * p2 + time * time * time * p3;}; |
|||
} |
|||
public static EffectBehaviour BezierEffectBehaviour(Vector2 p0, Vector2 p1, Vector2 p2) |
|||
{ |
|||
return (float time) => { return (1 - time) * (1 - time) * p0 + 2 * (1 - time) * time * p1 + time * time * p2;}; |
|||
} |
|||
} |
|||
} |
fileFormatVersion: 2 |
|||
guid: 9c4619afaa490b94c8c10fba9d87abe0 |
|||
timeCreated: 1494505850 |
|||
licenseType: Store |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
{ |
|||
"m_Dictionary": { |
|||
"m_DictionaryValues": [ |
|||
{ |
|||
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", |
|||
"key": "IET.DisplayWelcomeDialogOnStartup", |
|||
"value": "{\"m_Value\":false}" |
|||
} |
|||
] |
|||
} |
|||
} |
部分文件因为文件数量过多而无法显示
撰写
预览
正在加载...
取消
保存
Reference in new issue