Skip to content

Commit

Permalink
added color timer
Browse files Browse the repository at this point in the history
  • Loading branch information
maxilevi committed Nov 10, 2017
1 parent 40c488d commit ad52d6a
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 23 deletions.
36 changes: 25 additions & 11 deletions Assets/Game.unity
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
14 changes: 13 additions & 1 deletion Assets/MaterialManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
2 changes: 1 addition & 1 deletion Assets/Movement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions Assets/Terrain.mat
Original file line number Diff line number Diff line change
Expand Up @@ -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}
13 changes: 7 additions & 6 deletions project-skylines.userprefs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<Properties StartupItem="Assembly-CSharp.csproj">
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" PreferredExecutionTarget="Unity.Instance.Unity Editor" />
<MonoDevelop.Ide.Workbench ActiveDocument="Assets\Controls.cs">
<MonoDevelop.Ide.Workbench ActiveDocument="Assets\MaterialManager.cs">
<Files>
<File FileName="Assets\Controls.cs" Line="26" Column="29" />
<File FileName="Assets\Generation\ChunkLoader.cs" Line="99" Column="32" />
<File FileName="Assets\Generation\GenerationQueue.cs" Line="36" Column="1" />
<File FileName="Assets\World.cs" Line="20" Column="1" />
<File FileName="Assets\Generation\GenerationThread.cs" Line="44" Column="6" />
<File FileName="Assets\Generation\ChunkLoader.cs" Line="1" Column="1" />
<File FileName="Assets\Generation\GenerationQueue.cs" Line="1" Column="1" />
<File FileName="Assets\World.cs" Line="1" Column="1" />
<File FileName="Assets\Generation\GenerationThread.cs" Line="1" Column="1" />
<File FileName="Assets\Movement.cs" Line="17" Column="3" />
<File FileName="Assets\MaterialManager.cs" Line="18" Column="4" />
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints>
Expand Down

0 comments on commit ad52d6a

Please sign in to comment.