From b23be66a43f43bdf732cf261fcebbf994f287fc1 Mon Sep 17 00:00:00 2001 From: GER-Space Date: Sat, 14 Dec 2019 15:54:50 +0100 Subject: [PATCH] bugfix this stuff --- .../StaticModules/AdvTextures/AdvTextures.cs | 16 ++++++--- .../AnimateOnSunRise/AnimateOnSunRise.cs | 34 ++++++++++++------- src/Properties/AssemblyInfo.cs | 4 +-- 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/src/Core/StaticObjects/StaticModules/AdvTextures/AdvTextures.cs b/src/Core/StaticObjects/StaticModules/AdvTextures/AdvTextures.cs index 9c641f30..1631ff2b 100644 --- a/src/Core/StaticObjects/StaticModules/AdvTextures/AdvTextures.cs +++ b/src/Core/StaticObjects/StaticModules/AdvTextures/AdvTextures.cs @@ -29,7 +29,7 @@ public class AdvancedTextures : StaticModule public string _OcclusionMap = null; // ambient occlusion public string _SpecGlossMap = null; // U5 metallic (standard shader - spec gloss setup) - public string _Color = "1,1,1,1"; // MainColor + public string _Color = ""; // MainColor private int textureIndex = 0; private List targetTransforms = new List(); @@ -38,6 +38,7 @@ public class AdvancedTextures : StaticModule private static Dictionary cachedMaterials = new Dictionary(); private Color color = Color.white; + private bool setColor = false; private bool doTileing = false; @@ -69,7 +70,12 @@ public void Start() // Log.UserError("AdvancedTexture: could not parse TileTexture " + tileTextureWithScale); - color = ConfigNode.ParseColor(_Color); + if (!string.IsNullOrEmpty(_Color)) + { + color = ConfigNode.ParseColor(_Color); + setColor = true; + } + if (doTileing) { @@ -122,8 +128,10 @@ public void Start() ReplaceShader(renderer, newShader); } - renderer.material.SetColor("_Color", color); - + if (setColor) + { + renderer.material.SetColor("_Color", color); + } SetTexture(renderer, _MainTex, "_MainTex"); SetTexture(renderer, _ParallaxMap, "_ParallaxMap"); SetTexture(renderer, _Emissive, "_Emissive"); diff --git a/src/Core/StaticObjects/StaticModules/AnimateOnSunRise/AnimateOnSunRise.cs b/src/Core/StaticObjects/StaticModules/AnimateOnSunRise/AnimateOnSunRise.cs index 8599b815..c286df2d 100644 --- a/src/Core/StaticObjects/StaticModules/AnimateOnSunRise/AnimateOnSunRise.cs +++ b/src/Core/StaticObjects/StaticModules/AnimateOnSunRise/AnimateOnSunRise.cs @@ -82,7 +82,7 @@ private void Initialize() revAnimation = bool.Parse(reverseAnimation); warpAnimation = bool.Parse(timeWarpAnimation); - ResetAnimationState(); + StartCoroutine("ResetAnimationState"); SetupCenter(); @@ -132,32 +132,42 @@ public void Update() internal void OnSunriseActivate() { - Log.Normal("Called"); + //Log.Normal("Called"); shouldBeActive = true; } internal void OnSunriseDeActivate() { - Log.Normal("Called"); + //Log.Normal("Called"); shouldBeActive = false; } - - private void ResetAnimationState() + private IEnumerator ResetAnimationState() { - isRunning = false; - isActive = false; + isRunning = true; + float waitTime = animLength; if (revAnimation) { - animationComponent[animationName].normalizedTime = 1f; + targetAnimation.speed = animationSpeed; + targetAnimation.time = 0; } else { - animationComponent[animationName].time = 0; + targetAnimation.speed = -animationSpeed; + targetAnimation.time = animLength; } + + targetAnimation.speed *= 1000f; + waitTime /= 1000f; + + animationComponent.Play(animationName); + isActive = false; + yield return new WaitForSeconds(waitTime); + isRunning = false; + } @@ -178,7 +188,7 @@ private IEnumerator SetActive() if (revAnimation) { targetAnimation.speed = -animationSpeed; - targetAnimation.normalizedTime = 1f; + targetAnimation.time = animLength; } else { @@ -198,6 +208,7 @@ private IEnumerator SetActive() isRunning = false; } + private IEnumerator SetInActive() { if (isRunning) @@ -216,7 +227,7 @@ private IEnumerator SetInActive() else { targetAnimation.speed = -animationSpeed; - targetAnimation.normalizedTime = 1f; + targetAnimation.time = animLength; } if (warpAnimation) @@ -231,6 +242,5 @@ private IEnumerator SetInActive() isRunning = false; } - } } diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs index 80acd317..e40dce43 100644 --- a/src/Properties/AssemblyInfo.cs +++ b/src/Properties/AssemblyInfo.cs @@ -36,7 +36,7 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.0.0")] -[assembly: AssemblyFileVersion("1.8.1.14")] -[assembly: AssemblyInformationalVersion("1.8.1.14")] +[assembly: AssemblyFileVersion("1.8.1.15")] +[assembly: AssemblyInformationalVersion("1.8.1.15")] [assembly: KSPAssembly("KerbalKonstructs", 0, 9)]