diff --git a/Assets/Materials.meta b/Assets/Materials.meta deleted file mode 100644 index 6b358a8e..00000000 --- a/Assets/Materials.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 7e1a318c8d9fd41a1928e605163c3994 -folderAsset: yes -timeCreated: 1454018238 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Materials/Vertex Colors.mat b/Assets/Materials/Vertex Colors.mat deleted file mode 100644 index e441a671..00000000 --- a/Assets/Materials/Vertex Colors.mat +++ /dev/null @@ -1,74 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!21 &2100000 -Material: - serializedVersion: 6 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Vertex Colors - m_Shader: {fileID: 4800000, guid: 933d1387820694f55b3255b64eb5afcc, type: 3} - m_ShaderKeywords: - m_LightmapFlags: 5 - m_EnableInstancingVariants: 0 - m_DoubleSidedGI: 0 - m_CustomRenderQueue: 2000 - stringTagMap: {} - disabledShaderPasses: [] - m_SavedProperties: - serializedVersion: 3 - m_TexEnvs: - - _BumpMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailAlbedoMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailMask: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _DetailNormalMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _EmissionMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MainTex: - m_Texture: {fileID: 2800000, guid: 983242f4b4db7a841af48234cf0021b8, type: 3} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _MetallicGlossMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _OcclusionMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - _ParallaxMap: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Floats: - - _BumpScale: 1 - - _Cutoff: 0.5 - - _DetailNormalMapScale: 1 - - _DstBlend: 0 - - _Glossiness: 0.5 - - _Metallic: 0 - - _Mode: 0 - - _OcclusionStrength: 1 - - _Parallax: 0.02 - - _SrcBlend: 1 - - _UVSec: 0 - - _ZWrite: 1 - m_Colors: - - _Color: {r: 1, g: 1, b: 1, a: 1} - - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - m_BuildTextureStacks: [] diff --git a/Assets/Materials/Vertex Colors.mat.meta b/Assets/Materials/Vertex Colors.mat.meta deleted file mode 100644 index e071a64d..00000000 --- a/Assets/Materials/Vertex Colors.mat.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6a3f5c7892e4b478e9e745026e6fe9f7 -timeCreated: 1454018353 -licenseType: Pro -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Materials/VertexColors.shader b/Assets/Materials/VertexColors.shader deleted file mode 100644 index c2714dd4..00000000 --- a/Assets/Materials/VertexColors.shader +++ /dev/null @@ -1,37 +0,0 @@ -Shader "Custom/VertexColors" { - Properties { - _Color ("Color", Color) = (1,1,1,1) - _MainTex ("Albedo (RGB)", 2D) = "white" {} - _Glossiness ("Smoothness", Range(0,1)) = 0.5 - _Metallic ("Metallic", Range(0,1)) = 0.0 - } - SubShader { - Tags { "RenderType"="Opaque" } - LOD 200 - - CGPROGRAM - #pragma surface surf Standard fullforwardshadows - #pragma target 3.0 - - sampler2D _MainTex; - - struct Input { - float2 uv_MainTex; - float4 color : COLOR; - }; - - half _Glossiness; - half _Metallic; - fixed4 _Color; - - void surf (Input IN, inout SurfaceOutputStandard o) { - fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color; - o.Albedo = c.rgb * IN.color; - o.Metallic = _Metallic; - o.Smoothness = _Glossiness; - o.Alpha = c.a; - } - ENDCG - } - FallBack "Diffuse" -} \ No newline at end of file diff --git a/Assets/Materials/VertexColors.shader.meta b/Assets/Materials/VertexColors.shader.meta deleted file mode 100644 index b1e2fc8b..00000000 --- a/Assets/Materials/VertexColors.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 933d1387820694f55b3255b64eb5afcc -timeCreated: 1454018276 -licenseType: Pro -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Prefab/Canvas.prefab b/Assets/Prefab/Canvas.prefab index 13ff09be..50d1cfc0 100644 --- a/Assets/Prefab/Canvas.prefab +++ b/Assets/Prefab/Canvas.prefab @@ -80,4 +80,4 @@ MonoBehaviour: m_FallbackScreenDPI: 96 m_DefaultSpriteDPI: 96 m_DynamicPixelsPerUnit: 10 - m_PresetInfoIsWorld: 0 + m_PresetInfoIsWorld: 1 diff --git a/Assets/Prefab/HexCell.prefab b/Assets/Prefab/HexCell.prefab index 08ae72d4..4176b9a9 100644 --- a/Assets/Prefab/HexCell.prefab +++ b/Assets/Prefab/HexCell.prefab @@ -29,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: 5, y: 1, z: 5} + m_LocalScale: {x: 0.95, y: 1, z: 0.95} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 @@ -84,7 +84,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: 6a3f5c7892e4b478e9e745026e6fe9f7, type: 2} + - {fileID: 2100000, guid: c02e8d529be43e94ab7b3ebd42206ef3, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 diff --git a/Assets/Resources/1/Animation/Character/Animator_Character.controller b/Assets/Resources/1/Animation/Character/Animator_Character.controller index 140f886f..6bf9579c 100644 --- a/Assets/Resources/1/Animation/Character/Animator_Character.controller +++ b/Assets/Resources/1/Animation/Character/Animator_Character.controller @@ -489,6 +489,28 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 +--- !u!1101 &4538047501552815396 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 9131620394910522952} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.53125 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1101 &4600196034638274153 AnimatorStateTransition: m_ObjectHideFlags: 1 @@ -548,6 +570,7 @@ AnimatorState: - {fileID: -6460354900618266653} - {fileID: -9165632119200558840} - {fileID: -528955148574366107} + - {fileID: 4538047501552815396} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 diff --git a/Assets/Resources/1/Animation/Character/TestController.controller b/Assets/Resources/1/Animation/Character/TestController.controller index d4d9ac34..f879d988 100644 --- a/Assets/Resources/1/Animation/Character/TestController.controller +++ b/Assets/Resources/1/Animation/Character/TestController.controller @@ -400,49 +400,49 @@ AnimatorController: m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: BackToIdle m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: Build m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: TreeAttack m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: Move m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: SuperJump m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: Frozen m_Type: 9 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: isMoving m_Type: 4 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} m_AnimatorLayers: - serializedVersion: 5 m_Name: Base Layer diff --git a/Assets/Resources/1/Character/Prefab/Asvald.prefab b/Assets/Resources/1/Character/Prefab/Asvald.prefab index 2fe454f3..57d49012 100644 --- a/Assets/Resources/1/Character/Prefab/Asvald.prefab +++ b/Assets/Resources/1/Character/Prefab/Asvald.prefab @@ -2984,7 +2984,7 @@ Animator: m_GameObject: {fileID: 7527582019267571087} m_Enabled: 1 m_Avatar: {fileID: 0} - m_Controller: {fileID: 9100000, guid: 6c6726efa8f26a44c89dbcc255bf46f9, type: 2} + m_Controller: {fileID: 9100000, guid: 9e1a6090cd4d65d4599676c24fcb5cff, type: 2} m_CullingMode: 0 m_UpdateMode: 0 m_ApplyRootMotion: 0 diff --git a/Assets/Resources/Data/CameraData.asset b/Assets/Resources/Data/CameraData.asset index d81f0db2..df0bb78b 100644 --- a/Assets/Resources/Data/CameraData.asset +++ b/Assets/Resources/Data/CameraData.asset @@ -12,5 +12,5 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 83b1020f31bf45569f5af6c77fc77d4e, type: 3} m_Name: CameraData m_EditorClassIdentifier: - offset: {x: -10, y: 15, z: -15} - smoothSpeed: 0.001 + offset: {x: 0, y: 15, z: -5} + smoothSpeed: 2 diff --git a/Assets/Resources/Data/PlayerData.asset b/Assets/Resources/Data/PlayerData.asset index c128e869..17438812 100644 --- a/Assets/Resources/Data/PlayerData.asset +++ b/Assets/Resources/Data/PlayerData.asset @@ -20,3 +20,4 @@ MonoBehaviour: joystickView: {fileID: 4385872142190176059, guid: 4df6913b39f4979429158c344680d83f, type: 3} Tick: 0.8 + hexTexture: {fileID: 2800000, guid: 0298dfcb0756f534a9a125d510461c7a, type: 3} diff --git a/Assets/Scripts/CamControl/CameraControl.cs b/Assets/Scripts/CamControl/CameraControl.cs index 1626dd8a..35186e47 100644 --- a/Assets/Scripts/CamControl/CameraControl.cs +++ b/Assets/Scripts/CamControl/CameraControl.cs @@ -31,7 +31,7 @@ namespace CamControl Vector3 desiredPosition = _target.position + _offset; Vector3 smothedPosition = Vector3.Lerp(_camera.transform.position, desiredPosition, _smoothSpeed * Time.deltaTime); - _camera.transform.position = desiredPosition; + _camera.transform.position = smothedPosition; _camera.transform.LookAt(_target); } } diff --git a/Assets/Scripts/Chars/Player.cs b/Assets/Scripts/Chars/Player.cs index b1a02910..c8e53112 100644 --- a/Assets/Scripts/Chars/Player.cs +++ b/Assets/Scripts/Chars/Player.cs @@ -1,6 +1,7 @@ using System; using Data; using HexFiled; +using TMPro; using UnityEngine; using Object = UnityEngine.Object; @@ -14,6 +15,7 @@ namespace Chars private GameObject prefab; private HexCell _cell; private HexGrid _hexGrid; + private Texture _texture; public Action OnPlayerSpawned; public GameObject Playerinstance => _instance; @@ -24,6 +26,7 @@ namespace Chars prefab = playerData.playerPrefab; _isAlive = false; _hexGrid = hexGrid; + _texture = playerData.hexTexture; } @@ -33,7 +36,7 @@ namespace Chars { _cell = _cell.GetNeighbor(direction); _curentPosition = _cell.coordinates; - + _cell.PaintHex(_texture); _instance.transform.localPosition = _cell.transform.localPosition; } } @@ -43,9 +46,15 @@ namespace Chars if (!_isAlive) { _cell = _hexGrid.GetCellFromCoord(_curentPosition); + _cell.PaintHex(_texture); + for (int i = 0; i < 6; i++) + { + _cell.GetNeighbor((HexDirection)i).PaintHex(_texture); + } _instance = Object.Instantiate(prefab, _cell.transform.parent); _instance.transform.localPosition = _cell.transform.localPosition; OnPlayerSpawned?.Invoke(_instance); + _isAlive = true; } } diff --git a/Assets/Scripts/Data/FieldData.cs b/Assets/Scripts/Data/FieldData.cs index 42aeedb3..7c79a0c9 100644 --- a/Assets/Scripts/Data/FieldData.cs +++ b/Assets/Scripts/Data/FieldData.cs @@ -16,5 +16,6 @@ namespace Runtime.Data public GameObject cellPrefab; public TMP_Text cellLabelPrefab; public GameObject CoordinatesCanvas; + public Texture DefaultTexture; } } \ No newline at end of file diff --git a/Assets/Scripts/Data/PlayerData.cs b/Assets/Scripts/Data/PlayerData.cs index 722d1474..0c93873f 100644 --- a/Assets/Scripts/Data/PlayerData.cs +++ b/Assets/Scripts/Data/PlayerData.cs @@ -11,5 +11,6 @@ namespace Data public GameObject playerPrefab; public PlayerControlView joystickView; public float Tick; + public Texture hexTexture; } } \ No newline at end of file diff --git a/Assets/Scripts/HexFiled/HexCell.cs b/Assets/Scripts/HexFiled/HexCell.cs index 607b3bd6..eb89b8f2 100644 --- a/Assets/Scripts/HexFiled/HexCell.cs +++ b/Assets/Scripts/HexFiled/HexCell.cs @@ -1,4 +1,5 @@ -using UnityEngine; +using System; +using UnityEngine; namespace HexFiled { @@ -7,8 +8,10 @@ namespace HexFiled public HexCoordinates coordinates; public Color color; + public Action OnHexPainted; [SerializeField] private HexCell[] neighbors; + private static readonly int Player = Shader.PropertyToID("player"); public HexCell GetNeighbor(HexDirection direction) { @@ -20,5 +23,11 @@ namespace HexFiled neighbors[(int)direction] = cell; cell.neighbors[(int)direction.Opposite()] = this; } + + public void PaintHex(Texture texture) + { + gameObject.GetComponent().material.mainTexture = texture; + OnHexPainted?.Invoke(this); + } } } diff --git a/Assets/Scripts/HexFiled/HexGrid.cs b/Assets/Scripts/HexFiled/HexGrid.cs index 1ddce67c..e0291f16 100644 --- a/Assets/Scripts/HexFiled/HexGrid.cs +++ b/Assets/Scripts/HexFiled/HexGrid.cs @@ -7,7 +7,7 @@ using Object = UnityEngine.Object; namespace HexFiled { - public class HexGrid : IInitialization, IExecute + public class HexGrid : IInitialization { private int _width; private int _height; @@ -48,24 +48,6 @@ namespace HexFiled return _cells[i - 1]; } - void HandleInput() - { - Ray inputRay = _camera.ScreenPointToRay(Input.mousePosition); - RaycastHit hit; - if (Physics.Raycast(inputRay, out hit)) - { - TouchCell(hit.point); - } - } - - - void TouchCell(Vector3 position) - { - position = _baseGameObject.transform.InverseTransformPoint(position); - HexCoordinates coordinates = HexCoordinates.FromPosition(position); - PaintHex(_touchedColor, coordinates); - } - private void PaintHex(Color color, HexCoordinates coordinates) { int index = coordinates.X + coordinates.Z * _width + coordinates.Z / 2; @@ -88,6 +70,7 @@ namespace HexFiled cell.transform.localPosition = position; cell.coordinates = HexCoordinates.FromOffsetCoordinates(x, z); cell.color = _defaultColor; + cell.OnHexPainted += OnHexPainted; if (x > 0) { cell.SetNeighbor(HexDirection.W, _cells[i - 1]); @@ -129,13 +112,6 @@ namespace HexFiled // _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/HexMetrics.cs b/Assets/Scripts/HexFiled/HexMetrics.cs index 5ddc3b12..71d3350d 100644 --- a/Assets/Scripts/HexFiled/HexMetrics.cs +++ b/Assets/Scripts/HexFiled/HexMetrics.cs @@ -4,18 +4,10 @@ namespace HexFiled { public static class HexMetrics { - public const float outerRadius = 5f; + public const float outerRadius = 1f; public const float innerRadius = outerRadius * 0.866025404f; - public static Vector3[] corners = { - new Vector3(0f, 0f, outerRadius), - new Vector3(innerRadius, 0f, 0.5f * outerRadius), - new Vector3(innerRadius, 0f, -0.5f * outerRadius), - new Vector3(0f, 0f, -outerRadius), - new Vector3(-innerRadius, 0f, -0.5f * outerRadius), - new Vector3(-innerRadius, 0f, 0.5f * outerRadius), - new Vector3(0f, 0f, outerRadius) - }; + } } \ No newline at end of file