diff --git a/Assets/prefabs/HexSprite.prefab b/Assets/prefabs/HexSprite.prefab index 387d527..8c84268 100644 --- a/Assets/prefabs/HexSprite.prefab +++ b/Assets/prefabs/HexSprite.prefab @@ -10,7 +10,7 @@ GameObject: - 4: {fileID: 401170} - 212: {fileID: 21265262} - 114: {fileID: 11401426} - - 135: {fileID: 13500080} + - 136: {fileID: 13629080} m_Layer: 0 m_Name: HexSprite m_TagString: Untagged @@ -41,7 +41,7 @@ Transform: m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 118646} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: -16.8592148, y: -19.1385727, z: -17.4500065} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 445968} @@ -72,8 +72,9 @@ MonoBehaviour: m_EditorClassIdentifier: symbol: {fileID: 21241768} letterNum: 0 ---- !u!135 &13500080 -SphereCollider: + DefaultColor: {r: 1, g: 1, b: 1, a: 1} +--- !u!136 &13629080 +CapsuleCollider: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} @@ -81,8 +82,9 @@ SphereCollider: m_Material: {fileID: 0} m_IsTrigger: 1 m_Enabled: 1 - serializedVersion: 2 - m_Radius: .319999993 + m_Radius: .699999988 + m_Height: 4.23000002 + m_Direction: 2 m_Center: {x: 0, y: 0, z: 0} --- !u!212 &21241768 SpriteRenderer: @@ -147,6 +149,26 @@ Prefab: propertyPath: m_Enabled value: 0 objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: DefaultColor.r + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: DefaultColor.g + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: DefaultColor.b + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: DefaultColor.a + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: m_IsTrigger + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 0} m_RootGameObject: {fileID: 118646} diff --git a/Assets/prefabs/RuneTile.prefab b/Assets/prefabs/RuneTile.prefab index f0e6054..14c6adb 100644 --- a/Assets/prefabs/RuneTile.prefab +++ b/Assets/prefabs/RuneTile.prefab @@ -70,6 +70,8 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: symbol: {fileID: 21274894} + letterNum: 0 + DefaultColor: {r: 1, g: 1, b: 1, a: 1} --- !u!212 &21274894 SpriteRenderer: m_ObjectHideFlags: 1 @@ -128,7 +130,23 @@ Prefab: serializedVersion: 2 m_Modification: m_TransformParent: {fileID: 0} - m_Modifications: [] + m_Modifications: + - target: {fileID: 0} + propertyPath: DefaultColor.r + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: DefaultColor.g + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: DefaultColor.b + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: DefaultColor.a + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 0} m_RootGameObject: {fileID: 106228} diff --git a/Assets/scenes/GameplayScene.unity b/Assets/scenes/GameplayScene.unity index fffea18..cd7a344 100644 --- a/Assets/scenes/GameplayScene.unity +++ b/Assets/scenes/GameplayScene.unity @@ -1010,6 +1010,14 @@ Prefab: propertyPath: m_LocalScale.z value: 1 objectReference: {fileID: 0} + - target: {fileID: 198936, guid: d9aa98efb3480c8438047a4565cd1893, type: 2} + propertyPath: m_TagString + value: Player + objectReference: {fileID: 0} + - target: {fileID: 11431374, guid: d9aa98efb3480c8438047a4565cd1893, type: 2} + propertyPath: TrailColor.a + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: d9aa98efb3480c8438047a4565cd1893, type: 2} m_IsPrefabParent: 0 @@ -1615,6 +1623,22 @@ Prefab: propertyPath: m_LocalScale.z value: 1 objectReference: {fileID: 0} + - target: {fileID: 198936, guid: d9aa98efb3480c8438047a4565cd1893, type: 2} + propertyPath: m_TagString + value: Player + objectReference: {fileID: 0} + - target: {fileID: 11431374, guid: d9aa98efb3480c8438047a4565cd1893, type: 2} + propertyPath: TrailColor.r + value: .448275924 + objectReference: {fileID: 0} + - target: {fileID: 11431374, guid: d9aa98efb3480c8438047a4565cd1893, type: 2} + propertyPath: TrailColor.g + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 11431374, guid: d9aa98efb3480c8438047a4565cd1893, type: 2} + propertyPath: TrailColor.a + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: d9aa98efb3480c8438047a4565cd1893, type: 2} m_IsPrefabParent: 0 @@ -2052,82 +2076,21 @@ Prefab: propertyPath: DashForce value: 300 objectReference: {fileID: 0} + - target: {fileID: 198936, guid: d9aa98efb3480c8438047a4565cd1893, type: 2} + propertyPath: m_TagString + value: Player + objectReference: {fileID: 0} + - target: {fileID: 11431374, guid: d9aa98efb3480c8438047a4565cd1893, type: 2} + propertyPath: TrailColor.r + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 11431374, guid: d9aa98efb3480c8438047a4565cd1893, type: 2} + propertyPath: TrailColor.a + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: d9aa98efb3480c8438047a4565cd1893, type: 2} m_IsPrefabParent: 0 ---- !u!1 &1863264374 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 1863264378} - - 33: {fileID: 1863264377} - - 64: {fileID: 1863264376} - - 23: {fileID: 1863264375} - m_Layer: 0 - m_Name: Plane - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!23 &1863264375 -MeshRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1863264374} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_Materials: - - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} - m_SubsetIndices: - m_StaticBatchRoot: {fileID: 0} - m_UseLightProbes: 1 - m_ReflectionProbeUsage: 1 - m_ProbeAnchor: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 1 - m_ImportantGI: 0 - m_AutoUVMaxDistance: .5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!64 &1863264376 -MeshCollider: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1863264374} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Convex: 0 - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!33 &1863264377 -MeshFilter: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1863264374} - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &1863264378 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1863264374} - m_LocalRotation: {x: -1.15202326e-07, y: .707106709, z: -.707106829, w: -1.15202312e-07} - m_LocalPosition: {x: 0, y: 13.8000002, z: 143.5} - m_LocalScale: {x: 100, y: 1, z: 100} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 9 --- !u!1 &1874270281 stripped GameObject: m_PrefabParentObject: {fileID: 149060, guid: 435740a68d38e76438007304b084ccf7, type: 2} @@ -2239,6 +2202,22 @@ Prefab: propertyPath: DashColors.Array.data[1].b value: 0 objectReference: {fileID: 0} + - target: {fileID: 11404228, guid: 435740a68d38e76438007304b084ccf7, type: 2} + propertyPath: DashColors.Array.data[0].a + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 11404228, guid: 435740a68d38e76438007304b084ccf7, type: 2} + propertyPath: DashColors.Array.data[1].a + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 11404228, guid: 435740a68d38e76438007304b084ccf7, type: 2} + propertyPath: DashColors.Array.data[2].a + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 13625710, guid: 435740a68d38e76438007304b084ccf7, type: 2} + propertyPath: m_Enabled + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: 435740a68d38e76438007304b084ccf7, type: 2} m_IsPrefabParent: 0 diff --git a/Assets/scripts/Character.cs b/Assets/scripts/Character.cs index 281ca22..8795eab 100644 --- a/Assets/scripts/Character.cs +++ b/Assets/scripts/Character.cs @@ -11,6 +11,7 @@ public class Character : MonoBehaviour public float TurnSpeed; public float DashForce; public float DashCooldown; + public Color TrailColor; private Rigidbody rb; private Quaternion targetRot; diff --git a/Assets/scripts/RuneBehaviour.cs b/Assets/scripts/RuneBehaviour.cs index 1fedfe0..1c6565f 100644 --- a/Assets/scripts/RuneBehaviour.cs +++ b/Assets/scripts/RuneBehaviour.cs @@ -1,49 +1,77 @@ -using UnityEngine; -using System.Collections; - -public class RuneBehaviour : MonoBehaviour { - +using UnityEngine; +using System.Collections; + +public class RuneBehaviour : MonoBehaviour { + public static float range; public SpriteRenderer symbol; public int letterNum; - private float lightState = 0f; - public const float LightTime = 1.5f; - - // Use this for initialization - void Start () { - - } - - // Update is called once per frame - void Update () { - if (lightState > 0f) - { - lightState -= Time.deltaTime / LightTime; - if (lightState < 0) - lightState = 0; - symbol.color = new Color(1 - lightState, 1f, 1 - lightState); + private float elapsedTime = 0f; + public const float LightTime = 1.5f; + public Color DefaultColor; - //Mauve cool - //symbol.color = new Color(1f - lightState * 0.5f, 1f - lightState * 0.8f, 1f); + private Color targetColor; + private float sign = 0f; + private Character currentCharacter; - //symbol.color = new Color(1f - lightState * 0.4f, 1f - lightState * 0.4f, 1f); - } - + void Update () + { + if (sign == 0f) return; + + elapsedTime += Time.deltaTime * sign; + + float ratio = elapsedTime / LightTime; + + symbol.color = Color.Lerp(DefaultColor, targetColor, ratio); + + if (ratio < 0f || ratio > 1f) + { + sign = 0f; + } } - void OnTriggerStay(Collider col) - { - if (col.gameObject.tag == "Player") - { - lightState = 1f; - GameState.Instance.currentLevel.PressTile(letterNum); - } - } + void OnTriggerEnter(Collider col) + { + if (col.gameObject.tag == "Player" && currentCharacter == null) + { + currentCharacter = col.gameObject.GetComponent(); + + if (currentCharacter) + { + symbol.color = currentCharacter.TrailColor; + } + } + } + + void OnTriggerExit(Collider col) + { + if (col.gameObject.tag == "Player" && currentCharacter != null && currentCharacter.gameObject == col.gameObject) + { + StartCoroutine(FadeColorOut()); + } + } + + private IEnumerator FadeColorOut() + { + currentCharacter = null; + + Color startColor = symbol.color; + + float ratio = 0f; + + while (ratio < 1f) + { + ratio += Time.deltaTime / LightTime; + symbol.color = Color.Lerp(startColor, DefaultColor, ratio); + + yield return null; + } + } public void SetSymbol(int letterNum) { this.letterNum = letterNum; symbol.sprite = Resources.Load("runic_" + (char)('a' + letterNum)); - } -} + } +}