From ff45de1cbf9429644852b675d6f30ca9d2b3d7fc Mon Sep 17 00:00:00 2001 From: dddushesss <37773701+dddushesss@users.noreply.github.com> Date: Wed, 15 Dec 2021 15:58:32 +0300 Subject: [PATCH] added resources, joistics, CameraControl.cs, PlayerControl.cs, HexDirection.cs, changed one mesh map to multi mesh --- Assets/Materials/Vertex Colors.mat | 2 +- Assets/Prefab/Canvas.prefab | 4 +- Assets/Prefab/Hex Cell Label.prefab | 93 +++- Assets/Prefab/HexCell.prefab | 75 ++- Assets/Prefab/HexMesh.prefab | 96 ---- Assets/Prefab/HexMesh.prefab.meta | 7 - Assets/Resources/Data/Data.asset | 3 +- Assets/Resources/Data/FieldData.asset | 16 +- Assets/Scenes/SampleScene.unity | 500 +++++++++++++++++- Assets/Scripts/CameraControl.meta | 3 + Assets/Scripts/CameraControl/CameraControl.cs | 35 ++ .../CameraControl/CameraControl.cs.meta | 3 + Assets/Scripts/Chars/Player.cs | 24 +- Assets/Scripts/Chars/PlayerControl.cs | 2 +- Assets/Scripts/Chars/UnitFactory.cs | 19 + Assets/Scripts/Chars/UnitFactory.cs.meta | 3 + Assets/Scripts/Controller/Controllers.cs | 25 +- Assets/Scripts/Controller/GameController.cs | 15 +- Assets/Scripts/Controller/GameInit.cs | 22 +- Assets/Scripts/Controller/IAwake.cs | 9 + Assets/Scripts/Controller/IAwake.cs.meta | 3 + Assets/Scripts/Controller/IFixedExecute.cs | 9 + .../Scripts/Controller/IFixedExecute.cs.meta | 3 + Assets/Scripts/Data/CameraData.cs | 11 + Assets/Scripts/Data/CameraData.cs.meta | 3 + Assets/Scripts/Data/Data.cs | 38 +- Assets/Scripts/Data/FieldData.cs | 6 +- Assets/Scripts/Data/PlayerData.cs | 13 + Assets/Scripts/Data/PlayerData.cs.meta | 3 + Assets/Scripts/Editor/HexCoordinatesDrawer.cs | 22 - .../Editor/HexCoordinatesDrawer.cs.meta | 12 - Assets/Scripts/HexFiled/HexCell.cs | 19 +- Assets/Scripts/HexFiled/HexCoordinates.cs | 44 +- Assets/Scripts/HexFiled/HexDirection.cs | 15 + Assets/Scripts/HexFiled/HexDirection.cs.meta | 3 + Assets/Scripts/HexFiled/HexGrid.cs | 209 +++++--- Assets/Scripts/HexFiled/HexMesh.cs | 68 --- Assets/Scripts/HexFiled/HexMesh.cs.meta | 12 - Assets/Scripts/HexFiled/HexMetrics.cs | 2 +- 39 files changed, 1076 insertions(+), 375 deletions(-) delete mode 100644 Assets/Prefab/HexMesh.prefab delete mode 100644 Assets/Prefab/HexMesh.prefab.meta create mode 100644 Assets/Scripts/CameraControl.meta create mode 100644 Assets/Scripts/CameraControl/CameraControl.cs create mode 100644 Assets/Scripts/CameraControl/CameraControl.cs.meta create mode 100644 Assets/Scripts/Chars/UnitFactory.cs create mode 100644 Assets/Scripts/Chars/UnitFactory.cs.meta create mode 100644 Assets/Scripts/Controller/IAwake.cs create mode 100644 Assets/Scripts/Controller/IAwake.cs.meta create mode 100644 Assets/Scripts/Controller/IFixedExecute.cs create mode 100644 Assets/Scripts/Controller/IFixedExecute.cs.meta create mode 100644 Assets/Scripts/Data/CameraData.cs create mode 100644 Assets/Scripts/Data/CameraData.cs.meta create mode 100644 Assets/Scripts/Data/PlayerData.cs create mode 100644 Assets/Scripts/Data/PlayerData.cs.meta delete mode 100644 Assets/Scripts/Editor/HexCoordinatesDrawer.cs delete mode 100644 Assets/Scripts/Editor/HexCoordinatesDrawer.cs.meta create mode 100644 Assets/Scripts/HexFiled/HexDirection.cs create mode 100644 Assets/Scripts/HexFiled/HexDirection.cs.meta delete mode 100644 Assets/Scripts/HexFiled/HexMesh.cs delete mode 100644 Assets/Scripts/HexFiled/HexMesh.cs.meta diff --git a/Assets/Materials/Vertex Colors.mat b/Assets/Materials/Vertex Colors.mat index 7a4d5f73..e441a671 100644 --- a/Assets/Materials/Vertex Colors.mat +++ b/Assets/Materials/Vertex Colors.mat @@ -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: diff --git a/Assets/Prefab/Canvas.prefab b/Assets/Prefab/Canvas.prefab index 52e67172..13ff09be 100644 --- a/Assets/Prefab/Canvas.prefab +++ b/Assets/Prefab/Canvas.prefab @@ -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 diff --git a/Assets/Prefab/Hex Cell Label.prefab b/Assets/Prefab/Hex Cell Label.prefab index eb19a576..06a732c0 100644 --- a/Assets/Prefab/Hex Cell Label.prefab +++ b/Assets/Prefab/Hex Cell Label.prefab @@ -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} diff --git a/Assets/Prefab/HexCell.prefab b/Assets/Prefab/HexCell.prefab index 1a0291d4..08ae72d4 100644 --- a/Assets/Prefab/HexCell.prefab +++ b/Assets/Prefab/HexCell.prefab @@ -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} diff --git a/Assets/Prefab/HexMesh.prefab b/Assets/Prefab/HexMesh.prefab deleted file mode 100644 index 2ee10aeb..00000000 --- a/Assets/Prefab/HexMesh.prefab +++ /dev/null @@ -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: diff --git a/Assets/Prefab/HexMesh.prefab.meta b/Assets/Prefab/HexMesh.prefab.meta deleted file mode 100644 index 59c1207e..00000000 --- a/Assets/Prefab/HexMesh.prefab.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 3af15cc359f2a714f8e880d401a0c029 -PrefabImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Resources/Data/Data.asset b/Assets/Resources/Data/Data.asset index cd44ba8e..d6620ba9 100644 --- a/Assets/Resources/Data/Data.asset +++ b/Assets/Resources/Data/Data.asset @@ -13,4 +13,5 @@ MonoBehaviour: m_Name: Data m_EditorClassIdentifier: fieldDataPath: FieldData - tagDataPath: + cameraDataPath: CameraData + playerDataPath: PlayerData diff --git a/Assets/Resources/Data/FieldData.asset b/Assets/Resources/Data/FieldData.asset index fb4b8308..37c73b00 100644 --- a/Assets/Resources/Data/FieldData.asset +++ b/Assets/Resources/Data/FieldData.asset @@ -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} diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index fde41022..0af4ebb9 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -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} diff --git a/Assets/Scripts/CameraControl.meta b/Assets/Scripts/CameraControl.meta new file mode 100644 index 00000000..97e501e3 --- /dev/null +++ b/Assets/Scripts/CameraControl.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5c9907af33384f2c94f5fc0eb6e840cd +timeCreated: 1639489317 \ No newline at end of file diff --git a/Assets/Scripts/CameraControl/CameraControl.cs b/Assets/Scripts/CameraControl/CameraControl.cs new file mode 100644 index 00000000..ed53c943 --- /dev/null +++ b/Assets/Scripts/CameraControl/CameraControl.cs @@ -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); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/CameraControl/CameraControl.cs.meta b/Assets/Scripts/CameraControl/CameraControl.cs.meta new file mode 100644 index 00000000..ec8bba32 --- /dev/null +++ b/Assets/Scripts/CameraControl/CameraControl.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ff2c85619d7b4d69a27626e3e3314d6e +timeCreated: 1639489317 \ No newline at end of file diff --git a/Assets/Scripts/Chars/Player.cs b/Assets/Scripts/Chars/Player.cs index 3c22f9cb..69992536 100644 --- a/Assets/Scripts/Chars/Player.cs +++ b/Assets/Scripts/Chars/Player.cs @@ -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() diff --git a/Assets/Scripts/Chars/PlayerControl.cs b/Assets/Scripts/Chars/PlayerControl.cs index 5d42f5c9..02a5ef8c 100644 --- a/Assets/Scripts/Chars/PlayerControl.cs +++ b/Assets/Scripts/Chars/PlayerControl.cs @@ -13,7 +13,7 @@ namespace Chars public void Execute() { - throw new System.NotImplementedException(); + } } } \ No newline at end of file diff --git a/Assets/Scripts/Chars/UnitFactory.cs b/Assets/Scripts/Chars/UnitFactory.cs new file mode 100644 index 00000000..1fea1234 --- /dev/null +++ b/Assets/Scripts/Chars/UnitFactory.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; + +namespace Chars +{ + public class UnitFactory + { + private List _units; + + public UnitFactory(List units) + { + _units = units; + } + + public void Spawn() + { + _units.ForEach(x => x.Spawn()); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Chars/UnitFactory.cs.meta b/Assets/Scripts/Chars/UnitFactory.cs.meta new file mode 100644 index 00000000..dd03cc23 --- /dev/null +++ b/Assets/Scripts/Chars/UnitFactory.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d0fc814f372747debe865aa87fc8032c +timeCreated: 1639490545 \ No newline at end of file diff --git a/Assets/Scripts/Controller/Controllers.cs b/Assets/Scripts/Controller/Controllers.cs index f8bda177..90e45ada 100644 --- a/Assets/Scripts/Controller/Controllers.cs +++ b/Assets/Scripts/Controller/Controllers.cs @@ -9,6 +9,8 @@ namespace Controller private readonly List _executeControllers; private readonly List _lateControllers; private readonly List _cleanupControllers; + private readonly List _fixedExecuteControllers; + private readonly List _awakeExecuteControllers; public Controllers() { @@ -16,6 +18,7 @@ namespace Controller _executeControllers = new List(); _lateControllers = new List(); _cleanupControllers = new List(); + _fixedExecuteControllers = new List(); } 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()); } } + + } diff --git a/Assets/Scripts/Controller/GameController.cs b/Assets/Scripts/Controller/GameController.cs index 5b6f1474..5c79cdf9 100644 --- a/Assets/Scripts/Controller/GameController.cs +++ b/Assets/Scripts/Controller/GameController.cs @@ -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(); diff --git a/Assets/Scripts/Controller/GameInit.cs b/Assets/Scripts/Controller/GameInit.cs index daeaa215..e2be7804 100644 --- a/Assets/Scripts/Controller/GameInit.cs +++ b/Assets/Scripts/Controller/GameInit.cs @@ -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 units = new List { 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 ); } } } \ No newline at end of file diff --git a/Assets/Scripts/Controller/IAwake.cs b/Assets/Scripts/Controller/IAwake.cs new file mode 100644 index 00000000..e120fbca --- /dev/null +++ b/Assets/Scripts/Controller/IAwake.cs @@ -0,0 +1,9 @@ +using Runtime.Controller; + +namespace Controller +{ + public interface IAwake : IController + { + void Awake(); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Controller/IAwake.cs.meta b/Assets/Scripts/Controller/IAwake.cs.meta new file mode 100644 index 00000000..76b13d82 --- /dev/null +++ b/Assets/Scripts/Controller/IAwake.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b851dab58d414a5b8dec4b27e6be45ce +timeCreated: 1639502375 \ No newline at end of file diff --git a/Assets/Scripts/Controller/IFixedExecute.cs b/Assets/Scripts/Controller/IFixedExecute.cs new file mode 100644 index 00000000..c3db1f1b --- /dev/null +++ b/Assets/Scripts/Controller/IFixedExecute.cs @@ -0,0 +1,9 @@ +using Runtime.Controller; + +namespace Controller +{ + public interface IFixedExecute : IController + { + void FixedExecute(); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Controller/IFixedExecute.cs.meta b/Assets/Scripts/Controller/IFixedExecute.cs.meta new file mode 100644 index 00000000..bdda70ab --- /dev/null +++ b/Assets/Scripts/Controller/IFixedExecute.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 54387d683d184cba82a65609918f7ebc +timeCreated: 1639489539 \ No newline at end of file diff --git a/Assets/Scripts/Data/CameraData.cs b/Assets/Scripts/Data/CameraData.cs new file mode 100644 index 00000000..112f24b0 --- /dev/null +++ b/Assets/Scripts/Data/CameraData.cs @@ -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; + } +} \ No newline at end of file diff --git a/Assets/Scripts/Data/CameraData.cs.meta b/Assets/Scripts/Data/CameraData.cs.meta new file mode 100644 index 00000000..1d4e2efb --- /dev/null +++ b/Assets/Scripts/Data/CameraData.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 83b1020f31bf45569f5af6c77fc77d4e +timeCreated: 1639489869 \ No newline at end of file diff --git a/Assets/Scripts/Data/Data.cs b/Assets/Scripts/Data/Data.cs index 72ac7fe9..884bba31 100644 --- a/Assets/Scripts/Data/Data.cs +++ b/Assets/Scripts/Data/Data.cs @@ -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("Data/" + cameraDataPath); + } + + return _cameraData; + } + } + + public PlayerData PlayerData + { + get + { + if (_playerData == null) + { + _playerData = Load("Data/" + playerDataPath); + } + + return _playerData; + } + } + + private static T Load(string resourcesPath) where T : Object => Resources.Load(Path.ChangeExtension(resourcesPath, null)); } diff --git a/Assets/Scripts/Data/FieldData.cs b/Assets/Scripts/Data/FieldData.cs index 4cca6604..42aeedb3 100644 --- a/Assets/Scripts/Data/FieldData.cs +++ b/Assets/Scripts/Data/FieldData.cs @@ -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; } } \ No newline at end of file diff --git a/Assets/Scripts/Data/PlayerData.cs b/Assets/Scripts/Data/PlayerData.cs new file mode 100644 index 00000000..32d47ea2 --- /dev/null +++ b/Assets/Scripts/Data/PlayerData.cs @@ -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; + } +} \ No newline at end of file diff --git a/Assets/Scripts/Data/PlayerData.cs.meta b/Assets/Scripts/Data/PlayerData.cs.meta new file mode 100644 index 00000000..a5b48d82 --- /dev/null +++ b/Assets/Scripts/Data/PlayerData.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 2d46325a4e4e45338d7e9733fb8d6013 +timeCreated: 1639490671 \ No newline at end of file diff --git a/Assets/Scripts/Editor/HexCoordinatesDrawer.cs b/Assets/Scripts/Editor/HexCoordinatesDrawer.cs deleted file mode 100644 index 7820a87c..00000000 --- a/Assets/Scripts/Editor/HexCoordinatesDrawer.cs +++ /dev/null @@ -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()); - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Editor/HexCoordinatesDrawer.cs.meta b/Assets/Scripts/Editor/HexCoordinatesDrawer.cs.meta deleted file mode 100644 index e71d8870..00000000 --- a/Assets/Scripts/Editor/HexCoordinatesDrawer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: cf163438e85b942b09b24ae506a54813 -timeCreated: 1454007190 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/HexFiled/HexCell.cs b/Assets/Scripts/HexFiled/HexCell.cs index d45dfd11..607b3bd6 100644 --- a/Assets/Scripts/HexFiled/HexCell.cs +++ b/Assets/Scripts/HexFiled/HexCell.cs @@ -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; + } } -} \ No newline at end of file +} diff --git a/Assets/Scripts/HexFiled/HexCoordinates.cs b/Assets/Scripts/HexFiled/HexCoordinates.cs index 1cfb43dd..709e16e7 100644 --- a/Assets/Scripts/HexFiled/HexCoordinates.cs +++ b/Assets/Scripts/HexFiled/HexCoordinates.cs @@ -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() + ")"; diff --git a/Assets/Scripts/HexFiled/HexDirection.cs b/Assets/Scripts/HexFiled/HexDirection.cs new file mode 100644 index 00000000..4aa742bf --- /dev/null +++ b/Assets/Scripts/HexFiled/HexDirection.cs @@ -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); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/HexFiled/HexDirection.cs.meta b/Assets/Scripts/HexFiled/HexDirection.cs.meta new file mode 100644 index 00000000..9a54e3d2 --- /dev/null +++ b/Assets/Scripts/HexFiled/HexDirection.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 55ce0e8afc5740f4acb30b24abb165aa +timeCreated: 1639523579 \ No newline at end of file diff --git a/Assets/Scripts/HexFiled/HexGrid.cs b/Assets/Scripts/HexFiled/HexGrid.cs index e93bd52c..1ddce67c 100644 --- a/Assets/Scripts/HexFiled/HexGrid.cs +++ b/Assets/Scripts/HexFiled/HexGrid.cs @@ -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 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 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(); - _hexMesh = Object.Instantiate(fieldData.HexMeshPrefab, _baseGameObject.transform).GetComponent(); - } - + _gridCanvas = Object.Instantiate(fieldData.CoordinatesCanvas, _baseGameObject.transform) + .GetComponent(); + + } - 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(_cellPrefab); - cell.transform.SetParent(_baseGameObject.transform, false); - cell.transform.localPosition = position; - cell.coordinates = HexCoordinates.FromOffsetCoordinates(x, z); - cell.color = _defaultColor; - Text label = Object.Instantiate(_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().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(); + 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(); + } + } + } } \ No newline at end of file diff --git a/Assets/Scripts/HexFiled/HexMesh.cs b/Assets/Scripts/HexFiled/HexMesh.cs deleted file mode 100644 index e144e092..00000000 --- a/Assets/Scripts/HexFiled/HexMesh.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace HexFiled -{ - [RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))] - public class HexMesh : MonoBehaviour { - - Mesh hexMesh; - List vertices; - List colors; - List triangles; - - MeshCollider meshCollider; - - void Awake () { - GetComponent().mesh = hexMesh = new Mesh(); - meshCollider = gameObject.AddComponent(); - hexMesh.name = "Hex Mesh"; - vertices = new List(); - colors = new List(); - triangles = new List(); - } - - 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); - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/HexFiled/HexMesh.cs.meta b/Assets/Scripts/HexFiled/HexMesh.cs.meta deleted file mode 100644 index 660535b1..00000000 --- a/Assets/Scripts/HexFiled/HexMesh.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: c547250cafb924e6397c4c850c04fe5f -timeCreated: 1453997337 -licenseType: Pro -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/HexFiled/HexMetrics.cs b/Assets/Scripts/HexFiled/HexMetrics.cs index 1cb6c221..5ddc3b12 100644 --- a/Assets/Scripts/HexFiled/HexMetrics.cs +++ b/Assets/Scripts/HexFiled/HexMetrics.cs @@ -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;