Skip to content

Commit

Permalink
bugfix this stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
GER-Space committed Dec 14, 2019
1 parent f11ccd1 commit b23be66
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 18 deletions.
16 changes: 12 additions & 4 deletions src/Core/StaticObjects/StaticModules/AdvTextures/AdvTextures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> targetTransforms = new List<string>();
Expand All @@ -38,6 +38,7 @@ public class AdvancedTextures : StaticModule
private static Dictionary<string, Material> cachedMaterials = new Dictionary<string, Material>();

private Color color = Color.white;
private bool setColor = false;

private bool doTileing = false;

Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private void Initialize()
revAnimation = bool.Parse(reverseAnimation);
warpAnimation = bool.Parse(timeWarpAnimation);

ResetAnimationState();
StartCoroutine("ResetAnimationState");

SetupCenter();

Expand Down Expand Up @@ -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;

}


Expand All @@ -178,7 +188,7 @@ private IEnumerator SetActive()
if (revAnimation)
{
targetAnimation.speed = -animationSpeed;
targetAnimation.normalizedTime = 1f;
targetAnimation.time = animLength;
}
else
{
Expand All @@ -198,6 +208,7 @@ private IEnumerator SetActive()
isRunning = false;
}


private IEnumerator SetInActive()
{
if (isRunning)
Expand All @@ -216,7 +227,7 @@ private IEnumerator SetInActive()
else
{
targetAnimation.speed = -animationSpeed;
targetAnimation.normalizedTime = 1f;
targetAnimation.time = animLength;
}

if (warpAnimation)
Expand All @@ -231,6 +242,5 @@ private IEnumerator SetInActive()
isRunning = false;
}


}
}
4 changes: 2 additions & 2 deletions src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]

0 comments on commit b23be66

Please sign in to comment.