mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Layer Test module
idk man
This commit is contained in:
parent
35381fae65
commit
4d2623a1c6
@ -63,6 +63,7 @@
|
|||||||
<Compile Include="ProjectionTarget.cs" />
|
<Compile Include="ProjectionTarget.cs" />
|
||||||
<Compile Include="ModuleConformalDecal.cs" />
|
<Compile Include="ModuleConformalDecal.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Test\TestLayers.cs" />
|
||||||
<Compile Include="Util\Logging.cs" />
|
<Compile Include="Util\Logging.cs" />
|
||||||
<Compile Include="Util\OrientedBounds.cs" />
|
<Compile Include="Util\OrientedBounds.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
34
Source/ConformalDecals/Test/TestLayers.cs
Normal file
34
Source/ConformalDecals/Test/TestLayers.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace ConformalDecals.Test {
|
||||||
|
public class TestLayers : PartModule {
|
||||||
|
|
||||||
|
[KSPField(guiActive = true)]
|
||||||
|
public int layer = 2;
|
||||||
|
|
||||||
|
public override void OnStart(StartState state) {
|
||||||
|
base.OnStart(state);
|
||||||
|
|
||||||
|
|
||||||
|
Part.layerMask.value |= (1 << 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update() {
|
||||||
|
foreach (var collider in GameObject.FindObjectsOfType<Collider>()) {
|
||||||
|
if (collider.gameObject.layer == 3) {
|
||||||
|
Debug.Log($"Has layer 3: {collider.gameObject.name}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[KSPEvent(guiActive = true, guiActiveEditor = true, guiName = "switch layers")]
|
||||||
|
public void Switch() {
|
||||||
|
Debug.Log(Part.layerMask.value);
|
||||||
|
|
||||||
|
var cube = part.FindModelTransform("test");
|
||||||
|
layer = (layer + 1) % 32;
|
||||||
|
cube.gameObject.layer = layer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user