mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-06-11 05:54:07 +00:00
Allow selectability in flight to be disabled
This commit is contained in:
parent
e04d5dc39a
commit
e10ea7af5a
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:162fe1f8fe6eb10578271fc3dfb8b69ec9654eee698afb51db935eb45c95643f
|
||||
oid sha256:cb10644075b5b826620fe4cf86eb78d71ad1ae3ab7a30527b5b67b329c3d978b
|
||||
size 41472
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using ConformalDecals.MaterialProperties;
|
||||
using ConformalDecals.Util;
|
||||
using UnityEngine;
|
||||
|
||||
namespace ConformalDecals {
|
||||
public class ModuleConformalDecal : PartModule {
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum DecalScaleMode {
|
||||
HEIGHT,
|
||||
WIDTH,
|
||||
|
@ -54,7 +56,7 @@ namespace ConformalDecals {
|
|||
[KSPField] public int tileIndex = -1;
|
||||
|
||||
[KSPField] public bool updateBackScale = true;
|
||||
|
||||
[KSPField] public bool selectableInFlight;
|
||||
|
||||
// INTERNAL VALUES
|
||||
[KSPField(guiName = "#LOC_ConformalDecals_gui-scale", guiActive = false, guiActiveEditor = true, isPersistant = true, guiFormat = "F2", guiUnits = "m"),
|
||||
|
@ -77,8 +79,7 @@ namespace ConformalDecals {
|
|||
UI_FloatRange()]
|
||||
public float wear = 100;
|
||||
|
||||
[KSPField(isPersistant = true)]
|
||||
public bool projectMultiple; // reserved for future features. do not modify
|
||||
[KSPField(isPersistant = true)] public bool projectMultiple; // reserved for future features. do not modify
|
||||
|
||||
[KSPField] public MaterialPropertyCollection materialProperties;
|
||||
|
||||
|
@ -102,7 +103,7 @@ namespace ConformalDecals {
|
|||
|
||||
private Material _decalMaterial;
|
||||
private Material _previewMaterial;
|
||||
private BoxCollider _boundsCollider;
|
||||
private MeshRenderer _boundsRenderer;
|
||||
|
||||
private int DecalQueue {
|
||||
get {
|
||||
|
@ -246,7 +247,7 @@ namespace ConformalDecals {
|
|||
|
||||
materialProperties.RenderQueue = DecalQueue;
|
||||
|
||||
_boundsCollider = decalColliderTransform.GetComponent<BoxCollider>();
|
||||
_boundsRenderer = decalProjectorTransform.GetComponent<MeshRenderer>();
|
||||
|
||||
UpdateMaterials();
|
||||
|
||||
|
@ -263,6 +264,9 @@ namespace ConformalDecals {
|
|||
if (HighLogic.LoadedSceneIsFlight) {
|
||||
Part.layerMask |= 1 << DecalConfig.DecalLayer;
|
||||
decalColliderTransform.gameObject.layer = DecalConfig.DecalLayer;
|
||||
if (!selectableInFlight) {
|
||||
decalColliderTransform.GetComponent<Collider>().enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -412,7 +416,7 @@ namespace ConformalDecals {
|
|||
|
||||
// update projection
|
||||
foreach (var target in _targets) {
|
||||
target.Project(_orthoMatrix, decalProjectorTransform, _boundsCollider.bounds, useBaseNormal);
|
||||
target.Project(_orthoMatrix, decalProjectorTransform, _boundsRenderer.bounds, useBaseNormal);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue
Block a user