From ad52d6a46595b0a8915484e6a30ad466fa57bee1 Mon Sep 17 00:00:00 2001 From: Zaphyk Date: Fri, 10 Nov 2017 03:33:02 -0300 Subject: [PATCH] added color timer --- Assets/Game.unity | 36 +++++++++++++++++++++++++----------- Assets/MaterialManager.cs | 14 +++++++++++++- Assets/Movement.cs | 2 +- Assets/Terrain.mat | 8 ++++---- project-skylines.userprefs | 13 +++++++------ 5 files changed, 50 insertions(+), 23 deletions(-) diff --git a/Assets/Game.unity b/Assets/Game.unity index 495fe6a..c86505f 100644 --- a/Assets/Game.unity +++ b/Assets/Game.unity @@ -408,7 +408,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: TargetShip: {fileID: 1582243898} - Offset: {x: 0, y: 1, z: 10} + Offset: {x: 0, y: 10, z: 4} --- !u!114 &729518489 MonoBehaviour: m_ObjectHideFlags: 0 @@ -509,7 +509,7 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 400000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} propertyPath: m_LocalRotation.x - value: 0 + value: -0.7071068 objectReference: {fileID: 0} - target: {fileID: 400000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} propertyPath: m_LocalRotation.y @@ -521,7 +521,7 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 400000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} propertyPath: m_LocalRotation.w - value: 1 + value: 0.7071068 objectReference: {fileID: 0} - target: {fileID: 400000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} propertyPath: m_RootOrder @@ -553,7 +553,7 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 400000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} propertyPath: m_LocalEulerAnglesHint.x - value: 0 + value: -90 objectReference: {fileID: 0} m_RemovedComponents: - {fileID: 9500000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} @@ -600,7 +600,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 9b67576e7da945d4abe2e66b1d91a4a9, type: 3} m_Name: m_EditorClassIdentifier: - Speed: 0 + Speed: 6 + TurnSpeed: 2.5 --- !u!1 &1582243898 stripped GameObject: m_PrefabParentObject: {fileID: 100000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} @@ -623,6 +624,17 @@ MeshCollider: m_InflateMesh: 0 m_SkinWidth: 0.01 m_Mesh: {fileID: 4300000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} +--- !u!114 &1582243903 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1582243898} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c54fc8d976fe97d448b076b8ac5910a6, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1880731487 GameObject: m_ObjectHideFlags: 0 @@ -683,13 +695,15 @@ MonoBehaviour: Terrain: {fileID: 2100000, guid: 5ce0ae9e898316748a10f8301b89b052, type: 2} PossibleColors: - {r: 1, g: 0.39215687, b: 0, a: 1} - - {r: 0.53103447, g: 0, b: 1, a: 0} - - {r: 1, g: 0, b: 0.8896551, a: 0} - - {r: 0, g: 1, b: 1, a: 0} - - {r: 0.07586217, g: 1, b: 0, a: 0} + - {r: 0.53103447, g: 0, b: 1, a: 1} + - {r: 1, g: 0, b: 0.8896551, a: 1} + - {r: 0, g: 1, b: 1, a: 1} + - {r: 0.07586217, g: 1, b: 0, a: 1} CurrentColor: {r: 1, g: 0.39215687, b: 0, a: 1} MaxThickness: 0.3 MinThickness: 0.15 + Time: 0 + ChangeTime: 4 --- !u!1 &2004386718 GameObject: m_ObjectHideFlags: 0 @@ -712,14 +726,14 @@ Transform: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 2004386718} - m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068} + 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: - {fileID: 1410985307} m_Father: {fileID: 0} m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!54 &2004386721 Rigidbody: m_ObjectHideFlags: 0 diff --git a/Assets/MaterialManager.cs b/Assets/MaterialManager.cs index f3535eb..575e840 100644 --- a/Assets/MaterialManager.cs +++ b/Assets/MaterialManager.cs @@ -8,12 +8,24 @@ public class MaterialManager : MonoBehaviour { public Color[] PossibleColors; public Color CurrentColor; public float MaxThickness = 0.3f, MinThickness = 0.15f; + public float Time; + public float ChangeTime = 32; void Update(){ - Terrain.SetColor("_Color", Lerp(Terrain.GetColor("_Color"), CurrentColor, Time.deltaTime * 2f)); + + if (Time >= ChangeTime) { + CurrentColor = PossibleColors[Random.Range(0,PossibleColors.Length)]; + this.Time = 0; + } + + this.Time += UnityEngine.Time.deltaTime; + + Terrain.SetColor("_Color", Lerp(Terrain.GetColor("_Color"), CurrentColor, UnityEngine.Time.deltaTime * 2f)); Terrain.SetColor("_GColor", Terrain.GetColor("_Color")); Terrain.SetColor("_WColor", Terrain.GetColor("_Color")); Terrain.SetColor("_EmissionColor", Terrain.GetColor("_Color")); + + //TODO Thickness } Color Lerp(Color c1, Color c2, float delta){ diff --git a/Assets/Movement.cs b/Assets/Movement.cs index f1d7f2e..2becc66 100644 --- a/Assets/Movement.cs +++ b/Assets/Movement.cs @@ -14,7 +14,7 @@ void Start () { void Update () { transform.parent.position += transform.forward * Time.deltaTime * 4 * Speed; transform.localRotation = Quaternion.Slerp(transform.localRotation, Quaternion.Euler(Vector3.zero), Time.deltaTime * 1.5f); - Debug.Log(transform.rotation.eulerAngles + " | " + transform.localRotation.eulerAngles); + if (Input.GetKey(KeyCode.W)) { transform.localRotation = Quaternion.Euler(transform.localRotation.eulerAngles + Vector3.right * Time.deltaTime * 64f * TurnSpeed); diff --git a/Assets/Terrain.mat b/Assets/Terrain.mat index 7a17a4b..0b08d14 100644 --- a/Assets/Terrain.mat +++ b/Assets/Terrain.mat @@ -108,7 +108,7 @@ Material: - _WUV: 0 - _ZWrite: 1 m_Colors: - - _Color: {r: 1, g: 0.39215687, b: 0, a: 1} - - _EmissionColor: {r: 1, g: 0.39215687, b: 0, a: 1} - - _GColor: {r: 1, g: 0.39215687, b: 0, a: 1} - - _WColor: {r: 1, g: 0.39215687, b: 0, a: 1} + - _Color: {r: 0.9977689, g: 0.002231165, b: 0.8899013, a: 0.9999998} + - _EmissionColor: {r: 0.9977689, g: 0.002231165, b: 0.8899013, a: 0.9999998} + - _GColor: {r: 0.9977689, g: 0.002231165, b: 0.8899013, a: 0.9999998} + - _WColor: {r: 0.9977689, g: 0.002231165, b: 0.8899013, a: 0.9999998} diff --git a/project-skylines.userprefs b/project-skylines.userprefs index ad5d77a..10e3225 100644 --- a/project-skylines.userprefs +++ b/project-skylines.userprefs @@ -1,12 +1,13 @@  - + - - - - - + + + + + +