added resources, joistics, CameraControl.cs, PlayerControl.cs, HexDirection.cs, changed one mesh map to multi mesh
This commit is contained in:
parent
c7608864ea
commit
ff45de1cbf
@ -40,7 +40,7 @@ Material:
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Texture: {fileID: 2800000, guid: 983242f4b4db7a841af48234cf0021b8, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
|
@ -34,7 +34,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0.1}
|
||||
m_AnchoredPosition: {x: 0, y: 0.1000061}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!223 &4726489279989878080
|
||||
@ -80,4 +80,4 @@ MonoBehaviour:
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 10
|
||||
m_PresetInfoIsWorld: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
|
@ -10,7 +10,7 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 9206642805257129957}
|
||||
- component: {fileID: 5504347142468695319}
|
||||
- component: {fileID: 5211075868027037164}
|
||||
- component: {fileID: 3836123284387241147}
|
||||
m_Layer: 0
|
||||
m_Name: Hex Cell Label
|
||||
m_TagString: Untagged
|
||||
@ -35,7 +35,7 @@ RectTransform:
|
||||
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: 5, y: 15}
|
||||
m_SizeDelta: {x: 5, y: 5}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5504347142468695319
|
||||
CanvasRenderer:
|
||||
@ -45,7 +45,7 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2988988380115025501}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &5211075868027037164
|
||||
--- !u!114 &3836123284387241147
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@ -54,28 +54,83 @@ MonoBehaviour:
|
||||
m_GameObject: {fileID: 2988988380115025501}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
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_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_FontSize: 4
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 4
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 0
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: New Text
|
||||
m_text:
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 1
|
||||
m_fontSizeBase: 1
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 2
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_enableWordWrapping: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 1
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
|
@ -10,6 +10,9 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 2395323453841137154}
|
||||
- component: {fileID: 2474514080286293112}
|
||||
- component: {fileID: 6704445576903181141}
|
||||
- component: {fileID: 6549333022432013590}
|
||||
- component: {fileID: 2801708427468119763}
|
||||
m_Layer: 0
|
||||
m_Name: HexCell
|
||||
m_TagString: Untagged
|
||||
@ -26,7 +29,7 @@ Transform:
|
||||
m_GameObject: {fileID: 1661242500252451528}
|
||||
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_LocalScale: {x: 5, y: 1, z: 5}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
@ -47,3 +50,73 @@ MonoBehaviour:
|
||||
x: 0
|
||||
z: 0
|
||||
color: {r: 0, g: 0, b: 0, a: 0}
|
||||
neighbors:
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
- {fileID: 0}
|
||||
--- !u!33 &6704445576903181141
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1661242500252451528}
|
||||
m_Mesh: {fileID: 1095898118798147751, guid: 0140277f2a2384e48aac3ffd0a426811, type: 3}
|
||||
--- !u!23 &6549333022432013590
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1661242500252451528}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 6a3f5c7892e4b478e9e745026e6fe9f7, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!64 &2801708427468119763
|
||||
MeshCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1661242500252451528}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 4
|
||||
m_Convex: 0
|
||||
m_CookingOptions: 30
|
||||
m_Mesh: {fileID: 1095898118798147751, guid: 0140277f2a2384e48aac3ffd0a426811, type: 3}
|
||||
|
@ -1,96 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &695382969544946598
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 695382969544946593}
|
||||
- component: {fileID: 695382969544946594}
|
||||
- component: {fileID: 695382969544946595}
|
||||
- component: {fileID: 695382969544946592}
|
||||
m_Layer: 0
|
||||
m_Name: HexMesh
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &695382969544946593
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 695382969544946598}
|
||||
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: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &695382969544946594
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 695382969544946598}
|
||||
m_Mesh: {fileID: 0}
|
||||
--- !u!23 &695382969544946595
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 695382969544946598}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 6a3f5c7892e4b478e9e745026e6fe9f7, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!114 &695382969544946592
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 695382969544946598}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c547250cafb924e6397c4c850c04fe5f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3af15cc359f2a714f8e880d401a0c029
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -13,4 +13,5 @@ MonoBehaviour:
|
||||
m_Name: Data
|
||||
m_EditorClassIdentifier:
|
||||
fieldDataPath: FieldData
|
||||
tagDataPath:
|
||||
cameraDataPath: CameraData
|
||||
playerDataPath: PlayerData
|
||||
|
@ -12,11 +12,15 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: a1700d9ee2ab4d8e8ac1b551b7c93ce8, type: 3}
|
||||
m_Name: FieldData
|
||||
m_EditorClassIdentifier:
|
||||
width: 15
|
||||
height: 15
|
||||
width: 25
|
||||
height: 50
|
||||
defaultColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
touchedColor: {r: 1, g: 0, b: 1, a: 1}
|
||||
cellPrefab: {fileID: 2474514080286293112, guid: bcea5b4a96735bd4b936f8f3fefcc688, type: 3}
|
||||
cellLabelPrefab: {fileID: 5211075868027037164, guid: efd47cbd22ddfee4aa2b1391914116fc, type: 3}
|
||||
CoordinatesCanvas: {fileID: 4726489279989878083, guid: f31e0880dd078104bb31dc0fd7ef9f19, type: 3}
|
||||
HexMeshPrefab: {fileID: 695382969544946598, guid: 3af15cc359f2a714f8e880d401a0c029, type: 3}
|
||||
cellPrefab: {fileID: 1661242500252451528, guid: bcea5b4a96735bd4b936f8f3fefcc688,
|
||||
type: 3}
|
||||
cellLabelPrefab: {fileID: 3836123284387241147, guid: efd47cbd22ddfee4aa2b1391914116fc,
|
||||
type: 3}
|
||||
CoordinatesCanvas: {fileID: 4726489279989878083, guid: f31e0880dd078104bb31dc0fd7ef9f19,
|
||||
type: 3}
|
||||
HexMeshPrefab: {fileID: 2988988380115025501, guid: efd47cbd22ddfee4aa2b1391914116fc,
|
||||
type: 3}
|
||||
|
@ -123,6 +123,12 @@ NavMeshSettings:
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!224 &614690929 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 1167446855}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &705507993
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -292,13 +298,394 @@ Transform:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_LocalRotation: {x: 0.2789073, y: 0, z: 0, w: 0.9603181}
|
||||
m_LocalPosition: {x: 50, y: 50, z: -10}
|
||||
m_LocalRotation: {x: 0.2588191, y: 0, z: 0, w: 0.9659258}
|
||||
m_LocalPosition: {x: 15, y: 15, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 32.39, y: 0, z: 0}
|
||||
m_LocalEulerAnglesHint: {x: 30, y: 0, z: 0}
|
||||
--- !u!1001 &1167446855
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 2126832994}
|
||||
m_Modifications:
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_Pivot.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_Pivot.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 400
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: -400
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043269, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: AtackJoystick
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791961219456, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 50
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791961219456, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 50
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791961219459, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_Sprite
|
||||
value:
|
||||
objectReference: {fileID: 21300000, guid: d291abfba78d1da41807b9080554b675,
|
||||
type: 3}
|
||||
- target: {fileID: 8170153792821263252, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_Sprite
|
||||
value:
|
||||
objectReference: {fileID: 21300000, guid: 4db2952f6e3f0bc43889874a9299ff0e,
|
||||
type: 3}
|
||||
- target: {fileID: 8170153792821263258, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 100
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153792821263258, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 100
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153792821263258, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 222
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153792821263258, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 140
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 0d230cc8be529a542a08cb878ab14b18, type: 3}
|
||||
--- !u!1001 &1355422815
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 2126832994}
|
||||
m_Modifications:
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_Pivot.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_Pivot.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 400
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043269, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: Movement Joystick
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791961219456, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 50
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791961219456, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 50
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153792821263258, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 100
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153792821263258, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 100
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153792821263258, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 118.9
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 0d230cc8be529a542a08cb878ab14b18, type: 3}
|
||||
--- !u!1 &1750604535
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1750604538}
|
||||
- component: {fileID: 1750604537}
|
||||
- component: {fileID: 1750604536}
|
||||
m_Layer: 0
|
||||
m_Name: EventSystem
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1750604536
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1750604535}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalAxis: Horizontal
|
||||
m_VerticalAxis: Vertical
|
||||
m_SubmitButton: Submit
|
||||
m_CancelButton: Cancel
|
||||
m_InputActionsPerSecond: 10
|
||||
m_RepeatDelay: 0.5
|
||||
m_ForceModuleActive: 0
|
||||
--- !u!114 &1750604537
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1750604535}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_FirstSelected: {fileID: 0}
|
||||
m_sendNavigationEvents: 1
|
||||
m_DragThreshold: 10
|
||||
--- !u!4 &1750604538
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1750604535}
|
||||
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: 0}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1854206697
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -343,3 +730,110 @@ Transform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!224 &2047218564 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 1355422815}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &2126832990
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2126832994}
|
||||
- component: {fileID: 2126832993}
|
||||
- component: {fileID: 2126832992}
|
||||
- component: {fileID: 2126832991}
|
||||
m_Layer: 5
|
||||
m_Name: GameCanvas
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &2126832991
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2126832990}
|
||||
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 &2126832992
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2126832990}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UiScaleMode: 0
|
||||
m_ReferencePixelsPerUnit: 100
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 800, y: 600}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 0
|
||||
m_PhysicalUnit: 3
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
--- !u!223 &2126832993
|
||||
Canvas:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2126832990}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_RenderMode: 0
|
||||
m_Camera: {fileID: 963194227}
|
||||
m_PlaneDistance: 100
|
||||
m_PixelPerfect: 0
|
||||
m_ReceivesEvents: 1
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_AdditionalShaderChannelsFlag: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
--- !u!224 &2126832994
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2126832990}
|
||||
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_Children:
|
||||
- {fileID: 2047218564}
|
||||
- {fileID: 614690929}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
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}
|
||||
|
3
Assets/Scripts/CameraControl.meta
Normal file
3
Assets/Scripts/CameraControl.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c9907af33384f2c94f5fc0eb6e840cd
|
||||
timeCreated: 1639489317
|
35
Assets/Scripts/CameraControl/CameraControl.cs
Normal file
35
Assets/Scripts/CameraControl/CameraControl.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using Controller;
|
||||
using Data;
|
||||
using Runtime.Controller;
|
||||
using UnityEngine;
|
||||
|
||||
namespace CameraControl
|
||||
{
|
||||
public class CameraControl : IFixedExecute
|
||||
{
|
||||
private Camera _camera;
|
||||
private Transform _target;
|
||||
|
||||
private Vector3 _offset;
|
||||
private float _smoothSpeed;
|
||||
|
||||
public CameraControl(Camera camera, Transform target, CameraData cameraData)
|
||||
{
|
||||
_camera = camera;
|
||||
_target = target;
|
||||
_offset = cameraData.offset;
|
||||
_smoothSpeed = cameraData.smoothSpeed;
|
||||
}
|
||||
|
||||
public void FixedExecute()
|
||||
{
|
||||
if (_target == null)
|
||||
return;
|
||||
Vector3 desiredPosition = _target.position + _offset;
|
||||
Vector3 smothedPosition =
|
||||
Vector3.Lerp(_camera.transform.position, desiredPosition, _smoothSpeed * Time.deltaTime);
|
||||
_camera.transform.position = smothedPosition;
|
||||
_camera.transform.LookAt(_target);
|
||||
}
|
||||
}
|
||||
}
|
3
Assets/Scripts/CameraControl/CameraControl.cs.meta
Normal file
3
Assets/Scripts/CameraControl/CameraControl.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff2c85619d7b4d69a27626e3e3314d6e
|
||||
timeCreated: 1639489317
|
@ -1,10 +1,26 @@
|
||||
using HexFiled;
|
||||
using Data;
|
||||
using HexFiled;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Chars
|
||||
{
|
||||
public class Player : IUnit
|
||||
{
|
||||
private HexCoordinates _curentPosition;
|
||||
private bool _isAlive;
|
||||
private GameObject _instance;
|
||||
private GameObject prefab;
|
||||
private HexCell _cell;
|
||||
private HexGrid _hexGrid;
|
||||
|
||||
public Player(PlayerData playerData, HexGrid hexGrid)
|
||||
{
|
||||
_curentPosition = playerData.SpawnPos;
|
||||
prefab = playerData.PlayerPrefab;
|
||||
_isAlive = false;
|
||||
_hexGrid = hexGrid;
|
||||
|
||||
}
|
||||
|
||||
public void Move(HexCoordinates coordinates)
|
||||
{
|
||||
@ -13,7 +29,11 @@ namespace Chars
|
||||
|
||||
public void Spawn()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
if (!_isAlive)
|
||||
{
|
||||
_cell = _hexGrid.GetCellFromCoord(_curentPosition);
|
||||
_instance = Object.Instantiate(prefab, _cell.transform.position, Quaternion.identity);
|
||||
}
|
||||
}
|
||||
|
||||
public void Death()
|
||||
|
@ -13,7 +13,7 @@ namespace Chars
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
19
Assets/Scripts/Chars/UnitFactory.cs
Normal file
19
Assets/Scripts/Chars/UnitFactory.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Chars
|
||||
{
|
||||
public class UnitFactory
|
||||
{
|
||||
private List<IUnit> _units;
|
||||
|
||||
public UnitFactory(List<IUnit> units)
|
||||
{
|
||||
_units = units;
|
||||
}
|
||||
|
||||
public void Spawn()
|
||||
{
|
||||
_units.ForEach(x => x.Spawn());
|
||||
}
|
||||
}
|
||||
}
|
3
Assets/Scripts/Chars/UnitFactory.cs.meta
Normal file
3
Assets/Scripts/Chars/UnitFactory.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0fc814f372747debe865aa87fc8032c
|
||||
timeCreated: 1639490545
|
@ -9,6 +9,8 @@ namespace Controller
|
||||
private readonly List<IExecute> _executeControllers;
|
||||
private readonly List<ILateExecute> _lateControllers;
|
||||
private readonly List<ICleanup> _cleanupControllers;
|
||||
private readonly List<IFixedExecute> _fixedExecuteControllers;
|
||||
private readonly List<IAwake> _awakeExecuteControllers;
|
||||
|
||||
public Controllers()
|
||||
{
|
||||
@ -16,6 +18,7 @@ namespace Controller
|
||||
_executeControllers = new List<IExecute>();
|
||||
_lateControllers = new List<ILateExecute>();
|
||||
_cleanupControllers = new List<ICleanup>();
|
||||
_fixedExecuteControllers = new List<IFixedExecute>();
|
||||
}
|
||||
|
||||
internal Controllers Add(IController controller)
|
||||
@ -40,12 +43,16 @@ namespace Controller
|
||||
_cleanupControllers.Add(cleanupController);
|
||||
}
|
||||
|
||||
if (controller is IFixedExecute fixedExecute)
|
||||
{
|
||||
_fixedExecuteControllers.Add(fixedExecute);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
_executeControllers.ForEach(x => x.Execute());
|
||||
_executeControllers?.ForEach(x => x.Execute());
|
||||
}
|
||||
|
||||
public void Init()
|
||||
@ -55,12 +62,24 @@ namespace Controller
|
||||
|
||||
public void LateExecute()
|
||||
{
|
||||
_lateControllers.ForEach(x => x.LateExecute());
|
||||
_lateControllers?.ForEach(x => x.LateExecute());
|
||||
}
|
||||
|
||||
public void Cleanup()
|
||||
{
|
||||
_cleanupControllers.ForEach(x => x.Cleanup());
|
||||
_cleanupControllers?.ForEach(x => x.Cleanup());
|
||||
}
|
||||
|
||||
public void FixedExecute()
|
||||
{
|
||||
_fixedExecuteControllers?.ForEach(x => x.FixedExecute());
|
||||
}
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
_awakeExecuteControllers?.ForEach(x => x.Awake());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Runtime.Controller;
|
||||
using System;
|
||||
using Runtime.Controller;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Controller
|
||||
@ -8,10 +9,15 @@ namespace Controller
|
||||
[SerializeField] private Data.Data data;
|
||||
private Controllers _controllers;
|
||||
|
||||
private void Start()
|
||||
private void Awake()
|
||||
{
|
||||
_controllers = new Controllers();
|
||||
new GameInit(_controllers, data);
|
||||
_controllers.Awake();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_controllers.Init();
|
||||
}
|
||||
|
||||
@ -20,6 +26,11 @@ namespace Controller
|
||||
_controllers.Execute();
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
_controllers.FixedExecute();
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
_controllers.LateExecute();
|
||||
|
@ -1,4 +1,6 @@
|
||||
using HexFiled;
|
||||
using System.Collections.Generic;
|
||||
using Chars;
|
||||
using HexFiled;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Controller
|
||||
@ -7,14 +9,22 @@ namespace Controller
|
||||
{
|
||||
public GameInit(Controllers controllers, Data.Data data)
|
||||
{
|
||||
var hexGrid = new HexGrid(data.Field);
|
||||
controllers.Add(hexGrid);
|
||||
hexGrid.OnHexPainted += DoSomething;
|
||||
var hexGrid = new HexGrid(data.FieldData);
|
||||
controllers.Add(hexGrid);
|
||||
hexGrid.OnHexPainted += DoSomething;
|
||||
|
||||
Player player = new Player(data.PlayerData, hexGrid);
|
||||
|
||||
List<IUnit> units = new List<IUnit> { player };
|
||||
|
||||
var unitFactory = new UnitFactory(units);
|
||||
hexGrid.OnGridLoaded += unitFactory.Spawn;
|
||||
|
||||
}
|
||||
|
||||
private void DoSomething(HexCoordinates coordinates)
|
||||
private void DoSomething(HexCell cell)
|
||||
{
|
||||
Debug.Log("Painted! " + coordinates );
|
||||
Debug.Log("Painted! " + cell.coordinates );
|
||||
}
|
||||
}
|
||||
}
|
9
Assets/Scripts/Controller/IAwake.cs
Normal file
9
Assets/Scripts/Controller/IAwake.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using Runtime.Controller;
|
||||
|
||||
namespace Controller
|
||||
{
|
||||
public interface IAwake : IController
|
||||
{
|
||||
void Awake();
|
||||
}
|
||||
}
|
3
Assets/Scripts/Controller/IAwake.cs.meta
Normal file
3
Assets/Scripts/Controller/IAwake.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b851dab58d414a5b8dec4b27e6be45ce
|
||||
timeCreated: 1639502375
|
9
Assets/Scripts/Controller/IFixedExecute.cs
Normal file
9
Assets/Scripts/Controller/IFixedExecute.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using Runtime.Controller;
|
||||
|
||||
namespace Controller
|
||||
{
|
||||
public interface IFixedExecute : IController
|
||||
{
|
||||
void FixedExecute();
|
||||
}
|
||||
}
|
3
Assets/Scripts/Controller/IFixedExecute.cs.meta
Normal file
3
Assets/Scripts/Controller/IFixedExecute.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 54387d683d184cba82a65609918f7ebc
|
||||
timeCreated: 1639489539
|
11
Assets/Scripts/Data/CameraData.cs
Normal file
11
Assets/Scripts/Data/CameraData.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Data
|
||||
{
|
||||
[CreateAssetMenu(fileName = "CameraData", menuName = "Data/Camera Data")]
|
||||
public class CameraData : ScriptableObject
|
||||
{
|
||||
public Vector3 offset;
|
||||
public float smoothSpeed;
|
||||
}
|
||||
}
|
3
Assets/Scripts/Data/CameraData.cs.meta
Normal file
3
Assets/Scripts/Data/CameraData.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83b1020f31bf45569f5af6c77fc77d4e
|
||||
timeCreated: 1639489869
|
@ -1,4 +1,5 @@
|
||||
using System.IO;
|
||||
using Chars;
|
||||
using Runtime.Data;
|
||||
using UnityEngine;
|
||||
|
||||
@ -9,8 +10,12 @@ namespace Data
|
||||
{
|
||||
[SerializeField] private string fieldDataPath;
|
||||
private FieldData _fieldData;
|
||||
|
||||
public FieldData Field
|
||||
[SerializeField] private string cameraDataPath;
|
||||
private CameraData _cameraData;
|
||||
[SerializeField] private string playerDataPath;
|
||||
private PlayerData _playerData;
|
||||
|
||||
public FieldData FieldData
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -23,8 +28,33 @@ namespace Data
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public CameraData CameraData
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_cameraData == null)
|
||||
{
|
||||
_cameraData = Load<CameraData>("Data/" + cameraDataPath);
|
||||
}
|
||||
|
||||
return _cameraData;
|
||||
}
|
||||
}
|
||||
|
||||
public PlayerData PlayerData
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_playerData == null)
|
||||
{
|
||||
_playerData = Load<PlayerData>("Data/" + playerDataPath);
|
||||
}
|
||||
|
||||
return _playerData;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static T Load<T>(string resourcesPath) where T : Object =>
|
||||
Resources.Load<T>(Path.ChangeExtension(resourcesPath, null));
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using HexFiled;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@ -12,9 +13,8 @@ namespace Runtime.Data
|
||||
public Color defaultColor = Color.white;
|
||||
public Color touchedColor = Color.magenta;
|
||||
|
||||
public HexCell cellPrefab;
|
||||
public Text cellLabelPrefab;
|
||||
public GameObject cellPrefab;
|
||||
public TMP_Text cellLabelPrefab;
|
||||
public GameObject CoordinatesCanvas;
|
||||
public GameObject HexMeshPrefab;
|
||||
}
|
||||
}
|
13
Assets/Scripts/Data/PlayerData.cs
Normal file
13
Assets/Scripts/Data/PlayerData.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using HexFiled;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Data
|
||||
{
|
||||
[CreateAssetMenu(fileName = "PlayerData", menuName = "Data/PlayerData", order = 0)]
|
||||
public class PlayerData : ScriptableObject
|
||||
{
|
||||
public HexCoordinates SpawnPos;
|
||||
public GameObject PlayerPrefab;
|
||||
public FloatingJoystick Joystick;
|
||||
}
|
||||
}
|
3
Assets/Scripts/Data/PlayerData.cs.meta
Normal file
3
Assets/Scripts/Data/PlayerData.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d46325a4e4e45338d7e9733fb8d6013
|
||||
timeCreated: 1639490671
|
@ -1,22 +0,0 @@
|
||||
using HexFiled;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(HexCoordinates))]
|
||||
public class HexCoordinatesDrawer : PropertyDrawer {
|
||||
|
||||
public override void OnGUI (
|
||||
Rect position, SerializedProperty property, GUIContent label
|
||||
) {
|
||||
HexCoordinates coordinates = new HexCoordinates(
|
||||
property.FindPropertyRelative("x").intValue,
|
||||
property.FindPropertyRelative("z").intValue
|
||||
);
|
||||
|
||||
position = EditorGUI.PrefixLabel(position, label);
|
||||
GUI.Label(position, coordinates.ToString());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf163438e85b942b09b24ae506a54813
|
||||
timeCreated: 1454007190
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -2,10 +2,23 @@
|
||||
|
||||
namespace HexFiled
|
||||
{
|
||||
public class HexCell : MonoBehaviour {
|
||||
public class HexCell : MonoBehaviour
|
||||
{
|
||||
|
||||
public HexCoordinates coordinates;
|
||||
|
||||
public Color color;
|
||||
|
||||
[SerializeField] private HexCell[] neighbors;
|
||||
|
||||
public HexCell GetNeighbor(HexDirection direction)
|
||||
{
|
||||
return neighbors[(int)direction];
|
||||
}
|
||||
|
||||
public void SetNeighbor(HexDirection direction, HexCell cell)
|
||||
{
|
||||
neighbors[(int)direction] = cell;
|
||||
cell.neighbors[(int)direction.Opposite()] = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,23 +8,32 @@ namespace HexFiled
|
||||
[SerializeField]
|
||||
private int x, z;
|
||||
|
||||
public int X {
|
||||
get {
|
||||
return x;
|
||||
public int X => x;
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null) return false;
|
||||
var coord = (HexCoordinates)obj;
|
||||
|
||||
return coord.X == X && coord.Y == Y && coord.Z == Z;
|
||||
}
|
||||
|
||||
public bool Equals(HexCoordinates other)
|
||||
{
|
||||
return x == other.x && z == other.z;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
return (x * 397) ^ z;
|
||||
}
|
||||
}
|
||||
|
||||
public int Z {
|
||||
get {
|
||||
return z;
|
||||
}
|
||||
}
|
||||
public int Z => z;
|
||||
|
||||
public int Y {
|
||||
get {
|
||||
return -X - Z;
|
||||
}
|
||||
}
|
||||
public int Y => -X - Z;
|
||||
|
||||
public HexCoordinates (int x, int z) {
|
||||
this.x = x;
|
||||
@ -63,6 +72,15 @@ namespace HexFiled
|
||||
return new HexCoordinates(iX, iZ);
|
||||
}
|
||||
|
||||
public static Vector3 ToPosition (HexCoordinates position) {
|
||||
|
||||
Vector3 pos;
|
||||
pos.x = (position.x + position.z * 0.5f - position.z / 2) * (HexMetrics.innerRadius * 2f);
|
||||
pos.y = 0f;
|
||||
pos.z = position.z * (HexMetrics.outerRadius * 1.5f);
|
||||
|
||||
return pos;
|
||||
}
|
||||
public override string ToString () {
|
||||
return "(" +
|
||||
X.ToString() + ", " + Y.ToString() + ", " + Z.ToString() + ")";
|
||||
|
15
Assets/Scripts/HexFiled/HexDirection.cs
Normal file
15
Assets/Scripts/HexFiled/HexDirection.cs
Normal file
@ -0,0 +1,15 @@
|
||||
namespace HexFiled
|
||||
{
|
||||
public enum HexDirection {
|
||||
NE, E, SE, SW, W, NW
|
||||
}
|
||||
|
||||
public static class HexDirectionExtensions
|
||||
{
|
||||
|
||||
public static HexDirection Opposite(this HexDirection direction)
|
||||
{
|
||||
return (int)direction < 3 ? (direction + 3) : (direction - 3);
|
||||
}
|
||||
}
|
||||
}
|
3
Assets/Scripts/HexFiled/HexDirection.cs.meta
Normal file
3
Assets/Scripts/HexFiled/HexDirection.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 55ce0e8afc5740f4acb30b24abb165aa
|
||||
timeCreated: 1639523579
|
@ -1,106 +1,141 @@
|
||||
using System;
|
||||
using Runtime.Controller;
|
||||
using Runtime.Data;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace HexFiled
|
||||
{
|
||||
public class HexGrid : IInitialization, IExecute {
|
||||
public class HexGrid : IInitialization, IExecute
|
||||
{
|
||||
private int _width;
|
||||
private int _height;
|
||||
private Color _defaultColor = Color.white;
|
||||
private Color _touchedColor = Color.magenta;
|
||||
private GameObject _cellPrefab;
|
||||
private TMP_Text _cellLabelPrefab;
|
||||
private Camera _camera;
|
||||
private HexCell[] _cells;
|
||||
private Canvas _gridCanvas;
|
||||
private GameObject _baseGameObject;
|
||||
public Action<HexCell> OnHexPainted;
|
||||
public Action OnGridLoaded;
|
||||
|
||||
private int _width;
|
||||
private int _height;
|
||||
private Color _defaultColor = Color.white;
|
||||
private Color _touchedColor = Color.magenta;
|
||||
private HexCell _cellPrefab;
|
||||
private Text _cellLabelPrefab;
|
||||
private Camera _camera;
|
||||
private HexCell[] _cells;
|
||||
private Canvas _gridCanvas;
|
||||
private HexMesh _hexMesh;
|
||||
private GameObject _baseGameObject;
|
||||
public Action<HexCoordinates> OnHexPainted;
|
||||
public HexGrid(FieldData fieldData)
|
||||
{
|
||||
_width = fieldData.width;
|
||||
_height = fieldData.height;
|
||||
_defaultColor = fieldData.defaultColor;
|
||||
_touchedColor = fieldData.touchedColor;
|
||||
_cellPrefab = fieldData.cellPrefab;
|
||||
_cellLabelPrefab = fieldData.cellLabelPrefab;
|
||||
_camera = Camera.main;
|
||||
_baseGameObject = new GameObject("HexGrid");
|
||||
|
||||
public HexGrid(FieldData fieldData)
|
||||
{
|
||||
_width = fieldData.width;
|
||||
_height = fieldData.height;
|
||||
_defaultColor = fieldData.defaultColor;
|
||||
_touchedColor = fieldData.touchedColor;
|
||||
_cellPrefab = fieldData.cellPrefab;
|
||||
_cellLabelPrefab = fieldData.cellLabelPrefab;
|
||||
_camera = Camera.main;
|
||||
_baseGameObject = new GameObject("HexGrid");
|
||||
|
||||
_gridCanvas = Object.Instantiate(fieldData.CoordinatesCanvas, _baseGameObject.transform).GetComponent<Canvas>();
|
||||
_hexMesh = Object.Instantiate(fieldData.HexMeshPrefab, _baseGameObject.transform).GetComponent<HexMesh>();
|
||||
}
|
||||
|
||||
_gridCanvas = Object.Instantiate(fieldData.CoordinatesCanvas, _baseGameObject.transform)
|
||||
.GetComponent<Canvas>();
|
||||
|
||||
}
|
||||
|
||||
void HandleInput () {
|
||||
Ray inputRay = _camera.ScreenPointToRay(Input.mousePosition);
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(inputRay, out hit)) {
|
||||
TouchCell(hit.point);
|
||||
}
|
||||
}
|
||||
public HexCell GetCellFromCoord(HexCoordinates coordinates)
|
||||
{
|
||||
var i = 0;
|
||||
while (!_cells[i++].coordinates.Equals(coordinates))
|
||||
{
|
||||
}
|
||||
|
||||
public void AddColorChangeListener(Action onColorChange)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TouchCell (Vector3 position) {
|
||||
position = _baseGameObject.transform.InverseTransformPoint(position);
|
||||
HexCoordinates coordinates = HexCoordinates.FromPosition(position);
|
||||
PaintHex(_touchedColor, coordinates);
|
||||
}
|
||||
return _cells[i - 1];
|
||||
}
|
||||
|
||||
private void PaintHex(Color color, HexCoordinates coordinates)
|
||||
{
|
||||
int index = coordinates.X + coordinates.Z * _width + coordinates.Z / 2;
|
||||
HexCell cell = _cells[index];
|
||||
cell.color = _touchedColor;
|
||||
_hexMesh.Triangulate(_cells);
|
||||
OnHexPainted.Invoke(coordinates);
|
||||
}
|
||||
void CreateCell (int x, int z, int i) {
|
||||
Vector3 position;
|
||||
position.x = (x + z * 0.5f - z / 2) * (HexMetrics.innerRadius * 2f);
|
||||
position.y = 0f;
|
||||
position.z = z * (HexMetrics.outerRadius * 1.5f);
|
||||
void HandleInput()
|
||||
{
|
||||
Ray inputRay = _camera.ScreenPointToRay(Input.mousePosition);
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(inputRay, out hit))
|
||||
{
|
||||
TouchCell(hit.point);
|
||||
}
|
||||
}
|
||||
|
||||
HexCell cell = _cells[i] = Object.Instantiate<HexCell>(_cellPrefab);
|
||||
cell.transform.SetParent(_baseGameObject.transform, false);
|
||||
cell.transform.localPosition = position;
|
||||
cell.coordinates = HexCoordinates.FromOffsetCoordinates(x, z);
|
||||
cell.color = _defaultColor;
|
||||
|
||||
Text label = Object.Instantiate<Text>(_cellLabelPrefab, _gridCanvas.transform, false);
|
||||
label.rectTransform.anchoredPosition =
|
||||
new Vector2(position.x, position.z);
|
||||
label.text = cell.coordinates.ToStringOnSeparateLines();
|
||||
}
|
||||
void TouchCell(Vector3 position)
|
||||
{
|
||||
position = _baseGameObject.transform.InverseTransformPoint(position);
|
||||
HexCoordinates coordinates = HexCoordinates.FromPosition(position);
|
||||
PaintHex(_touchedColor, coordinates);
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
|
||||
_cells = new HexCell[_height * _width];
|
||||
private void PaintHex(Color color, HexCoordinates coordinates)
|
||||
{
|
||||
int index = coordinates.X + coordinates.Z * _width + coordinates.Z / 2;
|
||||
HexCell cell = _cells[index];
|
||||
|
||||
cell.color = color;
|
||||
cell.gameObject.GetComponent<MeshRenderer>().material.color = color;
|
||||
OnHexPainted.Invoke(_cells[index]);
|
||||
}
|
||||
|
||||
for (int z = 0, i = 0; z < _height; z++) {
|
||||
for (int x = 0; x < _width; x++) {
|
||||
CreateCell(x, z, i++);
|
||||
}
|
||||
}
|
||||
_hexMesh.Triangulate(_cells);
|
||||
}
|
||||
void CreateCell(int x, int z, int i)
|
||||
{
|
||||
Vector3 position;
|
||||
position.x = (x + z * 0.5f - z / 2) * (HexMetrics.innerRadius * 2f);
|
||||
position.y = 0f;
|
||||
position.z = z * (HexMetrics.outerRadius * 1.5f);
|
||||
var cellGO = Object.Instantiate(_cellPrefab);
|
||||
HexCell cell = _cells[i] = cellGO.GetComponent<HexCell>();
|
||||
cell.transform.SetParent(_baseGameObject.transform, false);
|
||||
cell.transform.localPosition = position;
|
||||
cell.coordinates = HexCoordinates.FromOffsetCoordinates(x, z);
|
||||
cell.color = _defaultColor;
|
||||
|
||||
if (x > 0) {
|
||||
cell.SetNeighbor(HexDirection.W, _cells[i - 1]);
|
||||
}
|
||||
|
||||
if (z > 0) {
|
||||
if ((z & 1) == 0) {
|
||||
cell.SetNeighbor(HexDirection.SE, _cells[i - _width]);
|
||||
if (x > 0) {
|
||||
cell.SetNeighbor(HexDirection.SW, _cells[i - _width - 1]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
cell.SetNeighbor(HexDirection.SW, _cells[i - _width]);
|
||||
if (x < _width - 1) {
|
||||
cell.SetNeighbor(HexDirection.SE, _cells[i - _width + 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
if (Input.GetMouseButton(0)) {
|
||||
HandleInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
TMP_Text label = Object.Instantiate(_cellLabelPrefab, _gridCanvas.transform, false);
|
||||
label.rectTransform.anchoredPosition =
|
||||
new Vector2(position.x, position.z);
|
||||
label.text = cell.coordinates.ToStringOnSeparateLines();
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
_cells = new HexCell[_height * _width];
|
||||
|
||||
for (int z = 0, i = 0; z < _height; z++)
|
||||
{
|
||||
for (int x = 0; x < _width; x++)
|
||||
{
|
||||
CreateCell(x, z, i++);
|
||||
}
|
||||
}
|
||||
|
||||
// _hexMesh.Triangulate(_cells);
|
||||
OnGridLoaded.Invoke();
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
if (Input.GetMouseButton(0))
|
||||
{
|
||||
HandleInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HexFiled
|
||||
{
|
||||
[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))]
|
||||
public class HexMesh : MonoBehaviour {
|
||||
|
||||
Mesh hexMesh;
|
||||
List<Vector3> vertices;
|
||||
List<Color> colors;
|
||||
List<int> triangles;
|
||||
|
||||
MeshCollider meshCollider;
|
||||
|
||||
void Awake () {
|
||||
GetComponent<MeshFilter>().mesh = hexMesh = new Mesh();
|
||||
meshCollider = gameObject.AddComponent<MeshCollider>();
|
||||
hexMesh.name = "Hex Mesh";
|
||||
vertices = new List<Vector3>();
|
||||
colors = new List<Color>();
|
||||
triangles = new List<int>();
|
||||
}
|
||||
|
||||
public void Triangulate (HexCell[] cells) {
|
||||
hexMesh.Clear();
|
||||
vertices.Clear();
|
||||
colors.Clear();
|
||||
triangles.Clear();
|
||||
for (int i = 0; i < cells.Length; i++) {
|
||||
Triangulate(cells[i]);
|
||||
}
|
||||
hexMesh.vertices = vertices.ToArray();
|
||||
hexMesh.colors = colors.ToArray();
|
||||
hexMesh.triangles = triangles.ToArray();
|
||||
hexMesh.RecalculateNormals();
|
||||
meshCollider.sharedMesh = hexMesh;
|
||||
}
|
||||
|
||||
void Triangulate (HexCell cell) {
|
||||
Vector3 center = cell.transform.localPosition;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
AddTriangle(
|
||||
center,
|
||||
center + HexMetrics.corners[i],
|
||||
center + HexMetrics.corners[i + 1]
|
||||
);
|
||||
AddTriangleColor(cell.color);
|
||||
}
|
||||
}
|
||||
|
||||
void AddTriangle (Vector3 v1, Vector3 v2, Vector3 v3) {
|
||||
int vertexIndex = vertices.Count;
|
||||
vertices.Add(v1);
|
||||
vertices.Add(v2);
|
||||
vertices.Add(v3);
|
||||
triangles.Add(vertexIndex);
|
||||
triangles.Add(vertexIndex + 1);
|
||||
triangles.Add(vertexIndex + 2);
|
||||
}
|
||||
|
||||
void AddTriangleColor (Color color) {
|
||||
colors.Add(color);
|
||||
colors.Add(color);
|
||||
colors.Add(color);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c547250cafb924e6397c4c850c04fe5f
|
||||
timeCreated: 1453997337
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -4,7 +4,7 @@ namespace HexFiled
|
||||
{
|
||||
public static class HexMetrics {
|
||||
|
||||
public const float outerRadius = 10f;
|
||||
public const float outerRadius = 5f;
|
||||
|
||||
public const float innerRadius = outerRadius * 0.866025404f;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user