Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 40 additions & 55 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,55 +1,40 @@
# Created by https://www.gitignore.io

### XamarinStudio ###
bin/
obj/
*.userprefs


### OSX ###
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk
#Autosave files
*~

#build
[Oo]bj/
[Bb]in/
packages/
TestResults/

# globs
Makefile.in
*.DS_Store
*.sln.cache
*.suo
*.cache
*.pidb
*.userprefs
*.usertasks
config.log
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.user
*.tar.gz
tarballs/
test-results/
Thumbs.db

#Mac bundle stuff
*.dmg
*.app

#resharper
*_Resharper.*
*.Resharper

#dotCover
*.dotCover
Binary file modified GameData/LightsOut/LightsOut.dll
Binary file not shown.
35 changes: 35 additions & 0 deletions GameData/LightsOut/LightsOut.version
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"NAME" : "Lights Out",
"URL" : "https://raw.githubusercontent.com/Real-Gecko/LightsOut/master/GameData/LightsOut/LightsOut.version",
"DOWNLOAD" : "https://github.com/Real-Gecko/LightsOut/releases",
"GITHUB" :
{
"USERNAME" : "Real-Gecko",
"REPOSITORY" : "LightsOut"
},
"VERSION" :
{
"MAJOR" : 0,
"MINOR" : 2,
"PATCH" : 2,
"BUILD" : 0
},
"KSP_VERSION" :
{
"MAJOR" : 1,
"MINOR" : 3,
"PATCH" : 1
},
"KSP_VERSION_MIN" :
{
"MAJOR" : 1,
"MINOR" : 3,
"PATCH" : 1
},
"KSP_VERSION_MAX" :
{
"MAJOR" : 1,
"MINOR" : 3,
"PATCH" : 1
}
}
17 changes: 17 additions & 0 deletions LightsOut.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LightsOut", "LightsOut\LightsOut.csproj", "{DB34E9C6-59E1-4313-B8BF-CE6039EEAAE9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DB34E9C6-59E1-4313-B8BF-CE6039EEAAE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DB34E9C6-59E1-4313-B8BF-CE6039EEAAE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB34E9C6-59E1-4313-B8BF-CE6039EEAAE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DB34E9C6-59E1-4313-B8BF-CE6039EEAAE9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
42 changes: 24 additions & 18 deletions Source/LightsOut/LOAmbient.cs → LightsOut/LOAmbient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using UnityEngine;

namespace LightsOut {
Expand All @@ -16,6 +16,7 @@ class LOAmbient {
int originalCullingMask;
CameraClearFlags originalClearFlags;
Color originalAmbientLight;
UnityEngine.Rendering.AmbientMode originalAmbientMode;
LightmapData[] originalLightmapData;
Material originalSkybox;

Expand All @@ -29,37 +30,40 @@ public LOAmbient(EditorFacility facility, EditorLevel level, GameObject[] gameOb
originalAmbientLight = RenderSettings.ambientLight;
originalSkybox = RenderSettings.skybox;
originalLightmapData = LightmapSettings.lightmaps;
originalAmbientMode = RenderSettings.ambientMode;

// Create fake skybox
skyCamera = new GameObject("NightSkyboxCamera", typeof(Camera));
skyCamera.camera.depth = mainCamera.depth - 1;
skyCamera.camera.clearFlags = CameraClearFlags.Skybox;
skyCamera.camera.cullingMask = 0;
// skyCamera.AddComponent<Camera>();
skyCamera.GetComponent<Camera>().depth = mainCamera.depth - 1;
skyCamera.GetComponent<Camera>().clearFlags = CameraClearFlags.Skybox;
skyCamera.GetComponent<Camera>().cullingMask = 0;

nightSkyboxMaterial = new Material(originalSkybox);

// GalaxyTex_PositiveX should be viewed outside window
Debug.Log("LightsOut: Loading Night Sky Textures");
foreach (Material material in Resources.FindObjectsOfTypeAll<Material>()) {
// Debug.Log("LightsOut: Loading Night Sky Textures");
foreach (Renderer renderer in GalaxyCubeControl.Instance.GetComponentsInChildren<Renderer>()) {
Material material = renderer.material;
Texture texture = material.mainTexture;
if (texture) {
switch (material.name) {
case "ZP (Instance)":
switch (renderer.name) {
case "ZP":
nightSkyboxMaterial.SetTexture("_FrontTex", material.mainTexture);
break;
case "ZN (Instance)":
case "ZN":
nightSkyboxMaterial.SetTexture("_BackTex", material.mainTexture);
break;
case "XP (Instance)":
case "XP":
nightSkyboxMaterial.SetTexture("_LeftTex", material.mainTexture);
break;
case "XN (Instance)":
case "XN":
nightSkyboxMaterial.SetTexture("_RightTex", material.mainTexture);
break;
case "YP (Instance)":
case "YP":
nightSkyboxMaterial.SetTexture("_UpTex", material.mainTexture);
break;
case "YN (Instance)":
case "YN":
nightSkyboxMaterial.SetTexture("_DownTex", material.mainTexture);
break;
default:
Expand Down Expand Up @@ -98,14 +102,14 @@ public LOAmbient(EditorFacility facility, EditorLevel level, GameObject[] gameOb
foreach (GameObject gameObject in gameObjects) {
// These are all subsets of model_sph_interior_lights_v16
// Component_611_1 to 6 is window reflection
ChangeLayersRecursively(gameObject, newLayer, "Component_611_1");
ChangeLayersRecursively(gameObject, newLayer, "Component_611_2");
ChangeLayersRecursively(gameObject, newLayer, "Component_611_3");
// ChangeLayersRecursively(gameObject, newLayer, "Component_611_1");
// ChangeLayersRecursively(gameObject, newLayer, "Component_611_2");
// ChangeLayersRecursively(gameObject, newLayer, "Component_611_3");
ChangeLayersRecursively(gameObject, newLayer, "Component_611_4");
ChangeLayersRecursively(gameObject, newLayer, "Component_611_5");
ChangeLayersRecursively(gameObject, newLayer, "Component_611_6");
//ChangeLayersRecursively(gameObject, newLayer, "Component_749_1"); // Glow from Side Lights!
//ChangeLayersRecursively(gameObject, newLayer, "Component_750_1"); // Lights!
ChangeLayersRecursively(gameObject, newLayer, "Component_749_1"); // Glow from Side Lights!
ChangeLayersRecursively(gameObject, newLayer, "Component_750_1"); // Lights!
}
break;
}
Expand All @@ -115,6 +119,7 @@ public LOAmbient(EditorFacility facility, EditorLevel level, GameObject[] gameOb
public void SetAmbientMode(EditorTime time) {
if (time == EditorTime.Night) {
RenderSettings.ambientLight = new Color(0.15f, 0.15f, 0.15f);
RenderSettings.ambientMode = UnityEngine.Rendering.AmbientMode.Flat;
RenderSettings.fog = false;
mainCamera.clearFlags = CameraClearFlags.Nothing;
LightmapSettings.lightmaps = new LightmapData[] { };
Expand All @@ -124,6 +129,7 @@ public void SetAmbientMode(EditorTime time) {
else {
RenderSettings.ambientLight = originalAmbientLight;
RenderSettings.fog = true;
RenderSettings.ambientMode = originalAmbientMode;
RenderSettings.skybox = originalSkybox;
mainCamera.clearFlags = originalClearFlags;
LightmapSettings.lightmaps = originalLightmapData;
Expand Down
22 changes: 11 additions & 11 deletions Source/LightsOut/LOEnums.cs → LightsOut/LOEnums.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using System;

public enum EditorLevel {
Level1 = 1,
Level2 = 2,
Level3 = 3
}

public enum EditorTime {
Day = 1,
Night = 2
using System;
public enum EditorLevel {
Level1 = 1,
Level2 = 2,
Level3 = 3
}
public enum EditorTime {
Day = 1,
Night = 2
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using UnityEngine;

Expand Down Expand Up @@ -34,9 +34,10 @@ public LOExternalLights(EditorFacility facility, EditorLevel level) {
//[LOG 17:53:55.158] Light 5: Spotlight, RGBA(1.000, 1.000, 1.000, 1.000), Default ON
//[LOG 17:53:55.159] Parent: Day Lights
lightsToChange = new List<LightToChange>() {
new LightToChange(){ name = "SpotlightSun", parentName = "Day Lights" },
new LightToChange(){ name = "Spotlight", parentName = "Day Lights" }
};
new LightToChange(){ name = "SpotlightCraft", parentName = "Day Lights" },
new LightToChange(){ name = "SpotlightSun", parentName = "VAB_interior_modern" },
new LightToChange(){ name = "Realtime_SpotlightScenery", parentName = "Lighting_Realtime" },
new LightToChange(){ name = "Shadow Light", parentName = "Day Lights" } };
break;

case EditorLevel.Level2:
Expand All @@ -57,10 +58,11 @@ public LOExternalLights(EditorFacility facility, EditorLevel level) {
//[LOG 17:56:18.874] Light 7: Spotlight, RGBA(1.000, 1.000, 1.000, 1.000), Default ON
//[LOG 17:56:18.875] Parent: Day Lights
lightsToChange = new List<LightToChange>() {
new LightToChange(){ name = "SpotlightSun", parentName = "Day Lights" },
new LightToChange(){ name = "Spotlight", parentName = "Day Lights" },
new LightToChange(){ name = "roofFill", parentName = "Day Lights" }
};
new LightToChange(){ name = "SpotlightCraft", parentName = "Day Lights" },
new LightToChange(){ name = "SpotlightSun", parentName = "VAB_interior_modern" },
new LightToChange(){ name = "Realtime_SpotlightScenery", parentName = "Lighting_Realtime" },
new LightToChange(){ name = "Shadow Light", parentName = "Day Lights" }
};
break;

case EditorLevel.Level3:
Expand All @@ -85,9 +87,11 @@ public LOExternalLights(EditorFacility facility, EditorLevel level) {
//[LOG 17:58:21.712] Light 9: Spotlight, RGBA(1.000, 1.000, 1.000, 1.000), Default ON
//[LOG 17:58:21.713] Parent: Day Lights
lightsToChange = new List<LightToChange>() {
new LightToChange(){ name = "SpotlightSun", parentName = "Day Lights" },
new LightToChange(){ name = "Spotlight", parentName = "Day Lights" }
};
new LightToChange(){ name = "SpotlightCraft", parentName = "Day Lights" },
new LightToChange(){ name = "SpotlightSun", parentName = "VAB_interior_modern" },
new LightToChange(){ name = "Realtime_SpotlightScenery", parentName = "Lighting_Realtime" },
new LightToChange(){ name = "Shadow Light", parentName = "Day Lights" }
};
break;
}
}
Expand All @@ -111,9 +115,11 @@ public LOExternalLights(EditorFacility facility, EditorLevel level) {
//[LOG 17:54:50.077] Light 7: SpotlightWindow, RGBA(0.866, 0.863, 0.903, 1.000), Default OFF
//[LOG 17:54:50.078] Parent: Editors_DayLights
lightsToChange = new List<LightToChange>() {
new LightToChange(){ name = "SpotlightCraft", parentName = "Editors_DayLights" },
new LightToChange(){ name = "SpotlightExteriorSun", parentName = "Editors_DayLights" }
};
new LightToChange(){ name = "Realtime_SpotlightCraft", parentName = "Lighting_Realtime" },
new LightToChange(){ name = "Realtime_ExteriorSun", parentName = "Lighting_Realtime" },
new LightToChange(){ name = "Realtime_SpotlightScenery", parentName = "Lighting_Realtime" },
new LightToChange(){ name = "Realtime_Shadow Light", parentName = "Lighting_Realtime" }
};
break;

case EditorLevel.Level2:
Expand All @@ -134,9 +140,11 @@ public LOExternalLights(EditorFacility facility, EditorLevel level) {
//[LOG 17:57:04.724] Light 7: SpotlightWindow, RGBA(0.866, 0.863, 0.903, 1.000), Default OFF
//[LOG 17:57:04.725] Parent: Editors_DayLights
lightsToChange = new List<LightToChange>() {
new LightToChange(){ name = "SpotlightCraft", parentName = "Editors_DayLights" },
new LightToChange(){ name = "SpotlightExteriorSun", parentName = "Editors_DayLights" }
};
new LightToChange(){ name = "Realtime_SpotlightCraft", parentName = "Lighting_Realtime" },
new LightToChange(){ name = "Realtime_ExteriorSun", parentName = "Lighting_Realtime" },
new LightToChange(){ name = "Realtime_SpotlightScenery", parentName = "Lighting_Realtime" },
new LightToChange(){ name = "Realtime_Shadow Light", parentName = "Lighting_Realtime" }
};
break;

case EditorLevel.Level3:
Expand All @@ -157,10 +165,11 @@ public LOExternalLights(EditorFacility facility, EditorLevel level) {
//[LOG 17:59:41.833] Light 7: SpotlightWindow, RGBA(0.866, 0.863, 0.903, 1.000), Default ON
//[LOG 17:59:41.834] Parent: Editors_DayLights
lightsToChange = new List<LightToChange>() {
new LightToChange(){ name = "SpotlightCraft", parentName = "Editors_DayLights" },
new LightToChange(){ name = "SpotlightExteriorSun", parentName = "Editors_DayLights" },
new LightToChange(){ name = "SpotlightWindow", parentName = "Editors_DayLights" }
};
new LightToChange(){ name = "Realtime_SpotlightCraft", parentName = "Lighting_Realtime" },
new LightToChange(){ name = "Realtime_ExteriorSun", parentName = "Lighting_Realtime" },
new LightToChange(){ name = "Realtime_SpotlightScenery", parentName = "Lighting_Realtime" },
new LightToChange(){ name = "Realtime_Shadow Light", parentName = "Lighting_Realtime" }
};
break;
}
}
Expand Down
File renamed without changes.
Loading