Skip to content

Commit

Permalink
Getting ready for 1.2 - Better cat and Text
Browse files Browse the repository at this point in the history
  • Loading branch information
sarbian committed Oct 5, 2016
1 parent d7aa85f commit 1e685c8
Show file tree
Hide file tree
Showing 21 changed files with 509 additions and 169 deletions.
93 changes: 93 additions & 0 deletions CatMover.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
using System.Collections;
using UnityEngine;

namespace ModuleManager
{
public class CatMover : MonoBehaviour
{
public Vector3 spos;

public float vel = 5;
private float offsetY;

public TrailRenderer trail;

public Sprite[] frames;
public float secFrame = 0.07f;

private SpriteRenderer spriteRenderer;
private int spriteIdx;

private int totalLenth = 100;
private float activePos = 0;

public float scale = 2;


private float time = 5;
private float trailTime = 0.5f;


// Use this for initialization
void Start()
{
trail = this.GetComponent<TrailRenderer>();
spriteRenderer = this.GetComponent<SpriteRenderer>();

spriteRenderer.sortingOrder = 3;
trail.sortingOrder = 2;

offsetY = Mathf.FloorToInt(0.2f * Screen.height);

spos.z = -1;

StartCoroutine(Animate());

trailTime = time / 4;

totalLenth = (int) (Screen.width / time * trail.time) + 150;
trail.time = trailTime;
}

void Update()
{
if (trail.time <= 0f)
{
trail.time = trailTime;
}

activePos += ((Screen.width / time) * Time.deltaTime);

if (activePos > (Screen.width + totalLenth))
{
activePos = -frames[spriteIdx].textureRect.width;
trail.time = 0;;
}

float f = 2f * Mathf.PI * (activePos) / (Screen.width * 0.5f);

float heightOffset = Mathf.Sin(f) * (frames[spriteIdx].textureRect.height * scale);

spos.x = activePos;
spos.y = offsetY + heightOffset;

transform.position = KSP.UI.UIMainCamera.Camera.ScreenToWorldPoint(spos);
transform.rotation = Quaternion.Euler(0, 0, Mathf.Cos(f) * 0.25f * Mathf.PI * Mathf.Rad2Deg);
}

IEnumerator Animate()
{
if (frames.Length == 0)
yield return null;

WaitForSeconds yield = new WaitForSeconds(secFrame);

while (true)
{
spriteIdx = (spriteIdx+1) % frames.Length;
spriteRenderer.sprite = frames[spriteIdx];
yield return yield;
}
}
}
}
2 changes: 2 additions & 0 deletions CopyLocalFalse.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Copy Local has been set to false for all dependencies.
Remark by Jan Van der Haegen: This file has been added because Nuget would installs packages to the solution instead of the project if there are only PowerShell scripts... (So yes: it's safe to remove this file!)
52 changes: 49 additions & 3 deletions ModuleManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<ConsolePause>False</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Compile Include="CatMover.cs" />
<Compile Include="moduleManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs" />
Expand All @@ -41,24 +42,69 @@
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="KSPUtil, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL" />
<Reference Include="System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, processorArchitecture=MSIL" />
<Reference Include="System.Drawing" />
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Games\KSPSteamController\KSPSteamCtrlr\KSPUnity-Steam-Symlinks\UnityEngine.UI.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="Properties\cat" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-1.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-10.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-11.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-12.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-2.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-3.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-4.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-5.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-6.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-7.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-8.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-9.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\rainbow2.png" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>echo copying to "%25KSPDIR%25\GameData\"
copy "$(TargetPath)" "C:\Games\ksp-win_dev\GameData\"
"C:\Games\Tools\pdb2mdb\pdb2mdb.exe" $(TargetFileName)
xcopy /Y "$(TargetPath)" "C:\Games\ksp-win_dev\GameData\"
xcopy /Y "$(TargetDir)$(TargetName).pdb" "C:\Games\ksp-win_dev\GameData\"
xcopy /Y "$(TargetDir)$(TargetName).dll.mdb" "C:\Games\ksp-win_dev\GameData\"
del "C:\Games\ksp-win_dev\GameData\ModuleManager.ConfigCache"</PostBuildEvent>
</PropertyGroup>
</Project>
104 changes: 102 additions & 2 deletions Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 38 additions & 2 deletions Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,43 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="cat" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>cat;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="cat-1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>cat-1.png;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="cat-10" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>cat-10.png;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="cat-11" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>cat-11.png;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="cat-12" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>cat-12.png;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="cat-2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>cat-2.png;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="cat-3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>cat-3.png;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="cat-4" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>cat-4.png;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="cat-5" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>cat-5.png;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="cat-6" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>cat-6.png;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="cat-7" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>cat-7.png;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="cat-8" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>cat-8.png;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="cat-9" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>cat-9.png;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="rainbow2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>rainbow2.png;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>
Binary file removed Properties/cat
Binary file not shown.
Binary file added Properties/cat-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Properties/cat-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Properties/cat-11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Properties/cat-12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Properties/cat-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Properties/cat-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Properties/cat-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Properties/cat-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Properties/cat-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Properties/cat-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Properties/cat-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Properties/cat-9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Properties/rainbow2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1e685c8

Please sign in to comment.