├── Screenshots ├── game.png └── editor.png ├── Assets ├── Resources │ ├── Models │ │ ├── droid.fbx │ │ ├── prism.fbx │ │ ├── prism.fbx.meta │ │ └── droid.fbx.meta │ ├── Levels │ │ ├── 1.json.meta │ │ ├── 2.json.meta │ │ ├── 1.json │ │ └── 2.json │ ├── UI │ │ ├── WinScreen.prefab.meta │ │ └── MainMenuScreen.prefab.meta │ ├── UI.meta │ ├── Levels.meta │ ├── Models.meta │ ├── Prefabs.meta │ ├── Prefabs │ │ ├── Emitters │ │ │ └── Droid.prefab.meta │ │ ├── Absorbers │ │ │ ├── Cubic.prefab.meta │ │ │ └── Cubic.prefab │ │ ├── Absorbers.meta │ │ ├── Emitters.meta │ │ ├── Reflectors │ │ │ └── HalfBlock.prefab.meta │ │ └── Reflectors.meta │ ├── Materials.meta │ ├── LevelItemsMap.asset.meta │ ├── LevelSequence.asset.meta │ ├── Materials │ │ ├── floor.mat.meta │ │ ├── droid_beam.mat.meta │ │ ├── droid_eye.mat.meta │ │ ├── droid_skin.mat.meta │ │ ├── droid_eye.mat │ │ ├── droid_beam.mat │ │ ├── floor.mat │ │ └── droid_skin.mat │ ├── LevelSequence.asset │ └── LevelItemsMap.asset ├── Packages │ ├── JsonDotNet │ │ ├── Assemblies │ │ │ ├── AOT │ │ │ │ ├── Newtonsoft.Json.dll │ │ │ │ ├── Newtonsoft.Json.XML.meta │ │ │ │ └── Newtonsoft.Json.dll.meta │ │ │ ├── Windows │ │ │ │ ├── Newtonsoft.Json.dll │ │ │ │ ├── Newtonsoft.Json.XML.meta │ │ │ │ └── Newtonsoft.Json.dll.meta │ │ │ ├── Standalone │ │ │ │ ├── Newtonsoft.Json.dll │ │ │ │ ├── Newtonsoft.Json.XML.meta │ │ │ │ └── Newtonsoft.Json.dll.meta │ │ │ ├── AOT.meta │ │ │ ├── Standalone.meta │ │ │ └── Windows.meta │ │ └── Assemblies.meta │ └── JsonDotNet.meta ├── Source │ ├── Environment.cs │ ├── Game │ │ ├── Level │ │ │ ├── EntityRulesBridge.cs │ │ │ ├── LevelData.cs.meta │ │ │ ├── LevelEntity.cs.meta │ │ │ ├── LevelController.cs.meta │ │ │ ├── LevelItemsMap.cs.meta │ │ │ ├── LevelSequence.cs.meta │ │ │ ├── EntityRulesBridge.cs.meta │ │ │ ├── LevelController.Load.cs.meta │ │ │ ├── LevelController.Save.cs.meta │ │ │ ├── LevelData.cs │ │ │ ├── LevelSequence.cs │ │ │ ├── LevelItemsMap.cs │ │ │ ├── LevelEntity.cs │ │ │ ├── LevelController.cs │ │ │ ├── LevelController.Save.cs │ │ │ └── LevelController.Load.cs │ │ ├── Main │ │ │ ├── AbsorberController.cs │ │ │ ├── Grid.meta │ │ │ ├── Level.meta │ │ │ ├── Reflector.meta │ │ │ ├── Reflector │ │ │ │ ├── ReflectiveSurfaceController.cs │ │ │ │ ├── ReflectorController.cs.meta │ │ │ │ ├── ReflectiveSurfaceController.cs.meta │ │ │ │ └── ReflectorController.cs │ │ │ ├── Tracer.cs.meta │ │ │ ├── EmitterController.cs.meta │ │ │ ├── AbsorberController.cs.meta │ │ │ ├── Grid │ │ │ │ ├── GridController.cs.meta │ │ │ │ ├── GridElementController.cs.meta │ │ │ │ ├── GridElementController.cs │ │ │ │ └── GridController.cs │ │ │ ├── LevelEntityController.cs.meta │ │ │ ├── LevelEntityController.cs │ │ │ ├── EmitterController.cs │ │ │ └── Tracer.cs │ │ ├── Level.meta │ │ ├── Main.meta │ │ ├── UI.meta │ │ ├── Utils.meta │ │ ├── UI │ │ │ ├── Screens.meta │ │ │ ├── Screens │ │ │ │ ├── MainMenuScreen.cs │ │ │ │ ├── WinScreen.cs.meta │ │ │ │ ├── MainMenuScreen.cs.meta │ │ │ │ └── WinScreen.cs │ │ │ ├── UIManager.cs.meta │ │ │ ├── ScreenController.cs.meta │ │ │ ├── ScreenController.cs │ │ │ └── UIManager.cs │ │ ├── GameManager.cs.meta │ │ ├── InitManager.cs.meta │ │ ├── MapClickHandler.cs.meta │ │ ├── StartupManager.cs.meta │ │ ├── Utils │ │ │ ├── CameraController.cs.meta │ │ │ ├── ClickRedirect.cs.meta │ │ │ ├── CameraScrollAreaController.cs.meta │ │ │ ├── ClickRedirect.cs │ │ │ ├── CameraScrollAreaController.cs │ │ │ └── CameraController.cs │ │ ├── InitManager.cs │ │ ├── StartupManager.cs │ │ ├── MapClickHandler.cs │ │ └── GameManager.cs │ ├── Settings.cs │ ├── @Laser.asmdef.meta │ ├── Core.meta │ ├── Game.meta │ ├── Editor.meta │ ├── Shared.meta │ ├── Editor │ │ ├── @Editor.asmdef.meta │ │ ├── Menu.meta │ │ ├── Utilities.meta │ │ ├── GridEditor.cs.meta │ │ ├── CameraEditor.cs.meta │ │ ├── LevelEditor.cs.meta │ │ ├── Menu │ │ │ ├── GameMenu.cs.meta │ │ │ └── GameMenu.cs │ │ ├── GridElementEditor.cs.meta │ │ ├── LevelEditorWindow.cs.meta │ │ ├── LevelEntityEditor.cs.meta │ │ ├── Utilities │ │ │ ├── EditorUtilities.cs.meta │ │ │ ├── AddScriptProcessor.cs.meta │ │ │ ├── CreateScriptMenu.cs.meta │ │ │ ├── EditorUtilities.cs │ │ │ ├── AddScriptProcessor.cs │ │ │ └── CreateScriptMenu.cs │ │ ├── @Editor.asmdef │ │ ├── GridEditor.cs │ │ ├── LevelEditor.cs │ │ ├── GridElementEditor.cs │ │ └── LevelEntityEditor.cs │ ├── Shared │ │ ├── @Shared.asmdef.meta │ │ ├── Utilities.cs.meta │ │ ├── @Shared.asmdef │ │ └── Utilities.cs │ ├── Core │ │ ├── Progression.cs │ │ └── Progression.cs.meta │ ├── App.cs.meta │ ├── Config.cs.meta │ ├── GlobalTime.cs │ ├── Logger.cs.meta │ ├── Profile.cs.meta │ ├── Environment.cs.meta │ ├── GlobalTime.cs.meta │ ├── Settings.cs.meta │ ├── GameException.cs.meta │ ├── App.ProfileManager.cs.meta │ ├── App.SettingsManager.cs.meta │ ├── @Laser.asmdef │ ├── App.cs │ ├── Profile.cs │ ├── GameException.cs │ ├── Config.cs │ ├── App.SettingsManager.cs │ └── App.ProfileManager.cs ├── Scenes │ ├── Game.unity.meta │ └── Editor.unity.meta ├── Scenes.meta ├── Source.meta ├── Packages.meta ├── Resources.meta ├── Editor Default Resources.meta └── Editor Default Resources │ ├── Materials.meta │ ├── Script Templates.meta │ ├── Script Templates │ ├── editor_script_template.txt.meta │ ├── game_script_template.txt.meta │ ├── behaviour_script_template.txt.meta │ ├── serializable_game_script_template.txt.meta │ ├── game_script_template.txt │ ├── behaviour_script_template.txt │ ├── editor_script_template.txt │ └── serializable_game_script_template.txt │ └── Materials │ ├── editor_floor.mat.meta │ ├── temp_grid_item.mat.meta │ ├── temp_grid_item.mat │ └── editor_floor.mat ├── ProjectSettings ├── ProjectVersion.txt ├── ClusterInputManager.asset ├── PresetManager.asset ├── XRSettings.asset ├── TimeManager.asset ├── EditorBuildSettings.asset ├── VFXManager.asset ├── AudioManager.asset ├── TagManager.asset ├── EditorSettings.asset ├── UnityConnectSettings.asset ├── DynamicsManager.asset ├── NavMeshAreas.asset ├── Physics2DSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset └── QualitySettings.asset ├── README.md ├── .gitignore ├── LICENSE └── Packages └── manifest.json /Screenshots/game.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vape/Laser/master/Screenshots/game.png -------------------------------------------------------------------------------- /Screenshots/editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vape/Laser/master/Screenshots/editor.png -------------------------------------------------------------------------------- /Assets/Resources/Models/droid.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vape/Laser/master/Assets/Resources/Models/droid.fbx -------------------------------------------------------------------------------- /Assets/Resources/Models/prism.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vape/Laser/master/Assets/Resources/Models/prism.fbx -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2019.2.5f1 2 | m_EditorVersionWithRevision: 2019.2.5f1 (9dace1eed4cc) 3 | -------------------------------------------------------------------------------- /Assets/Packages/JsonDotNet/Assemblies/AOT/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vape/Laser/master/Assets/Packages/JsonDotNet/Assemblies/AOT/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /Assets/Packages/JsonDotNet/Assemblies/Windows/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vape/Laser/master/Assets/Packages/JsonDotNet/Assemblies/Windows/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /Assets/Source/Environment.cs: -------------------------------------------------------------------------------- 1 | namespace Laser 2 | { 3 | public enum Environment 4 | { 5 | Debug, 6 | QA, 7 | Production 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: [] 7 | -------------------------------------------------------------------------------- /Assets/Packages/JsonDotNet/Assemblies/Standalone/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vape/Laser/master/Assets/Packages/JsonDotNet/Assemblies/Standalone/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /Assets/Source/Game/Level/EntityRulesBridge.cs: -------------------------------------------------------------------------------- 1 | namespace Laser.Game.Level 2 | { 3 | public class EntityRulesBridge 4 | { 5 | public bool IsLevelInteractive; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Assets/Scenes/Game.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f0cdbe5c4e4563547a942cdb84b24067 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scenes/Editor.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 675c817fd25a84a4c9eaab2326c5824b 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Resources/Levels/1.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a25bcd16510f76e458a3941646ab2e7e 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Resources/Levels/2.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 24bb9c401bb729f4781fad0839f8c2f2 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Resources/UI/WinScreen.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7188d2278ec9f2448db92037a962614 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4389cd47136386a4bad6b4f846d3ced5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Source.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 97d61cf23050a224ea5851a879fae446 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Source/Settings.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace Laser 4 | { 5 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 6 | public class Settings 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Assets/Packages.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5aa5c83988afa2844950d1e6041c59eb 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f1bcfdf566056b14ab42ec6a9f5a7538 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/UI.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 96c1e24c1dda5664caa64a635085c29a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/UI/MainMenuScreen.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 79f71b8a0a9928b4bab6fe703396e65d 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Source/@Laser.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 11d19e063bd4d81429b99eb5c150f926 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Source/Core.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d471b263ebbcfbd42b3105a60af24750 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Source/Game.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1ca62391b113daa42a97947321da884f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main/AbsorberController.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Laser.Game.Main 4 | { 5 | public class AbsorberController : MonoBehaviour 6 | { 7 | public AbsorberType Type; 8 | } 9 | } -------------------------------------------------------------------------------- /Assets/Resources/Levels.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 78f1b7ee9ab26af468a66f7f14e14f3f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/Models.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fc9e53aba8584324194b9e73da36b2b0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58107bdd214df7445877b7ef33071ff7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/Prefabs/Emitters/Droid.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 93b4799154f2b0b41acfd877828ef7ae 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Source/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bfee062a431382f45a0b60981c62c8ec 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Source/Game/Level.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ed7e73cdc442f1f4e9bdd23907a7a773 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a5a90e57ca7d2e64397a9b425af9a8cb 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Source/Game/UI.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d5630a322aeba946aa4b989a9a61c07 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Source/Game/Utils.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 41ee797611bb84e41b3a6a652a893d27 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Source/Shared.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eed6a1424b5599d46b16004a37fe86ee 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Packages/JsonDotNet.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cffe4841e4d91b047897e42499a90aba 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 06e895bdb60ca0646960084706f2c5a2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/Prefabs/Absorbers/Cubic.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 863267759f90da241b9d8a54a5dada01 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Source/Editor/@Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3bb139df4b326c74a9d1362eaee34faf 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Source/Editor/Menu.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1a27bffa03c53974f8be5f81ac1f1b8f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main/Grid.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8589bb2d9b3baeb44a6f13aeda40add1 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main/Level.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1f2a0bfb9bc962a41ad0f71b10b08288 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Source/Game/UI/Screens.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1128d95bf76bdc54eb85da817730fe2c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Source/Shared/@Shared.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2bbe6036f65439d4dbeb8f93d8302501 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /Assets/Editor Default Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e2e5f53483cf74b488c75c4df8343a76 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/Prefabs/Absorbers.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e7db9006b3740cb4c87fd5c1a68f0c10 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/Prefabs/Emitters.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af6a8a2c5f75793408c816627a3b86e4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/Prefabs/Reflectors/HalfBlock.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5093451ff86d6174e8409c83e1eacaa0 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Source/Editor/Utilities.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56b88382a6d31d349a78e602cf2e6f76 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main/Reflector.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c146bef0a31181a469ecc325d11d84cc 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/Prefabs/Reflectors.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 984b39b40bad9a74e8d60394ce3cec19 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Editor Default Resources/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dc73f7827c2e45d478eea921feef0cdd 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Editor Default Resources/Script Templates.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee490fbc30ffa814ba17de53b2975516 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/LevelItemsMap.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d9c065ee3d8e00244a26aa4f6089e1be 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/LevelSequence.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 03f78ac7d33eeb04683e6231e5abeb83 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/Materials/floor.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e72404f40c3621448a397b6481b9715b 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Editor Default Resources/Script Templates/editor_script_template.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 82d6b63cda056c8468bfa2f322cac239 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Editor Default Resources/Script Templates/game_script_template.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2f7076ac10d58ec41af9b7e8040a1240 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Resources/Materials/droid_beam.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85b0cfff14db6064a8e985eaecf1a918 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/Materials/droid_eye.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 917a8bc6265dec641bcaf4a2cc9c3c2e 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources/Materials/droid_skin.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ae365738cdc352e4eb57a42d8ac781b7 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main/Reflector/ReflectiveSurfaceController.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Laser.Game.Main.Reflector 4 | { 5 | [RequireComponent(typeof(Collider))] 6 | public class ReflectiveSurfaceController : MonoBehaviour 7 | { } 8 | } 9 | -------------------------------------------------------------------------------- /Assets/Editor Default Resources/Script Templates/behaviour_script_template.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4fe0bd5594b54ff468f20bdcc77e6da8 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Editor Default Resources/Materials/editor_floor.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c6918e64b73d1da439acedcccf96d474 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Editor Default Resources/Script Templates/serializable_game_script_template.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 76ae056348ecdc94eb2fa2519afd67aa 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Packages/JsonDotNet/Assemblies/AOT/Newtonsoft.Json.XML.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aadad8ac54f29e44583510294ac5c312 3 | timeCreated: 1466788355 4 | licenseType: Store 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Packages/JsonDotNet/Assemblies.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 577d9725f58264943855b8ac185531fe 3 | folderAsset: yes 4 | timeCreated: 1466788344 5 | licenseType: Store 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Packages/JsonDotNet/Assemblies/Windows/Newtonsoft.Json.XML.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 36f7323c55864364d8bb88c736e4bca6 3 | timeCreated: 1466788355 4 | licenseType: Store 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /Assets/Editor Default Resources/Materials/temp_grid_item.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cca6111365e31dd48aa0498b3d1e8258 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Packages/JsonDotNet/Assemblies/AOT.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 14f21d7a1e53a8c4e87b25526a7eb63c 3 | folderAsset: yes 4 | timeCreated: 1466788345 5 | licenseType: Store 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Packages/JsonDotNet/Assemblies/Standalone/Newtonsoft.Json.XML.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6807fedb8dcaf04682d2c84f0ab753f 3 | timeCreated: 1466788355 4 | licenseType: Store 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Editor Default Resources/Script Templates/game_script_template.txt: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using UnityEngine; 5 | 6 | namespace #NAMESPACE# 7 | { 8 | public class #SCRIPTNAME# 9 | { 10 | 11 | } 12 | } -------------------------------------------------------------------------------- /Assets/Packages/JsonDotNet/Assemblies/Standalone.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 01ef782d02bb1994dbe418b69432552b 3 | folderAsset: yes 4 | timeCreated: 1466788344 5 | licenseType: Store 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Packages/JsonDotNet/Assemblies/Windows.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1418141139a6ac443b18cb05c0643a29 3 | folderAsset: yes 4 | timeCreated: 1466788345 5 | licenseType: Store 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Resources/Levels/1.json: -------------------------------------------------------------------------------- 1 | {"entities":[{"tile":{"x":0,"y":4},"orient":6,"tiled":true,"type":2,"r_type":1},{"tile":{"x":0,"y":0},"tiled":true,"type":1,"e_type":1},{"tile":{"x":2,"y":0},"tiled":true,"type":3,"a_type":1},{"tile":{"x":2,"y":4},"orient":4,"tiled":true,"type":2,"r_type":1}]} -------------------------------------------------------------------------------- /Assets/Source/Core/Progression.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace Laser.Core 4 | { 5 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 6 | public class Progression 7 | { 8 | [JsonProperty] 9 | public int CurrentLevel; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Assets/Editor Default Resources/Script Templates/behaviour_script_template.txt: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using UnityEngine; 5 | 6 | namespace #NAMESPACE# 7 | { 8 | public class #SCRIPTNAME# : MonoBehaviour 9 | { 10 | 11 | } 12 | } -------------------------------------------------------------------------------- /Assets/Source/App.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c1ccf15735eec847bbb34b4b5820bac 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Config.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2ccb60be1749e054a8c771ec084f3243 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/GlobalTime.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Laser 4 | { 5 | public static class GlobalTime 6 | { 7 | public static DateTime Current 8 | { 9 | get 10 | { 11 | return DateTime.UtcNow; 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Assets/Source/Logger.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 950d2da342fef3d4db48215f41d266de 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Profile.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: df1d5e234ba43cf41af62ea1e94c111e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Environment.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e6d589664e2b8d041b4776301da9112e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/UI/Screens/MainMenuScreen.cs: -------------------------------------------------------------------------------- 1 | namespace Laser.Game.UI.Screens 2 | { 3 | public class MainMenuScreen : ScreenController 4 | { 5 | public void Play() 6 | { 7 | FindObjectOfType().LoadNextLevel(); 8 | Close(); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Assets/Source/GlobalTime.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 80207498e80e79941a2011a9ccaa115b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Settings.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1456a3102e095364ba5d62529391fc4c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Core/Progression.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 11ec5fa099060cc4b87699d9834103ff 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Editor/GridEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 03bfe4e7e4e0c6c4b96f54a534779a11 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/GameManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 71417cc691a7ccf42b74ac9502f4db05 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/InitManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2acca8e9ef7d85a4c8c1771d78cfa293 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main/Tracer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 07b5808a07ad0fa428fa43082b15de5e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/UI/UIManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 45b4ae347b6aea74fbeb0fe8e6680d6d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/GameException.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7fa36f7465e2de243a4191362ad07f9d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Shared/Utilities.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 395aa0ce82825be4bbdb2625802f7db3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Editor Default Resources/Script Templates/editor_script_template.txt: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Text; 4 | using System.Collections.Generic; 5 | using UnityEditor; 6 | using UnityEngine; 7 | 8 | namespace #NAMESPACE# 9 | { 10 | public class #SCRIPTNAME# 11 | { 12 | 13 | } 14 | } -------------------------------------------------------------------------------- /Assets/Source/App.ProfileManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4bb793bd6e5e1b247859bc5fd19eee37 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/App.SettingsManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 40a08b2a942782c468b2f9fb0e466d40 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Editor/CameraEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8198249073b266e41ac1326025b56c39 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Editor/LevelEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7d5929792bb0b0a4a9c05277b1e21585 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Editor/Menu/GameMenu.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 88e2b06ebb09a9e408569ef1e348ad8c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/Level/LevelData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 626bbf1a2c94217448afa1e0c8ce0605 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/Level/LevelEntity.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 86313a33db29c0249af81b32ac118842 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/MapClickHandler.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4978adcf8b6366741ae1a0defab6d91a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/StartupManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27f47292872f0da48a40703912ee1089 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Editor/GridElementEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5b5aadea0a564d741a2162fd4dd82bee 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Editor/LevelEditorWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 21da841fe974e3f44a3d9ffdafaedddc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Editor/LevelEntityEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 429fc3ff7aa536d4db1fc1cc3628e870 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/Level/LevelController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b9eceb5b3a1e575488ae72d6efdcb6f6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/Level/LevelItemsMap.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1b65521ca558f8f4f940578a550b9b3e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/Level/LevelSequence.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 86f4b8dc19a3a4b419447f1c881dd822 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main/EmitterController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bed7f3e58c7aa4f4a9b2dc041c64aa51 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/UI/ScreenController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6e82697e93f884f42959baa02c4d581d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/UI/Screens/WinScreen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2fc3ac541b80bd0449d91c40d3f09435 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/Utils/CameraController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0ce68f12ec871c4449c6d02aea010899 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/Utils/ClickRedirect.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 01716f1e621b2db48a87e4b13d162340 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/Scenes/Game.unity 10 | guid: f0cdbe5c4e4563547a942cdb84b24067 11 | m_configObjects: {} 12 | -------------------------------------------------------------------------------- /Assets/Source/Editor/Utilities/EditorUtilities.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d125bd137ec74634f84577911c688f8d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/Level/EntityRulesBridge.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f308ee59d64052244a9513bdb4264e45 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/Level/LevelController.Load.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e27e760a5993644289fd378646765cb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/Level/LevelController.Save.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c5974557c61e7a4448b65272bb9de8ed 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main/AbsorberController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 71ffa5e07653668418b82fcd3e74a895 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main/Grid/GridController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dfc03d11111d082458670be248e0286c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main/LevelEntityController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 03aff2ac8f753924aa4a8a0807b354eb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/UI/Screens/MainMenuScreen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c854c39de1acdbb4cbab5e7dc558b0d6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Editor/Utilities/AddScriptProcessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d127a885ee3f82429ff107d2160d739 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Editor/Utilities/CreateScriptMenu.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7fd1516bd2445e546915794ff2831119 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main/Grid/GridElementController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 503c03191d09fe949b75be7447fab0dd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/Utils/CameraScrollAreaController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 93491ddd66eaaa4439a4be729463d511 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main/Reflector/ReflectorController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab7961c77ab2b9c4e9e1759f7090555f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_RenderPipeSettingsPath: 10 | m_FixedTimeStep: 0.016666668 11 | m_MaxDeltaTime: 0.05 12 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main/Reflector/ReflectiveSurfaceController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c20fc6bc2b732da43927194ca493ba42 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Source/Shared/@Shared.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Laser.Shared", 3 | "references": [], 4 | "includePlatforms": [], 5 | "excludePlatforms": [], 6 | "allowUnsafeCode": false, 7 | "overrideReferences": false, 8 | "precompiledReferences": [], 9 | "autoReferenced": true, 10 | "defineConstraints": [], 11 | "versionDefines": [] 12 | } -------------------------------------------------------------------------------- /Assets/Source/Game/Level/LevelData.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | 4 | namespace Laser.Game.Level 5 | { 6 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 7 | public class LevelData 8 | { 9 | [JsonProperty("entities")] 10 | public List Entities = new List(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Assets/Resources/Levels/2.json: -------------------------------------------------------------------------------- 1 | {"entities":[{"tile":{"x":0,"y":4},"orient":5,"tiled":true,"type":2,"r_type":1},{"tile":{"x":0,"y":0},"orient":1,"tiled":true,"type":1,"e_type":1},{"tile":{"x":3,"y":0},"tiled":true,"type":3,"a_type":1},{"tile":{"x":2,"y":4},"tiled":true,"type":2,"r_type":1},{"tile":{"x":2,"y":3},"tiled":true,"type":2,"r_type":1},{"tile":{"x":3,"y":3},"tiled":true,"type":2,"r_type":1}]} -------------------------------------------------------------------------------- /Assets/Editor Default Resources/Script Templates/serializable_game_script_template.txt: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Runtime.Serialization; 6 | 7 | namespace #NAMESPACE# 8 | { 9 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 10 | public class #SCRIPTNAME# 11 | { 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Assets/Source/@Laser.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Laser", 3 | "references": [ 4 | "GUID:2bbe6036f65439d4dbeb8f93d8302501" 5 | ], 6 | "includePlatforms": [], 7 | "excludePlatforms": [], 8 | "allowUnsafeCode": false, 9 | "overrideReferences": false, 10 | "precompiledReferences": [], 11 | "autoReferenced": true, 12 | "defineConstraints": [], 13 | "versionDefines": [] 14 | } -------------------------------------------------------------------------------- /Assets/Source/Game/Level/LevelSequence.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using UnityEngine; 7 | 8 | namespace Laser.Game 9 | { 10 | [CreateAssetMenu(fileName = "LevelSequence", menuName = "Level/Levels Sequence", order = 1)] 11 | public class LevelSequence : ScriptableObject 12 | { 13 | public string[] Levels; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Assets/Source/Editor/@Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Laser.Editor", 3 | "references": [ 4 | "GUID:11d19e063bd4d81429b99eb5c150f926", 5 | "GUID:2bbe6036f65439d4dbeb8f93d8302501" 6 | ], 7 | "includePlatforms": [ 8 | "Editor" 9 | ], 10 | "excludePlatforms": [], 11 | "allowUnsafeCode": false, 12 | "overrideReferences": false, 13 | "precompiledReferences": [], 14 | "autoReferenced": true, 15 | "defineConstraints": [], 16 | "versionDefines": [] 17 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Laser 2 | Game where laser beam needs to reach its target 3 | 4 | ## Features 5 | ### Basic gameplay loop 6 | _you can even try two exciting test levels, one of which is broken_ 7 | 8 | ![Gameplay screenshot](https://raw.githubusercontent.com/vape/Laser/master/Screenshots/game.png) 9 | --- 10 | ### Full featured level editor 11 | _yet not so much features_ 12 | 13 | ![Editor screenshot](https://raw.githubusercontent.com/vape/Laser/master/Screenshots/editor.png) 14 | --- 15 | ### It's open 16 | _MIT flavored_ 17 | -------------------------------------------------------------------------------- /Assets/Resources/LevelSequence.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 86f4b8dc19a3a4b419447f1c881dd822, type: 3} 13 | m_Name: LevelSequence 14 | m_EditorClassIdentifier: 15 | Levels: 16 | - 1 17 | - 2 18 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Volume: 1 8 | Rolloff Scale: 1 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_SampleRate: 0 12 | m_DSPBufferSize: 1024 13 | m_VirtualVoiceCount: 512 14 | m_RealVoiceCount: 32 15 | m_SpatializerPlugin: 16 | m_AmbisonicDecoderPlugin: 17 | m_DisableAudio: 0 18 | m_VirtualizeEffects: 1 19 | m_RequestedDSPBufferSize: 1024 20 | -------------------------------------------------------------------------------- /Assets/Source/Editor/Menu/GameMenu.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace Laser.Editor.Menu 6 | { 7 | public static class GameMenu 8 | { 9 | [MenuItem("Game/Profile/Reset")] 10 | public static void ResetProfile() 11 | { 12 | Directory.Delete(App.GetProfilesDirectory(), true); 13 | } 14 | 15 | [MenuItem("Game/Profile/Reset", validate = true)] 16 | public static bool ResetProfileValidate() 17 | { 18 | return !Application.isPlaying; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Assets/Source/Game/InitManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.SceneManagement; 4 | 5 | namespace Laser.Game 6 | { 7 | public class InitManager : MonoBehaviour 8 | { 9 | public bool IsLoaded 10 | { 11 | get 12 | { 13 | return GameScene.isLoaded; 14 | } 15 | } 16 | 17 | [NonSerialized] 18 | public Scene GameScene; 19 | 20 | private void Awake() 21 | { 22 | GameScene = SceneManager.GetSceneByName("Game"); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Assets/Source/Game/UI/Screens/WinScreen.cs: -------------------------------------------------------------------------------- 1 | namespace Laser.Game.UI.Screens 2 | { 3 | public class WinScreen : ScreenController 4 | { 5 | public override void Init(params object[] param) 6 | { 7 | base.Init(param); 8 | } 9 | 10 | public void Next() 11 | { 12 | FindObjectOfType().LoadNextLevel(); 13 | Close(); 14 | } 15 | 16 | public void Exit() 17 | { 18 | FindObjectOfType().OpenMainMenuScreen(); 19 | Close(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /Assets/Source/App.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using UnityEngine; 3 | 4 | namespace Laser 5 | { 6 | public static partial class App 7 | { 8 | public static Environment Environment 9 | { 10 | get 11 | { 12 | return Environment.Debug; 13 | } 14 | } 15 | 16 | public static string GetAppDirectory() 17 | { 18 | return Application.persistentDataPath; 19 | } 20 | 21 | public static string GetProfilesDirectory() 22 | { 23 | return 24 | Path.Combine( 25 | GetAppDirectory(), 26 | "Profiles" 27 | ); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Assets/Source/Editor/Utilities/EditorUtilities.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Laser.Editor.Utilities 4 | { 5 | public static class EditorUtilities 6 | { 7 | public static void ApplyMaterialRecursively(GameObject obj, Material material) 8 | { 9 | var meshRenderer = obj.GetComponent(); 10 | if (meshRenderer != null) 11 | { 12 | meshRenderer.material = material; 13 | } 14 | 15 | for (int i = 0; i < obj.transform.childCount; ++i) 16 | { 17 | var child = obj.transform.GetChild(i); 18 | ApplyMaterialRecursively(child.gameObject, material); 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Assets/Source/Shared/Utilities.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using UnityEngine; 5 | 6 | namespace Laser.Shared 7 | { 8 | public static class Utilities 9 | { 10 | public static void DestroyChildrens(this Transform transform, bool immediate = false) 11 | { 12 | for (int i = transform.childCount - 1; i >= 0; --i) 13 | { 14 | if (immediate) 15 | { 16 | GameObject.DestroyImmediate(transform.GetChild(i).gameObject); 17 | } 18 | else 19 | { 20 | GameObject.Destroy(transform.GetChild(i).gameObject); 21 | } 22 | } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /Assets/Resources/LevelItemsMap.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 1b65521ca558f8f4f940578a550b9b3e, type: 3} 13 | m_Name: LevelItemsMap 14 | m_EditorClassIdentifier: 15 | Absorbers: 16 | - Type: 1 17 | Prefab: {fileID: 2089368857, guid: 863267759f90da241b9d8a54a5dada01, type: 3} 18 | Emitters: 19 | - Type: 1 20 | Prefab: {fileID: 5037350164229943751, guid: 93b4799154f2b0b41acfd877828ef7ae, 21 | type: 3} 22 | Reflectors: 23 | - Type: 1 24 | Prefab: {fileID: 586486538392157298, guid: 5093451ff86d6174e8409c83e1eacaa0, type: 3} 25 | -------------------------------------------------------------------------------- /Assets/Source/Game/UI/ScreenController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace Laser.Game.UI 5 | { 6 | public class ScreenController : MonoBehaviour 7 | { 8 | public event Action Closing; 9 | public event Action Closed; 10 | 11 | public virtual void Init(params object[] param) 12 | { 13 | 14 | } 15 | 16 | public void Close() 17 | { 18 | Closing?.Invoke(); 19 | Closing = null; 20 | BeforeClosed(); 21 | 22 | Destroy(gameObject); 23 | } 24 | 25 | private void OnDestroy() 26 | { 27 | Closed?.Invoke(); 28 | Closed = null; 29 | 30 | OnDestroyScreen(); 31 | } 32 | 33 | protected virtual void OnDestroyScreen() 34 | { } 35 | 36 | protected virtual void BeforeClosed() 37 | { } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Assets/Source/Game/Utils/ClickRedirect.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Laser.Game.Utils 4 | { 5 | public class ClickRedirect : MonoBehaviour, IGameObjectClickHandler 6 | { 7 | public enum Direction 8 | { 9 | Up, 10 | Reference 11 | } 12 | 13 | public Direction Dir; 14 | public GameObject Reference; 15 | 16 | public void HandleClick() 17 | { 18 | switch (Dir) 19 | { 20 | case Direction.Up: 21 | if (transform.parent.TryGetComponent(out var parentClickHandler)) { parentClickHandler.HandleClick(); } 22 | break; 23 | case Direction.Reference: 24 | if (Reference.TryGetComponent(out var refClickHandler)) { refClickHandler.HandleClick(); }; 25 | break; 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Assets/Source/Profile.cs: -------------------------------------------------------------------------------- 1 | using Laser.Core; 2 | using Newtonsoft.Json; 3 | using System; 4 | 5 | namespace Laser 6 | { 7 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 8 | public class Profile 9 | { 10 | public static Profile Create() 11 | { 12 | return new Profile(true); 13 | } 14 | 15 | [JsonProperty] 16 | public DateTime CreationTime 17 | { get; private set; } = DateTime.UtcNow; 18 | 19 | [JsonProperty] 20 | public DateTime SaveTime 21 | { get; set; } 22 | 23 | [JsonProperty] 24 | public Progression Progression 25 | { get; set; } 26 | 27 | public Profile() 28 | : this(false) 29 | { } 30 | 31 | private Profile(bool initAsNew) 32 | { 33 | if (initAsNew) 34 | { 35 | Progression = new Progression(); 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 8 7 | m_ExternalVersionControlSupport: Hidden Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 0 11 | m_PrefabRegularEnvironment: {fileID: 0} 12 | m_PrefabUIEnvironment: {fileID: 0} 13 | m_SpritePackerMode: 0 14 | m_SpritePackerPaddingPower: 1 15 | m_EtcTextureCompressorBehavior: 1 16 | m_EtcTextureFastCompressor: 1 17 | m_EtcTextureNormalCompressor: 2 18 | m_EtcTextureBestCompressor: 4 19 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref 20 | m_ProjectGenerationRootNamespace: 21 | m_CollabEditorSettings: 22 | inProgressEnabled: 1 23 | m_EnableTextureStreamingInEditMode: 1 24 | m_EnableTextureStreamingInPlayMode: 1 25 | m_AsyncShaderCompilation: 1 26 | m_ShowLightmapResolutionOverlay: 1 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /[Bb]uilds/ 6 | /[Ll]ogs/ 7 | 8 | # Never ignore Asset meta data 9 | !/[Aa]ssets/**/*.meta 10 | 11 | # Uncomment this line if you wish to ignore the asset store tools plugin 12 | # /[Aa]ssets/AssetStoreTools* 13 | 14 | # TextMesh Pro files 15 | [Aa]ssets/TextMesh*Pro/ 16 | 17 | # Visual Studio cache directory 18 | .vs/ 19 | 20 | # Gradle cache directory 21 | .gradle/ 22 | 23 | # Autogenerated VS/MD/Consulo solution and project files 24 | ExportedObj/ 25 | .consulo/ 26 | *.csproj 27 | *.unityproj 28 | *.sln 29 | *.suo 30 | *.tmp 31 | *.user 32 | *.userprefs 33 | *.pidb 34 | *.booproj 35 | *.svd 36 | *.pdb 37 | *.mdb 38 | *.opendb 39 | *.VC.db 40 | 41 | # Unity3D generated meta files 42 | *.pidb.meta 43 | *.pdb.meta 44 | *.mdb.meta 45 | 46 | # Unity3D generated file on crash reports 47 | sysinfo.txt 48 | 49 | # Builds 50 | *.apk 51 | *.unitypackage 52 | 53 | # Crashlytics generated file 54 | crashlytics-build.properties 55 | 56 | # MacOS files 57 | .DS_Store -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_TestInitMode: 0 13 | CrashReportingSettings: 14 | m_EventUrl: https://perf-events.cloud.unity3d.com 15 | m_Enabled: 0 16 | m_LogBufferSize: 10 17 | m_CaptureEditorExceptions: 1 18 | UnityPurchasingSettings: 19 | m_Enabled: 0 20 | m_TestMode: 0 21 | UnityAnalyticsSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | m_InitializeOnStartup: 1 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /Assets/Source/Game/StartupManager.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using UnityEngine; 3 | 4 | namespace Laser.Game 5 | { 6 | public class StartupManager : MonoBehaviour 7 | { 8 | private const string ProfileName = "profile"; 9 | 10 | private static void Initialize() 11 | { 12 | Application.targetFrameRate = 60; 13 | 14 | if (App.Profile == null) 15 | { 16 | try 17 | { 18 | App.LoadProfile(ProfileName); 19 | } 20 | catch (FileNotFoundException) 21 | { 22 | var profile = Profile.Create(); 23 | App.LoadProfile(profile, ProfileName); 24 | App.SaveProfile(); 25 | } 26 | } 27 | 28 | if (App.Settings == null) 29 | { 30 | App.LoadSettings(); 31 | } 32 | 33 | Config.Reload(); 34 | } 35 | 36 | private void Awake() 37 | { 38 | Initialize(); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Artem Sokolov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Assets/Source/Game/Utils/CameraScrollAreaController.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.EventSystems; 3 | using UnityEngine.UI; 4 | 5 | namespace Laser.Game.Utils 6 | { 7 | public class NonDrawingGraphic : Graphic 8 | { 9 | public override void SetMaterialDirty() { return; } 10 | public override void SetVerticesDirty() { return; } 11 | 12 | private RectTransform rect; 13 | 14 | protected override void OnPopulateMesh(VertexHelper vh) 15 | { 16 | vh.Clear(); 17 | return; 18 | } 19 | } 20 | 21 | [RequireComponent(typeof(CanvasRenderer))] 22 | [RequireComponent(typeof(RectTransform))] 23 | public class CameraScrollAreaController : NonDrawingGraphic, IPointerExitHandler, IPointerEnterHandler 24 | { 25 | public bool CanScroll 26 | { get; private set; } 27 | 28 | public void OnPointerEnter(PointerEventData eventData) 29 | { 30 | CanScroll = true; 31 | } 32 | 33 | public void OnPointerExit(PointerEventData eventData) 34 | { 35 | CanScroll = false; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Assets/Source/Game/Level/LevelItemsMap.cs: -------------------------------------------------------------------------------- 1 | using Laser.Game.Main; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using UnityEngine; 8 | 9 | namespace Laser.Game.Level 10 | { 11 | [Serializable] 12 | public class AbsorberTypePair 13 | { 14 | [SerializeField] 15 | public AbsorberType Type; 16 | [SerializeField] 17 | public AbsorberController Prefab; 18 | } 19 | 20 | [Serializable] 21 | public class EmitterTypePair 22 | { 23 | [SerializeField] 24 | public EmitterType Type; 25 | [SerializeField] 26 | public EmitterController Prefab; 27 | } 28 | 29 | [Serializable] 30 | public class ReflectorTypePair 31 | { 32 | [SerializeField] 33 | public ReflectorType Type; 34 | [SerializeField] 35 | public ReflectorController Prefab; 36 | } 37 | 38 | [CreateAssetMenu(fileName = "LevelItemsMap", menuName = "Level/Level Items Map", order = 1)] 39 | public class LevelItemsMap : ScriptableObject 40 | { 41 | public AbsorberTypePair[] Absorbers; 42 | public EmitterTypePair[] Emitters; 43 | public ReflectorTypePair[] Reflectors; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Assets/Source/Game/Level/LevelEntity.cs: -------------------------------------------------------------------------------- 1 | using Laser.Game.Main; 2 | using Laser.Game.Main.Grid; 3 | using Newtonsoft.Json; 4 | using System.ComponentModel; 5 | 6 | namespace Laser.Game.Level 7 | { 8 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 9 | public class LevelEntity 10 | { 11 | [JsonProperty("tile")] 12 | public GridTile Tile; 13 | 14 | [DefaultValue(EntityOrientation.N)] 15 | [JsonProperty("orient", DefaultValueHandling = DefaultValueHandling.Ignore)] 16 | public EntityOrientation Orientation; 17 | 18 | [JsonProperty("tiled")] 19 | public bool IsTiled; 20 | 21 | [JsonProperty("type")] 22 | public EntityType Type; 23 | 24 | [DefaultValue(ReflectorType.None)] 25 | [JsonProperty("r_type", DefaultValueHandling = DefaultValueHandling.Ignore)] 26 | public ReflectorType ReflectorType; 27 | 28 | [DefaultValue(EmitterType.None)] 29 | [JsonProperty("e_type", DefaultValueHandling = DefaultValueHandling.Ignore)] 30 | public EmitterType EmitterType; 31 | 32 | [DefaultValue(AbsorberType.None)] 33 | [JsonProperty("a_type", DefaultValueHandling = DefaultValueHandling.Ignore)] 34 | public AbsorberType AbsorberType; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 11 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ContactPairsMode: 0 26 | m_BroadphaseType: 0 27 | m_WorldBounds: 28 | m_Center: {x: 0, y: 0, z: 0} 29 | m_Extent: {x: 250, y: 250, z: 250} 30 | m_WorldSubdivisions: 8 31 | m_FrictionType: 0 32 | m_EnableEnhancedDeterminism: 0 33 | m_EnableUnifiedHeightmaps: 1 34 | m_DefaultMaxAngluarSpeed: 7 35 | -------------------------------------------------------------------------------- /Assets/Source/Game/MapClickHandler.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace Laser.Game 4 | { 5 | public interface IGameObjectClickHandler 6 | { 7 | void HandleClick(); 8 | } 9 | 10 | [RequireComponent(typeof(Camera))] 11 | public class MapClickHandler : MonoBehaviour 12 | { 13 | private Vector3 mouseDownPos; 14 | 15 | private void Update() 16 | { 17 | if (Input.GetMouseButtonDown(0)) 18 | { 19 | mouseDownPos = Input.mousePosition; 20 | } 21 | 22 | if (Input.GetMouseButtonUp(0)) 23 | { 24 | var delta = Input.mousePosition - mouseDownPos; 25 | if (delta.magnitude > 10) 26 | { 27 | return; 28 | } 29 | 30 | var ray = GetComponent().ScreenPointToRay(Input.mousePosition); 31 | var hit = default(RaycastHit); 32 | 33 | if (Physics.Raycast(ray, out hit)) 34 | { 35 | var gameObject = hit.transform.gameObject; 36 | var handlers = gameObject.GetComponents(); 37 | for (int i = 0; i < handlers.Length; ++i) 38 | { 39 | handlers[i].HandleClick(); 40 | } 41 | } 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Assets/Source/Editor/Utilities/AddScriptProcessor.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | 4 | namespace Laser.Editor.Utilities 5 | { 6 | public class AddScriptProcessor : UnityEditor.AssetModificationProcessor 7 | { 8 | public const string DefaultGameNamespace = "Laser"; 9 | public const string DefaultEditorNamespace = "Laser.Editor"; 10 | 11 | public static void OnWillCreateAsset(string path) 12 | { 13 | path = path.Replace(".meta", ""); 14 | 15 | var index = path.LastIndexOf("."); 16 | if (index < 0) 17 | { 18 | return; 19 | } 20 | 21 | var extension = path.Substring(index); 22 | if (extension != ".cs") 23 | { 24 | return; 25 | } 26 | 27 | index = Application.dataPath.LastIndexOf("Assets"); 28 | path = Application.dataPath.Substring(0, index) + path; 29 | 30 | var content = System.IO.File.ReadAllText(path); 31 | var lastPart = path.Substring(path.IndexOf("Assets")); 32 | var namespaceString = lastPart.Substring(0, lastPart.LastIndexOf('/')); 33 | namespaceString = namespaceString.Replace("Assets/Source/Editor", DefaultEditorNamespace).Replace("Assets/Source", DefaultGameNamespace).Replace('/', '.'); 34 | content = content.Replace("#NAMESPACE#", namespaceString); 35 | System.IO.File.WriteAllText(path, content); 36 | 37 | AssetDatabase.Refresh(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Assets/Source/GameException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Laser 4 | { 5 | public class GameException : Exception 6 | { 7 | public static string GetHelperMessage(int code) 8 | { 9 | var msg = default(string); 10 | switch (code) 11 | { 12 | case 0: 13 | case 1: 14 | msg = "Couldn't save game progress."; 15 | break; 16 | case 2: 17 | case 3: 18 | msg = "Couldn't load game progress."; 19 | break; 20 | default: 21 | msg = $"Unknown error."; 22 | break; 23 | } 24 | 25 | return $"{msg} Code: {code}"; 26 | } 27 | 28 | public string HelpMessage 29 | { get; private set; } 30 | 31 | public readonly int Code; 32 | 33 | public GameException(int code) 34 | : this(code, null, null) 35 | { } 36 | 37 | public GameException(int code, string debugMessage) 38 | : this(code, null, debugMessage) 39 | { } 40 | 41 | public GameException(string debugMessage) 42 | : this(-1, null, debugMessage) 43 | { } 44 | 45 | public GameException(int code, Exception innerException, string debugMessage = null) 46 | : base(debugMessage == null ? "Game exception" : debugMessage, innerException) 47 | { 48 | Code = code; 49 | HelpMessage = GetHelperMessage(code); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Assets/Source/Config.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using UnityEngine; 3 | 4 | namespace Laser 5 | { 6 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 7 | public partial class Config 8 | { 9 | public static Config Instnace 10 | { 11 | get 12 | { 13 | lock (loadingLock) 14 | { 15 | if (instance == null) 16 | { 17 | instance = new Config(); 18 | instance.Load(); 19 | } 20 | 21 | return instance; 22 | } 23 | } 24 | } 25 | 26 | private static Config instance; 27 | private static object loadingLock = new object(); 28 | 29 | public static void Reload() 30 | { 31 | var config = new Config(); 32 | config.Load(); 33 | 34 | lock (loadingLock) 35 | { 36 | instance = config; 37 | } 38 | } 39 | 40 | private Config() 41 | { } 42 | 43 | private void Load() 44 | { 45 | var deserializerSettings = new JsonSerializerSettings() 46 | { 47 | NullValueHandling = NullValueHandling.Include 48 | }; 49 | 50 | var configAsset = Resources.Load("Config/config"); 51 | if (configAsset?.text != null) 52 | { 53 | JsonConvert.PopulateObject(configAsset.text, this, deserializerSettings); 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Assets/Source/Editor/Utilities/CreateScriptMenu.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace Laser.Editor.Utilities 6 | { 7 | public static class CreateMenu 8 | { 9 | [MenuItem("Assets/Create/Script/C# Editor Script", priority = 80)] 10 | public static void CreateEditorScript() 11 | { 12 | CreateTextAsset("editor_script_template", "EditorScript.cs"); 13 | } 14 | 15 | [MenuItem("Assets/Create/Script/C# Game Script", priority = 81)] 16 | public static void CreateGameScript() 17 | { 18 | CreateTextAsset("game_script_template", "GameScript.cs"); 19 | } 20 | 21 | [MenuItem("Assets/Create/Script/C# Game Script (serializable)", priority = 81)] 22 | public static void CreateSerializableGameScript() 23 | { 24 | CreateTextAsset("serializable_game_script_template", "GameScript.cs"); 25 | } 26 | 27 | [MenuItem("Assets/Create/Script/C# Behaviour Script", priority = 81)] 28 | public static void CreateBehaviourScript() 29 | { 30 | CreateTextAsset("behaviour_script_template", "BehaviourScript.cs"); 31 | } 32 | 33 | public static void CreateTextAsset(string templateName, string defaultName) 34 | { 35 | ProjectWindowUtil.CreateScriptAssetFromTemplateFile(GetTemplatePath(templateName), defaultName); 36 | AssetDatabase.Refresh(); 37 | } 38 | 39 | private static string GetTemplatePath(string templateName) 40 | { 41 | return Path.Combine(Application.dataPath, "Editor Default Resources", "Script Templates", templateName + ".txt"); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.collab-proxy": "1.2.16", 4 | "com.unity.ext.nunit": "1.0.0", 5 | "com.unity.ide.rider": "1.1.0", 6 | "com.unity.ide.vscode": "1.1.0", 7 | "com.unity.package-manager-ui": "2.2.0", 8 | "com.unity.test-framework": "1.0.13", 9 | "com.unity.textmeshpro": "2.0.1", 10 | "com.unity.timeline": "1.1.0", 11 | "com.unity.ugui": "1.0.0", 12 | "com.unity.modules.ai": "1.0.0", 13 | "com.unity.modules.androidjni": "1.0.0", 14 | "com.unity.modules.animation": "1.0.0", 15 | "com.unity.modules.assetbundle": "1.0.0", 16 | "com.unity.modules.audio": "1.0.0", 17 | "com.unity.modules.cloth": "1.0.0", 18 | "com.unity.modules.director": "1.0.0", 19 | "com.unity.modules.imageconversion": "1.0.0", 20 | "com.unity.modules.imgui": "1.0.0", 21 | "com.unity.modules.jsonserialize": "1.0.0", 22 | "com.unity.modules.particlesystem": "1.0.0", 23 | "com.unity.modules.physics": "1.0.0", 24 | "com.unity.modules.physics2d": "1.0.0", 25 | "com.unity.modules.screencapture": "1.0.0", 26 | "com.unity.modules.terrain": "1.0.0", 27 | "com.unity.modules.terrainphysics": "1.0.0", 28 | "com.unity.modules.tilemap": "1.0.0", 29 | "com.unity.modules.ui": "1.0.0", 30 | "com.unity.modules.uielements": "1.0.0", 31 | "com.unity.modules.umbra": "1.0.0", 32 | "com.unity.modules.unityanalytics": "1.0.0", 33 | "com.unity.modules.unitywebrequest": "1.0.0", 34 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 35 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 36 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 37 | "com.unity.modules.unitywebrequestwww": "1.0.0", 38 | "com.unity.modules.vehicles": "1.0.0", 39 | "com.unity.modules.video": "1.0.0", 40 | "com.unity.modules.vr": "1.0.0", 41 | "com.unity.modules.wind": "1.0.0", 42 | "com.unity.modules.xr": "1.0.0" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Assets/Source/App.SettingsManager.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.IO; 3 | 4 | namespace Laser 5 | { 6 | public static partial class App 7 | { 8 | public static Settings Settings 9 | { get; private set; } = new Settings(); 10 | 11 | public static void ResetSettings() 12 | { 13 | Settings = new Settings(); 14 | } 15 | 16 | public static void SaveSettings() 17 | { 18 | var path = Path.Combine(GetAppDirectory(), "settings"); 19 | 20 | using (var stream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read)) 21 | using (var writer = new StreamWriter(stream)) 22 | using (var jsonWriter = new JsonTextWriter(writer)) 23 | { 24 | var settings = new JsonSerializerSettings() 25 | { 26 | TypeNameHandling = TypeNameHandling.Auto 27 | }; 28 | 29 | JsonSerializer.Create(settings).Serialize(jsonWriter, Settings); 30 | } 31 | } 32 | 33 | public static void LoadSettings() 34 | { 35 | var path = Path.Combine(GetAppDirectory(), "settings"); 36 | if (!File.Exists(path)) 37 | { 38 | L.Debug("Settings file not found, falling back to default."); 39 | ResetSettings(); 40 | return; 41 | } 42 | 43 | using (var stream = File.OpenRead(path)) 44 | using (var reader = new StreamReader(stream)) 45 | using (var jsonReader = new JsonTextReader(reader)) 46 | { 47 | var settings = new JsonSerializerSettings() 48 | { 49 | TypeNameHandling = TypeNameHandling.Auto 50 | }; 51 | 52 | Settings = JsonSerializer.Create(settings).Deserialize(jsonReader); 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Assets/Source/Game/UI/UIManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using UnityEngine; 5 | 6 | namespace Laser.Game.UI 7 | { 8 | public enum ScreenType 9 | { 10 | None, 11 | MainMenu, 12 | Win 13 | } 14 | 15 | [Serializable] 16 | public class ScreenTypePair 17 | { 18 | [SerializeField] 19 | public ScreenType Type; 20 | [SerializeField] 21 | public ScreenController Prefab; 22 | } 23 | 24 | public class UIManager : MonoBehaviour 25 | { 26 | public ScreenType CurrentScreen 27 | { get; private set; } 28 | 29 | [SerializeField] 30 | public List ScreensPrefabs; 31 | [SerializeField] 32 | public GameObject ScreenContainer; 33 | 34 | private ScreenController currentScreenController; 35 | 36 | public ScreenController CurrentScreenController 37 | { 38 | get 39 | { 40 | return currentScreenController; 41 | } 42 | } 43 | 44 | public void OpenScreen(ScreenType type, params object[] param) 45 | { 46 | if (CurrentScreen != ScreenType.None) 47 | { 48 | currentScreenController.Close(); 49 | } 50 | 51 | var screen = ScreensPrefabs.FirstOrDefault((p) => p.Type == type); 52 | if (screen == null) 53 | { 54 | throw new Exception("Unknown screen type."); 55 | } 56 | 57 | currentScreenController = Instantiate(screen.Prefab, ScreenContainer.transform); 58 | currentScreenController.Closing += OnScreenClosing; 59 | currentScreenController.Init(param); 60 | 61 | CurrentScreen = type; 62 | } 63 | 64 | private void OnScreenClosing() 65 | { 66 | CurrentScreen = ScreenType.None; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main/Reflector/ReflectorController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace Laser.Game.Main 5 | { 6 | [RequireComponent(typeof(LevelEntityController))] 7 | public class ReflectorController : MonoBehaviour, IGameObjectClickHandler 8 | { 9 | public List AvailableOrientations 10 | { get; set; } = new List() 11 | { 12 | EntityOrientation.N, 13 | EntityOrientation.NE, 14 | EntityOrientation.E, 15 | EntityOrientation.SE, 16 | EntityOrientation.S, 17 | EntityOrientation.SW, 18 | EntityOrientation.W, 19 | EntityOrientation.NW 20 | }; 21 | private LevelEntityController EntityController 22 | { 23 | get 24 | { 25 | if (entityController == null) 26 | { 27 | entityController = GetComponent(); 28 | } 29 | 30 | return entityController; 31 | } 32 | } 33 | 34 | public ReflectorType Type; 35 | 36 | private LevelEntityController entityController; 37 | 38 | public void NextOrientation() 39 | { 40 | if (!AvailableOrientations.Contains(EntityController.Orientation)) 41 | { 42 | EntityController.Orientation = AvailableOrientations[0]; 43 | } 44 | else 45 | { 46 | var index = AvailableOrientations.IndexOf(EntityController.Orientation); 47 | index = AvailableOrientations.Count - 1 == index ? 0 : index + 1; 48 | EntityController.Orientation = AvailableOrientations[index]; 49 | } 50 | 51 | EntityController.ApplyOrientation(); 52 | } 53 | 54 | public void HandleClick() 55 | { 56 | if (EntityController.RulesBridge?.IsLevelInteractive ?? true) 57 | { 58 | NextOrientation(); 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main/LevelEntityController.cs: -------------------------------------------------------------------------------- 1 | using Laser.Game.Level; 2 | using UnityEngine; 3 | 4 | namespace Laser.Game.Main 5 | { 6 | // north is (0,0,1) 7 | public enum EntityOrientation 8 | { 9 | N, 10 | NE, 11 | E, 12 | SE, 13 | S, 14 | SW, 15 | W, 16 | NW 17 | } 18 | 19 | public static class EntityOrientationExtensions 20 | { 21 | public static float ToRotationAngle(this EntityOrientation o) 22 | { 23 | return 45f * (int)o; 24 | } 25 | } 26 | 27 | public enum EntityType 28 | { 29 | None, 30 | Emitter, 31 | Reflector, 32 | Absorber 33 | } 34 | 35 | public enum ReflectorType 36 | { 37 | None, 38 | HalfBlock 39 | } 40 | 41 | public enum EmitterType 42 | { 43 | None, 44 | Droid 45 | } 46 | 47 | public enum AbsorberType 48 | { 49 | None, 50 | Cubic 51 | } 52 | 53 | public class LevelEntityController : MonoBehaviour 54 | { 55 | public bool IsStationary 56 | { get; private set; } 57 | public EntityRulesBridge RulesBridge 58 | { get; set; } 59 | 60 | public EntityType Type; 61 | public EntityOrientation Orientation; 62 | 63 | private float targetAngle; 64 | private float speedTowardsTargetAngle; 65 | 66 | private void Start() 67 | { 68 | ApplyOrientation(); 69 | } 70 | 71 | private void Update() 72 | { 73 | var a = Mathf.SmoothDampAngle(transform.rotation.eulerAngles.y, targetAngle, ref speedTowardsTargetAngle, 0.1f); 74 | transform.rotation = Quaternion.Euler(0, a, 0); 75 | 76 | IsStationary = Mathf.Approximately(a, targetAngle); 77 | } 78 | 79 | public void ApplyOrientation(bool immediate = false) 80 | { 81 | targetAngle = Orientation.ToRotationAngle(); 82 | 83 | if (immediate) 84 | { 85 | transform.rotation = Quaternion.Euler(0, targetAngle, 0); 86 | } 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_AutoSimulation: 1 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_ReuseCollisionCallbacks: 1 46 | m_AutoSyncTransforms: 0 47 | m_AlwaysShowColliders: 0 48 | m_ShowColliderSleep: 1 49 | m_ShowColliderContacts: 0 50 | m_ShowColliderAABB: 0 51 | m_ContactArrowScale: 0.2 52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 57 | -------------------------------------------------------------------------------- /Assets/Source/Game/Level/LevelController.cs: -------------------------------------------------------------------------------- 1 | using Laser.Game.Main.Grid; 2 | using System.Linq; 3 | using UnityEngine; 4 | 5 | namespace Laser.Game.Level 6 | { 7 | public enum LevelState 8 | { 9 | None, 10 | Playing, 11 | Won 12 | } 13 | 14 | [RequireComponent(typeof(GridController))] 15 | public partial class LevelController : MonoBehaviour 16 | { 17 | public bool IsLevelLoaded 18 | { 19 | get 20 | { 21 | return levelLoaded; 22 | } 23 | } 24 | 25 | public LevelState State 26 | { 27 | get 28 | { 29 | return state; 30 | } 31 | private set 32 | { 33 | state = value; 34 | rulesBridge.IsLevelInteractive = state == LevelState.Playing; 35 | L.Debug($"Level state is set to {state}"); 36 | } 37 | } 38 | 39 | #if UNITY_EDITOR 40 | public LevelEntity EntityToSpawn 41 | { get; set; } 42 | #endif 43 | 44 | public GridController Grid; 45 | public LevelItemsMap ItemsMap; 46 | 47 | private bool levelLoaded; 48 | private LevelState state; 49 | private EntityRulesBridge rulesBridge = new EntityRulesBridge(); 50 | 51 | private void Awake() 52 | { } 53 | 54 | private void Update() 55 | { 56 | RefreshState(); 57 | } 58 | 59 | private void RefreshState() 60 | { 61 | if (State == LevelState.None) 62 | { 63 | if (IsLevelLoaded) 64 | { 65 | State = LevelState.Playing; 66 | } 67 | 68 | return; 69 | } 70 | 71 | if (State == LevelState.Playing) 72 | { 73 | if (!IsLevelLoaded) 74 | { 75 | State = LevelState.None; 76 | return; 77 | } 78 | 79 | if (Emitters.Any((e) => e.LitAbsorber != null) && Entities.All((e) => e.IsStationary)) 80 | { 81 | State = LevelState.Won; 82 | } 83 | } 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /Assets/Resources/Materials/droid_eye.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: droid_eye 11 | m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0} 12 | m_ShaderKeywords: 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _DetailAlbedoMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailMask: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailNormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _EmissionMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _MainTex: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MetallicGlossMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _OcclusionMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _ParallaxMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | m_Floats: 59 | - _BumpScale: 1 60 | - _Cutoff: 0.5 61 | - _DetailNormalMapScale: 1 62 | - _DstBlend: 0 63 | - _GlossMapScale: 1 64 | - _Glossiness: 0 65 | - _GlossyReflections: 1 66 | - _Metallic: 0 67 | - _Mode: 0 68 | - _OcclusionStrength: 1 69 | - _Parallax: 0.02 70 | - _SmoothnessTextureChannel: 0 71 | - _SpecularHighlights: 1 72 | - _SrcBlend: 1 73 | - _UVSec: 0 74 | - _ZWrite: 1 75 | m_Colors: 76 | - _Color: {r: 1, g: 0, b: 0, a: 1} 77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 0} 78 | -------------------------------------------------------------------------------- /Assets/Resources/Materials/droid_beam.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: droid_beam 11 | m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0} 12 | m_ShaderKeywords: _EMISSION 13 | m_LightmapFlags: 1 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _DetailAlbedoMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailMask: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailNormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _EmissionMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _MainTex: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MetallicGlossMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _OcclusionMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _ParallaxMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | m_Floats: 59 | - _BumpScale: 1 60 | - _Cutoff: 0.5 61 | - _DetailNormalMapScale: 1 62 | - _DstBlend: 0 63 | - _GlossMapScale: 1 64 | - _Glossiness: 0 65 | - _GlossyReflections: 1 66 | - _Metallic: 0 67 | - _Mode: 0 68 | - _OcclusionStrength: 1 69 | - _Parallax: 0.02 70 | - _SmoothnessTextureChannel: 0 71 | - _SpecularHighlights: 1 72 | - _SrcBlend: 1 73 | - _UVSec: 0 74 | - _ZWrite: 1 75 | m_Colors: 76 | - _Color: {r: 1, g: 0, b: 0, a: 1} 77 | - _EmissionColor: {r: 1, g: 0, b: 0, a: 0} 78 | -------------------------------------------------------------------------------- /Assets/Source/Editor/GridEditor.cs: -------------------------------------------------------------------------------- 1 | using Laser.Game.Main; 2 | using Laser.Game.Main.Grid; 3 | using UnityEditor; 4 | using UnityEngine; 5 | 6 | namespace Laser.Editor 7 | { 8 | [CustomEditor(typeof(GridController))] 9 | public partial class GridEditor : UnityEditor.Editor 10 | { 11 | private static void DrawGridOutline(GridController target) 12 | { 13 | for (int y = 0; y < target.Height; ++y) 14 | { 15 | for (int x = 0; x < target.Width; ++x) 16 | { 17 | var startX = target.GridToWorld((Vector2.up * y * target.CellSize) + Vector2.right * (x * target.CellSize)); 18 | var endX = target.GridToWorld((Vector2.up * y * target.CellSize) + Vector2.right * ((x + 1) * target.CellSize)); 19 | Gizmos.DrawLine(startX, endX); 20 | 21 | var startY = target.GridToWorld((Vector2.right * x * target.CellSize) + Vector2.up * (y * target.CellSize)); 22 | var endY = target.GridToWorld((Vector2.right * x * target.CellSize) + Vector2.up * ((y + 1) * target.CellSize)); 23 | Gizmos.DrawLine(startY, endY); 24 | } 25 | } 26 | 27 | var _startX = target.GridToWorld((Vector2.up * target.Height * target.CellSize)); 28 | var _endX = target.GridToWorld((Vector2.up * target.Height * target.CellSize) + Vector2.right * (target.Width * target.CellSize)); 29 | Gizmos.DrawLine(_startX, _endX); 30 | 31 | var _startY = target.GridToWorld((Vector2.right * target.Width * target.CellSize)); 32 | var _endY = target.GridToWorld((Vector2.right * target.Width * target.CellSize) + Vector2.up * (target.Height * target.CellSize)); 33 | Gizmos.DrawLine(_startY, _endY); 34 | } 35 | 36 | [DrawGizmo(GizmoType.Selected | GizmoType.NonSelected | GizmoType.Pickable)] 37 | private static void DrawGizmos(GridController target, GizmoType gizmoType) 38 | { 39 | Gizmos.color = Color.black; 40 | DrawGridOutline(target); 41 | } 42 | 43 | public override void OnInspectorGUI() 44 | { 45 | base.OnInspectorGUI(); 46 | 47 | if (GUILayout.Button("Layout now")) 48 | { 49 | ((GridController)target).Layout(); 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | m_PreloadedShaders: [] 39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 40 | type: 0} 41 | m_CustomRenderPipeline: {fileID: 0} 42 | m_TransparencySortMode: 0 43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 44 | m_DefaultRenderingPath: 1 45 | m_DefaultMobileRenderingPath: 1 46 | m_TierSettings: [] 47 | m_LightmapStripping: 0 48 | m_FogStripping: 0 49 | m_InstancingStripping: 0 50 | m_LightmapKeepPlain: 1 51 | m_LightmapKeepDirCombined: 1 52 | m_LightmapKeepDynamicPlain: 1 53 | m_LightmapKeepDynamicDirCombined: 1 54 | m_LightmapKeepShadowMask: 1 55 | m_LightmapKeepSubtractive: 1 56 | m_FogKeepLinear: 1 57 | m_FogKeepExp: 1 58 | m_FogKeepExp2: 1 59 | m_AlbedoSwatchInfos: [] 60 | m_LightsUseLinearIntensity: 0 61 | m_LightsUseColorTemperature: 0 62 | -------------------------------------------------------------------------------- /Assets/Editor Default Resources/Materials/temp_grid_item.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: temp_grid_item 11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 12 | m_ShaderKeywords: _ALPHAPREMULTIPLY_ON 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: 3000 17 | stringTagMap: 18 | RenderType: Transparent 19 | disabledShaderPasses: [] 20 | m_SavedProperties: 21 | serializedVersion: 3 22 | m_TexEnvs: 23 | - _BumpMap: 24 | m_Texture: {fileID: 0} 25 | m_Scale: {x: 1, y: 1} 26 | m_Offset: {x: 0, y: 0} 27 | - _DetailAlbedoMap: 28 | m_Texture: {fileID: 0} 29 | m_Scale: {x: 1, y: 1} 30 | m_Offset: {x: 0, y: 0} 31 | - _DetailMask: 32 | m_Texture: {fileID: 0} 33 | m_Scale: {x: 1, y: 1} 34 | m_Offset: {x: 0, y: 0} 35 | - _DetailNormalMap: 36 | m_Texture: {fileID: 0} 37 | m_Scale: {x: 1, y: 1} 38 | m_Offset: {x: 0, y: 0} 39 | - _EmissionMap: 40 | m_Texture: {fileID: 0} 41 | m_Scale: {x: 1, y: 1} 42 | m_Offset: {x: 0, y: 0} 43 | - _MainTex: 44 | m_Texture: {fileID: 0} 45 | m_Scale: {x: 1, y: 1} 46 | m_Offset: {x: 0, y: 0} 47 | - _MetallicGlossMap: 48 | m_Texture: {fileID: 0} 49 | m_Scale: {x: 1, y: 1} 50 | m_Offset: {x: 0, y: 0} 51 | - _OcclusionMap: 52 | m_Texture: {fileID: 0} 53 | m_Scale: {x: 1, y: 1} 54 | m_Offset: {x: 0, y: 0} 55 | - _ParallaxMap: 56 | m_Texture: {fileID: 0} 57 | m_Scale: {x: 1, y: 1} 58 | m_Offset: {x: 0, y: 0} 59 | m_Floats: 60 | - _BumpScale: 1 61 | - _Cutoff: 0.5 62 | - _DetailNormalMapScale: 1 63 | - _DstBlend: 10 64 | - _GlossMapScale: 1 65 | - _Glossiness: 0.5 66 | - _GlossyReflections: 1 67 | - _Metallic: 0 68 | - _Mode: 3 69 | - _OcclusionStrength: 1 70 | - _Parallax: 0.02 71 | - _SmoothnessTextureChannel: 0 72 | - _SpecularHighlights: 1 73 | - _SrcBlend: 1 74 | - _UVSec: 0 75 | - _ZWrite: 0 76 | m_Colors: 77 | - _Color: {r: 0.01234436, g: 1, b: 0, a: 0.29411766} 78 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 79 | -------------------------------------------------------------------------------- /Assets/Packages/JsonDotNet/Assemblies/Windows/Newtonsoft.Json.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9b6ba260dada0ea4a871a42011f8b87d 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | '': Linux 16 | second: 17 | enabled: 0 18 | settings: 19 | CPU: x86 20 | - first: 21 | '': OSXIntel 22 | second: 23 | enabled: 0 24 | settings: 25 | CPU: AnyCPU 26 | - first: 27 | '': OSXIntel64 28 | second: 29 | enabled: 0 30 | settings: 31 | CPU: AnyCPU 32 | - first: 33 | '': SamsungTV 34 | second: 35 | enabled: 0 36 | settings: 37 | STV_MODEL: STANDARD_13 38 | - first: 39 | Android: Android 40 | second: 41 | enabled: 0 42 | settings: 43 | CPU: AnyCPU 44 | - first: 45 | Any: 46 | second: 47 | enabled: 0 48 | settings: {} 49 | - first: 50 | Editor: Editor 51 | second: 52 | enabled: 0 53 | settings: 54 | CPU: AnyCPU 55 | DefaultValueInitialized: true 56 | OS: AnyOS 57 | - first: 58 | Facebook: Win 59 | second: 60 | enabled: 0 61 | settings: 62 | CPU: AnyCPU 63 | - first: 64 | Facebook: Win64 65 | second: 66 | enabled: 0 67 | settings: 68 | CPU: AnyCPU 69 | - first: 70 | Standalone: Linux64 71 | second: 72 | enabled: 0 73 | settings: 74 | CPU: AnyCPU 75 | - first: 76 | Standalone: Win 77 | second: 78 | enabled: 0 79 | settings: 80 | CPU: AnyCPU 81 | - first: 82 | Standalone: Win64 83 | second: 84 | enabled: 0 85 | settings: 86 | CPU: AnyCPU 87 | - first: 88 | Windows Store Apps: WindowsStoreApps 89 | second: 90 | enabled: 1 91 | settings: 92 | CPU: AnyCPU 93 | DontProcess: False 94 | PlaceholderPath: Assets/JsonDotNet/Assemblies/Standalone/Newtonsoft.Json.dll 95 | SDK: AnySDK 96 | ScriptingBackend: DotNet 97 | - first: 98 | iPhone: iOS 99 | second: 100 | enabled: 0 101 | settings: 102 | CompileFlags: 103 | FrameworkDependencies: 104 | userData: 105 | assetBundleName: 106 | assetBundleVariant: 107 | -------------------------------------------------------------------------------- /Assets/Resources/Materials/floor.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: floor 11 | m_Shader: {fileID: 20, guid: 0000000000000000f000000000000000, type: 0} 12 | m_ShaderKeywords: _GLOSSYREFLECTIONS_OFF _SPECULARHIGHLIGHTS_OFF 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _Cube: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailAlbedoMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailMask: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _DetailNormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _EmissionMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MainTex: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _MetallicGlossMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _OcclusionMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _ParallaxMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | m_Floats: 63 | - _BumpScale: 1 64 | - _Cutoff: 0.5 65 | - _DetailNormalMapScale: 1 66 | - _DstBlend: 0 67 | - _GlossMapScale: 1 68 | - _Glossiness: 0 69 | - _GlossyReflections: 0 70 | - _Metallic: 0 71 | - _Mode: 0 72 | - _OcclusionStrength: 1 73 | - _Parallax: 0.02 74 | - _SmoothnessTextureChannel: 0 75 | - _SpecularHighlights: 0 76 | - _SrcBlend: 1 77 | - _UVSec: 0 78 | - _ZWrite: 1 79 | m_Colors: 80 | - _Color: {r: 0.5283019, g: 0.5283019, b: 0.5283019, a: 1} 81 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 82 | - _ReflectColor: {r: 1, g: 1, b: 1, a: 0.6} 83 | -------------------------------------------------------------------------------- /Assets/Editor Default Resources/Materials/editor_floor.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: editor_floor 11 | m_Shader: {fileID: 20, guid: 0000000000000000f000000000000000, type: 0} 12 | m_ShaderKeywords: _GLOSSYREFLECTIONS_OFF _SPECULARHIGHLIGHTS_OFF 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _Cube: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailAlbedoMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailMask: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _DetailNormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _EmissionMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MainTex: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _MetallicGlossMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _OcclusionMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _ParallaxMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | m_Floats: 63 | - _BumpScale: 1 64 | - _Cutoff: 0.5 65 | - _DetailNormalMapScale: 1 66 | - _DstBlend: 0 67 | - _GlossMapScale: 1 68 | - _Glossiness: 0 69 | - _GlossyReflections: 0 70 | - _Metallic: 0 71 | - _Mode: 0 72 | - _OcclusionStrength: 1 73 | - _Parallax: 0.02 74 | - _SmoothnessTextureChannel: 0 75 | - _SpecularHighlights: 0 76 | - _SrcBlend: 1 77 | - _UVSec: 0 78 | - _ZWrite: 1 79 | m_Colors: 80 | - _Color: {r: 0.3301887, g: 0.3301887, b: 0.3301887, a: 1} 81 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 82 | - _ReflectColor: {r: 1, g: 1, b: 1, a: 0.6} 83 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main/EmitterController.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using UnityEngine; 3 | 4 | namespace Laser.Game.Main 5 | { 6 | public class EmitterController : MonoBehaviour 7 | { 8 | public AbsorberController LitAbsorber 9 | { get { return litAbsorber; } } 10 | 11 | public EmitterType Type; 12 | public LineRenderer RayLine; 13 | 14 | private Tracer tracer = new Tracer(); 15 | private Trace currentTrace; 16 | private AbsorberController litAbsorber; 17 | private int skippedFrames; 18 | 19 | private void FixedUpdate() 20 | { 21 | if (skippedFrames < 1) 22 | { 23 | skippedFrames++; 24 | return; 25 | } 26 | 27 | RefreshTrace(); 28 | RefreshLineRenderer(); 29 | skippedFrames = 0; 30 | } 31 | 32 | private void RefreshTrace() 33 | { 34 | litAbsorber = null; 35 | currentTrace = tracer.Trace(RayLine.transform.position, transform.rotation * Vector3.forward); 36 | 37 | for (int i = 0; i < currentTrace.Points.Count; ++i) 38 | { 39 | var absorber = currentTrace.Points[i].Transform?.GetComponent(); 40 | if (absorber != null) 41 | { 42 | litAbsorber = absorber; 43 | break; 44 | } 45 | } 46 | } 47 | 48 | private void RefreshLineRenderer() 49 | { 50 | if (currentTrace == null) 51 | { 52 | RayLine.SetPositions(new Vector3[0]); 53 | return; 54 | } 55 | 56 | var _positions = currentTrace.Points.Select((t) => RayLine.transform.InverseTransformPoint(t.Position)); 57 | if (!currentTrace.Closed) 58 | { 59 | var p = RayLine.transform.InverseTransformPoint(currentTrace.Points[currentTrace.Points.Count - 1].Position); 60 | var d = RayLine.transform.InverseTransformDirection(currentTrace.Points[currentTrace.Points.Count - 1].ReflectedDirection); 61 | _positions = _positions.Concat(new Vector3[1] { p + (d * 100) }); 62 | } 63 | var positions = _positions.ToArray(); 64 | var color = litAbsorber == null ? Color.red : Color.green; 65 | 66 | RayLine.positionCount = positions.Length; 67 | RayLine.SetPositions(positions); 68 | RayLine.colorGradient = new Gradient() { colorKeys = new GradientColorKey[1] { new GradientColorKey(color, 0) } }; 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Assets/Resources/Models/prism.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ca86e7d9f7cb1ce4bb12469cbecefd60 3 | ModelImporter: 4 | serializedVersion: 26 5 | internalIDToNameTable: [] 6 | externalObjects: {} 7 | materials: 8 | importMaterials: 1 9 | materialName: 0 10 | materialSearch: 1 11 | materialLocation: 1 12 | animations: 13 | legacyGenerateAnimations: 4 14 | bakeSimulation: 0 15 | resampleCurves: 1 16 | optimizeGameObjects: 0 17 | motionNodeName: 18 | rigImportErrors: 19 | rigImportWarnings: 20 | animationImportErrors: 21 | animationImportWarnings: 22 | animationRetargetingWarnings: 23 | animationDoRetargetingWarnings: 0 24 | importAnimatedCustomProperties: 0 25 | importConstraints: 0 26 | animationCompression: 1 27 | animationRotationError: 0.5 28 | animationPositionError: 0.5 29 | animationScaleError: 0.5 30 | animationWrapMode: 0 31 | extraExposedTransformPaths: [] 32 | extraUserProperties: [] 33 | clipAnimations: [] 34 | isReadable: 0 35 | meshes: 36 | lODScreenPercentages: [] 37 | globalScale: 100 38 | meshCompression: 0 39 | addColliders: 0 40 | useSRGBMaterialColor: 1 41 | sortHierarchyByName: 1 42 | importVisibility: 1 43 | importBlendShapes: 1 44 | importCameras: 1 45 | importLights: 1 46 | swapUVChannels: 0 47 | generateSecondaryUV: 0 48 | useFileUnits: 1 49 | keepQuads: 0 50 | weldVertices: 1 51 | preserveHierarchy: 0 52 | skinWeightsMode: 0 53 | maxBonesPerVertex: 4 54 | minBoneWeight: 0.001 55 | meshOptimizationFlags: -1 56 | indexFormat: 0 57 | secondaryUVAngleDistortion: 8 58 | secondaryUVAreaDistortion: 15.000001 59 | secondaryUVHardAngle: 88 60 | secondaryUVPackMargin: 4 61 | useFileScale: 1 62 | tangentSpace: 63 | normalSmoothAngle: 60 64 | normalImportMode: 0 65 | tangentImportMode: 3 66 | normalCalculationMode: 4 67 | legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0 68 | blendShapeNormalImportMode: 1 69 | normalSmoothingSource: 0 70 | referencedClips: [] 71 | importAnimation: 1 72 | copyAvatar: 0 73 | humanDescription: 74 | serializedVersion: 3 75 | human: [] 76 | skeleton: [] 77 | armTwist: 0.5 78 | foreArmTwist: 0.5 79 | upperLegTwist: 0.5 80 | legTwist: 0.5 81 | armStretch: 0.05 82 | legStretch: 0.05 83 | feetSpacing: 0 84 | globalScale: 1 85 | rootMotionBoneName: 86 | hasTranslationDoF: 0 87 | hasExtraRoot: 0 88 | skeletonHasParents: 1 89 | lastHumanDescriptionAvatarSource: {instanceID: 0} 90 | animationType: 0 91 | humanoidOversampling: 1 92 | additionalBone: 0 93 | userData: 94 | assetBundleName: 95 | assetBundleVariant: 96 | -------------------------------------------------------------------------------- /Assets/Packages/JsonDotNet/Assemblies/Standalone/Newtonsoft.Json.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 17aef65a15b471f468b5fbeb4ff0c6a1 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | '': Linux 16 | second: 17 | enabled: 1 18 | settings: 19 | CPU: x86 20 | - first: 21 | '': LinuxUniversal 22 | second: 23 | enabled: 1 24 | settings: 25 | CPU: AnyCPU 26 | - first: 27 | '': OSXIntel 28 | second: 29 | enabled: 1 30 | settings: 31 | CPU: AnyCPU 32 | - first: 33 | '': OSXIntel64 34 | second: 35 | enabled: 1 36 | settings: 37 | CPU: AnyCPU 38 | - first: 39 | '': SamsungTV 40 | second: 41 | enabled: 0 42 | settings: 43 | STV_MODEL: STANDARD_13 44 | - first: 45 | Android: Android 46 | second: 47 | enabled: 0 48 | settings: 49 | CPU: AnyCPU 50 | - first: 51 | Any: 52 | second: 53 | enabled: 0 54 | settings: {} 55 | - first: 56 | Editor: Editor 57 | second: 58 | enabled: 1 59 | settings: 60 | CPU: AnyCPU 61 | DefaultValueInitialized: true 62 | OS: AnyOS 63 | - first: 64 | Facebook: Win 65 | second: 66 | enabled: 1 67 | settings: 68 | CPU: AnyCPU 69 | - first: 70 | Facebook: Win64 71 | second: 72 | enabled: 1 73 | settings: 74 | CPU: AnyCPU 75 | - first: 76 | Standalone: Linux64 77 | second: 78 | enabled: 1 79 | settings: 80 | CPU: AnyCPU 81 | - first: 82 | Standalone: OSXUniversal 83 | second: 84 | enabled: 1 85 | settings: 86 | CPU: AnyCPU 87 | - first: 88 | Standalone: Win 89 | second: 90 | enabled: 1 91 | settings: 92 | CPU: AnyCPU 93 | - first: 94 | Standalone: Win64 95 | second: 96 | enabled: 1 97 | settings: 98 | CPU: AnyCPU 99 | - first: 100 | Windows Store Apps: WindowsStoreApps 101 | second: 102 | enabled: 0 103 | settings: 104 | CPU: AnyCPU 105 | DontProcess: False 106 | PlaceholderPath: 107 | SDK: AnySDK 108 | ScriptingBackend: Il2Cpp 109 | - first: 110 | iPhone: iOS 111 | second: 112 | enabled: 0 113 | settings: 114 | CompileFlags: 115 | FrameworkDependencies: 116 | userData: 117 | assetBundleName: 118 | assetBundleVariant: 119 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main/Tracer.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | // #define DEBUG_DRAW 3 | #endif 4 | 5 | using Laser.Game.Main.Reflector; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | 9 | namespace Laser.Game.Main 10 | { 11 | public class TraceHitPoint 12 | { 13 | public Vector3 Position; 14 | public Vector3 ReflectedDirection; 15 | public Transform Transform; 16 | } 17 | 18 | public class Trace 19 | { 20 | public List Points; 21 | public bool Closed; 22 | } 23 | 24 | public class Tracer 25 | { 26 | public int MaxRays = 100; 27 | 28 | public Trace Trace(Vector3 origin, Vector3 direction) 29 | { 30 | var points = new List(); 31 | points.Add(new TraceHitPoint() { 32 | Position = origin, 33 | ReflectedDirection = direction 34 | }); 35 | 36 | var r = 1; 37 | var p = TraceInternal(origin, direction); 38 | while (p != null && r < MaxRays) 39 | { 40 | #if DEBUG_DRAW 41 | var __prev = points[points.Count - 1]; 42 | Debug.DrawLine(__prev.Position, p.Position); 43 | #endif 44 | 45 | points.Add(p); 46 | 47 | if (p?.Transform?.GetComponent() == null) 48 | { 49 | break; 50 | } 51 | 52 | if (p?.Transform?.GetComponent() != null) 53 | { 54 | break; 55 | } 56 | 57 | p = TraceInternal(p.Position, p.ReflectedDirection); 58 | r++; 59 | } 60 | 61 | var trace = new Trace() 62 | { 63 | Points = points, 64 | Closed = p != null 65 | }; 66 | 67 | #if DEBUG_DRAW 68 | Debug.DrawRay(points[points.Count - 1].Position, points[points.Count - 1].ReflectedDirection); 69 | #endif 70 | 71 | return trace; 72 | } 73 | 74 | private static TraceHitPoint TraceInternal(Vector3 origin, Vector3 direction) 75 | { 76 | var ray = new Ray(origin, direction); 77 | if (Physics.Raycast(ray, out var hit, 1000)) 78 | { 79 | var dirn = direction.normalized; 80 | var reflection = -(2 * Vector3.Dot(hit.normal, dirn) * hit.normal - dirn); 81 | 82 | return new TraceHitPoint() 83 | { 84 | Position = hit.point, 85 | ReflectedDirection = reflection, 86 | Transform = hit.transform 87 | }; 88 | } 89 | 90 | return null; 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Assets/Packages/JsonDotNet/Assemblies/AOT/Newtonsoft.Json.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6a3c684705042f345975d924f6983e36 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | '': Linux 16 | second: 17 | enabled: 0 18 | settings: 19 | CPU: x86 20 | - first: 21 | '': OSXIntel 22 | second: 23 | enabled: 0 24 | settings: 25 | CPU: AnyCPU 26 | - first: 27 | '': OSXIntel64 28 | second: 29 | enabled: 0 30 | settings: 31 | CPU: AnyCPU 32 | - first: 33 | '': SamsungTV 34 | second: 35 | enabled: 1 36 | settings: 37 | STV_MODEL: STANDARD_13 38 | - first: 39 | '': Tizen 40 | second: 41 | enabled: 1 42 | settings: {} 43 | - first: 44 | Android: Android 45 | second: 46 | enabled: 1 47 | settings: 48 | CPU: AnyCPU 49 | - first: 50 | Any: 51 | second: 52 | enabled: 0 53 | settings: {} 54 | - first: 55 | Editor: Editor 56 | second: 57 | enabled: 0 58 | settings: 59 | CPU: AnyCPU 60 | DefaultValueInitialized: true 61 | OS: AnyOS 62 | - first: 63 | Facebook: WebGL 64 | second: 65 | enabled: 1 66 | settings: {} 67 | - first: 68 | Facebook: Win 69 | second: 70 | enabled: 0 71 | settings: 72 | CPU: AnyCPU 73 | - first: 74 | Facebook: Win64 75 | second: 76 | enabled: 0 77 | settings: 78 | CPU: AnyCPU 79 | - first: 80 | Standalone: Linux64 81 | second: 82 | enabled: 0 83 | settings: 84 | CPU: AnyCPU 85 | - first: 86 | Standalone: Win 87 | second: 88 | enabled: 0 89 | settings: 90 | CPU: AnyCPU 91 | - first: 92 | Standalone: Win64 93 | second: 94 | enabled: 0 95 | settings: 96 | CPU: AnyCPU 97 | - first: 98 | WebGL: WebGL 99 | second: 100 | enabled: 1 101 | settings: {} 102 | - first: 103 | Windows Store Apps: WindowsStoreApps 104 | second: 105 | enabled: 1 106 | settings: 107 | CPU: AnyCPU 108 | DontProcess: False 109 | PlaceholderPath: Assets/JsonDotNet/Assemblies/Standalone/Newtonsoft.Json.dll 110 | SDK: AnySDK 111 | ScriptingBackend: Il2Cpp 112 | - first: 113 | iPhone: iOS 114 | second: 115 | enabled: 1 116 | settings: 117 | CompileFlags: 118 | FrameworkDependencies: 119 | - first: 120 | tvOS: tvOS 121 | second: 122 | enabled: 1 123 | settings: {} 124 | userData: 125 | assetBundleName: 126 | assetBundleVariant: 127 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main/Grid/GridElementController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace Laser.Game.Main.Grid 5 | { 6 | [SelectionBase] 7 | [ExecuteInEditMode] 8 | public class GridElementController : MonoBehaviour 9 | { 10 | public GridTile Tile 11 | { 12 | get 13 | { 14 | return new GridTile(X, Y); 15 | } 16 | set 17 | { 18 | X = value.X; 19 | Y = value.Y; 20 | } 21 | } 22 | 23 | public bool IsDirty 24 | { 25 | get 26 | { 27 | return isDirty; 28 | } 29 | set 30 | { 31 | isDirty = value; 32 | 33 | if (isDirty && transform.parent != null) 34 | { 35 | var parentElement = transform.parent.GetComponent(); 36 | if (parentElement != null) 37 | { 38 | parentElement.IsDirty = true; 39 | } 40 | else 41 | { 42 | var parent = transform.parent.GetComponent(); 43 | if (parent != null) 44 | { 45 | parent.IsDirty = true; 46 | } 47 | } 48 | } 49 | } 50 | } 51 | 52 | public int X 53 | { 54 | get 55 | { 56 | return x; 57 | } 58 | set 59 | { 60 | if (x != value) 61 | { 62 | x = value; 63 | IsDirty = true; 64 | } 65 | } 66 | } 67 | public int Y 68 | { 69 | get 70 | { 71 | return y; 72 | } 73 | set 74 | { 75 | if (y != value) 76 | { 77 | y = value; 78 | IsDirty = true; 79 | } 80 | } 81 | } 82 | 83 | [SerializeField] 84 | private int x; 85 | [SerializeField] 86 | private int y; 87 | 88 | private bool isDirty = true; 89 | 90 | #if UNITY_EDITOR 91 | [NonSerialized] 92 | private int __x; 93 | [NonSerialized] 94 | private int __y; 95 | 96 | // support changing positions in inspector 97 | private void Update() 98 | { 99 | if (__x != x) { __x = x; IsDirty = true; } 100 | if (__y != y) { __y = y; IsDirty = true; } 101 | } 102 | #endif 103 | 104 | public void ResetDirty() 105 | { 106 | IsDirty = false; 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /Assets/Resources/Materials/droid_skin.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: droid_skin 11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 12 | m_ShaderKeywords: 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _Cube: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailAlbedoMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailMask: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _DetailNormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _EmissionMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _Illum: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _MainTex: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _MetallicGlossMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _OcclusionMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | - _ParallaxMap: 63 | m_Texture: {fileID: 0} 64 | m_Scale: {x: 1, y: 1} 65 | m_Offset: {x: 0, y: 0} 66 | - _SpecGlossMap: 67 | m_Texture: {fileID: 0} 68 | m_Scale: {x: 1, y: 1} 69 | m_Offset: {x: 0, y: 0} 70 | - _Tex: 71 | m_Texture: {fileID: 0} 72 | m_Scale: {x: 1, y: 1} 73 | m_Offset: {x: 0, y: 0} 74 | m_Floats: 75 | - _BumpScale: 1 76 | - _Cutoff: 0.5 77 | - _DetailNormalMapScale: 1 78 | - _DstBlend: 0 79 | - _Emission: 1 80 | - _Exposure: 1 81 | - _GlossMapScale: 1 82 | - _Glossiness: 0.822 83 | - _GlossyReflections: 1 84 | - _Metallic: 1 85 | - _Mode: 0 86 | - _OcclusionStrength: 1 87 | - _Parallax: 0.02 88 | - _Rotation: 0 89 | - _Shininess: 0.01 90 | - _SmoothnessTextureChannel: 0 91 | - _SpecularHighlights: 1 92 | - _SrcBlend: 1 93 | - _UVSec: 0 94 | - _ZWrite: 1 95 | m_Colors: 96 | - _Color: {r: 1, g: 1, b: 1, a: 1} 97 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 0} 98 | - _ReflectColor: {r: 1, g: 1, b: 1, a: 0.5} 99 | - _SpecColor: {r: 1, g: 1, b: 1, a: 1} 100 | - _Tint: {r: 0.5, g: 0.5, b: 0.5, a: 0.5} 101 | -------------------------------------------------------------------------------- /Assets/Source/Game/GameManager.cs: -------------------------------------------------------------------------------- 1 | using Laser.Game.Level; 2 | using Laser.Game.UI; 3 | using System; 4 | using UnityEngine; 5 | 6 | namespace Laser.Game 7 | { 8 | public enum GameState 9 | { 10 | Menu, 11 | Playing, 12 | EditorPlaying, 13 | Won 14 | } 15 | 16 | public class GameManager : MonoBehaviour 17 | { 18 | public static bool EditorMode = false; 19 | 20 | public GameState GameState 21 | { 22 | get 23 | { 24 | return gameState; 25 | } 26 | set 27 | { 28 | var prev = gameState; 29 | gameState = value; 30 | L.Debug($"Game state is set to {gameState}."); 31 | InitState(prev); 32 | } 33 | } 34 | 35 | public LevelSequence LevelSequence; 36 | public LevelController LevelController; 37 | public UIManager UIManager; 38 | 39 | private GameState gameState; 40 | 41 | private void Awake() 42 | { 43 | if (EditorMode) 44 | { 45 | GameState = GameState.EditorPlaying; 46 | } 47 | else 48 | { 49 | OpenMainMenuScreen(); 50 | } 51 | } 52 | 53 | private void Update() 54 | { 55 | UpdateState(); 56 | } 57 | 58 | public void LoadNextLevel() 59 | { 60 | if (LevelSequence.Levels.Length == 0) 61 | { 62 | throw new Exception("Level sequence contains no levels!"); 63 | } 64 | 65 | var level = App.Profile.Progression.CurrentLevel; 66 | if (LevelSequence.Levels.Length <= level) 67 | { 68 | level = LevelSequence.Levels.Length - 1; 69 | } 70 | 71 | LevelController.Load(LevelSequence.Levels[level]); 72 | GameState = GameState.Playing; 73 | } 74 | 75 | public void OpenMainMenuScreen() 76 | { 77 | if (GameState == GameState.EditorPlaying) 78 | { 79 | #if UNITY_EDITOR 80 | UnityEditor.EditorApplication.isPlaying = false; 81 | #endif 82 | return; 83 | } 84 | 85 | if (LevelController.IsLevelLoaded) 86 | { 87 | LevelController.Unload(); 88 | } 89 | 90 | UIManager.OpenScreen(ScreenType.MainMenu); 91 | GameState = GameState.Menu; 92 | } 93 | 94 | private void InitState(GameState previous) 95 | { } 96 | 97 | private void UpdateState() 98 | { 99 | switch (GameState) 100 | { 101 | case GameState.Playing: 102 | UpdatePlayingState(); 103 | break; 104 | } 105 | } 106 | 107 | private void UpdatePlayingState() 108 | { 109 | if (LevelController.State == LevelState.Won) 110 | { 111 | HandleWin(); 112 | } 113 | } 114 | 115 | private void HandleWin() 116 | { 117 | App.Profile.Progression.CurrentLevel++; 118 | App.SaveProfile(); 119 | GameState = GameState.Won; 120 | UIManager.OpenScreen(ScreenType.Win); 121 | } 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /Assets/Resources/Models/droid.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1e82d9b790eb63f419d3554362e871e8 3 | ModelImporter: 4 | serializedVersion: 26 5 | internalIDToNameTable: [] 6 | externalObjects: 7 | - first: 8 | type: UnityEngine:Material 9 | assembly: UnityEngine.CoreModule 10 | name: Material.002 11 | second: {fileID: 2100000, guid: 917a8bc6265dec641bcaf4a2cc9c3c2e, type: 2} 12 | - first: 13 | type: UnityEngine:Material 14 | assembly: UnityEngine.CoreModule 15 | name: red beam.001 16 | second: {fileID: 2100000, guid: 85b0cfff14db6064a8e985eaecf1a918, type: 2} 17 | - first: 18 | type: UnityEngine:Material 19 | assembly: UnityEngine.CoreModule 20 | name: skin.001 21 | second: {fileID: 2100000, guid: ae365738cdc352e4eb57a42d8ac781b7, type: 2} 22 | materials: 23 | importMaterials: 1 24 | materialName: 0 25 | materialSearch: 1 26 | materialLocation: 1 27 | animations: 28 | legacyGenerateAnimations: 4 29 | bakeSimulation: 0 30 | resampleCurves: 1 31 | optimizeGameObjects: 0 32 | motionNodeName: 33 | rigImportErrors: 34 | rigImportWarnings: 35 | animationImportErrors: 36 | animationImportWarnings: 37 | animationRetargetingWarnings: 38 | animationDoRetargetingWarnings: 0 39 | importAnimatedCustomProperties: 0 40 | importConstraints: 0 41 | animationCompression: 1 42 | animationRotationError: 0.5 43 | animationPositionError: 0.5 44 | animationScaleError: 0.5 45 | animationWrapMode: 0 46 | extraExposedTransformPaths: [] 47 | extraUserProperties: [] 48 | clipAnimations: [] 49 | isReadable: 0 50 | meshes: 51 | lODScreenPercentages: [] 52 | globalScale: 100 53 | meshCompression: 0 54 | addColliders: 0 55 | useSRGBMaterialColor: 1 56 | sortHierarchyByName: 1 57 | importVisibility: 1 58 | importBlendShapes: 1 59 | importCameras: 1 60 | importLights: 1 61 | swapUVChannels: 0 62 | generateSecondaryUV: 0 63 | useFileUnits: 1 64 | keepQuads: 0 65 | weldVertices: 1 66 | preserveHierarchy: 0 67 | skinWeightsMode: 0 68 | maxBonesPerVertex: 4 69 | minBoneWeight: 0.001 70 | meshOptimizationFlags: -1 71 | indexFormat: 0 72 | secondaryUVAngleDistortion: 8 73 | secondaryUVAreaDistortion: 15.000001 74 | secondaryUVHardAngle: 88 75 | secondaryUVPackMargin: 4 76 | useFileScale: 1 77 | tangentSpace: 78 | normalSmoothAngle: 60 79 | normalImportMode: 0 80 | tangentImportMode: 3 81 | normalCalculationMode: 4 82 | legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0 83 | blendShapeNormalImportMode: 1 84 | normalSmoothingSource: 0 85 | referencedClips: [] 86 | importAnimation: 1 87 | copyAvatar: 0 88 | humanDescription: 89 | serializedVersion: 3 90 | human: [] 91 | skeleton: [] 92 | armTwist: 0.5 93 | foreArmTwist: 0.5 94 | upperLegTwist: 0.5 95 | legTwist: 0.5 96 | armStretch: 0.05 97 | legStretch: 0.05 98 | feetSpacing: 0 99 | globalScale: 1 100 | rootMotionBoneName: 101 | hasTranslationDoF: 0 102 | hasExtraRoot: 0 103 | skeletonHasParents: 1 104 | lastHumanDescriptionAvatarSource: {instanceID: 0} 105 | animationType: 0 106 | humanoidOversampling: 1 107 | additionalBone: 0 108 | userData: 109 | assetBundleName: 110 | assetBundleVariant: 111 | -------------------------------------------------------------------------------- /Assets/Source/Game/Level/LevelController.Save.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | 3 | using Laser.Game.Main; 4 | using Laser.Game.Main.Grid; 5 | using System; 6 | using System.Collections.Generic; 7 | using UnityEngine; 8 | 9 | namespace Laser.Game.Level 10 | { 11 | public partial class LevelController : MonoBehaviour 12 | { 13 | public LevelData Save() 14 | { 15 | var entities = new List(); 16 | for (int i = 0; i < Grid.transform.childCount; ++i) 17 | { 18 | var child = Grid.transform.GetChild(i); 19 | if (child.TryGetComponent(out var gridElement)) 20 | { 21 | if (gridElement.transform.childCount == 0) 22 | { 23 | continue; 24 | } 25 | 26 | if (gridElement.tag == "EditorOnly") 27 | { 28 | continue; 29 | } 30 | 31 | var mainEntity = gridElement.transform.GetChild(0); 32 | if (mainEntity.gameObject.TryGetComponent(out var entity)) 33 | { 34 | var serializableEntity = new LevelEntity(); 35 | serializableEntity.IsTiled = true; 36 | serializableEntity.Type = entity.Type; 37 | serializableEntity.Tile = gridElement.Tile; 38 | serializableEntity.Orientation = entity.Orientation; 39 | 40 | if (entity.Type == EntityType.Reflector) 41 | { 42 | if (entity.TryGetComponent(out var reflector)) 43 | { 44 | serializableEntity.ReflectorType = reflector.Type; 45 | } 46 | else 47 | { 48 | throw new Exception("Entity has a reflector type, but reflector controller isn't attached to it."); 49 | } 50 | } 51 | 52 | if (entity.Type == EntityType.Absorber) 53 | { 54 | if (entity.TryGetComponent(out var absorber)) 55 | { 56 | serializableEntity.AbsorberType = absorber.Type; 57 | } 58 | else 59 | { 60 | throw new Exception("Entity has a absorber type, but absorber controller isn't attached to it."); 61 | } 62 | } 63 | 64 | if (entity.Type == EntityType.Emitter) 65 | { 66 | if (entity.TryGetComponent(out var emitter)) 67 | { 68 | serializableEntity.EmitterType = emitter.Type; 69 | } 70 | else 71 | { 72 | throw new Exception("Entity has a emitter type, but emitter controller isn't attached to it."); 73 | } 74 | } 75 | 76 | entities.Add(serializableEntity); 77 | } 78 | } 79 | } 80 | 81 | return new LevelData() 82 | { 83 | Entities = entities 84 | }; 85 | } 86 | } 87 | } 88 | 89 | #endif -------------------------------------------------------------------------------- /Assets/Source/Game/Level/LevelController.Load.cs: -------------------------------------------------------------------------------- 1 | using Laser.Game.Main; 2 | using Laser.Game.Main.Grid; 3 | using Laser.Shared; 4 | using Newtonsoft.Json; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | using UnityEngine; 10 | 11 | namespace Laser.Game.Level 12 | { 13 | public partial class LevelController : MonoBehaviour 14 | { 15 | public List Entities 16 | { get; set; } = new List(); 17 | 18 | public List Emitters 19 | { get; set; } = new List(); 20 | 21 | public GridElementController CreateGridElement(GridTile tile) 22 | { 23 | var elem = new GameObject($"GridElement", typeof(GridElementController)).GetComponent(); 24 | elem.Tile = tile; 25 | elem.transform.SetParent(Grid.transform, false); 26 | return elem; 27 | } 28 | 29 | public EmitterController SpawnEmitter(GridElementController container, EmitterType type) 30 | { 31 | var prefab = ItemsMap.Emitters.FirstOrDefault((p) => p.Type == type).Prefab; 32 | var emitter = Instantiate(prefab, container.transform, false); 33 | return emitter; 34 | } 35 | 36 | public AbsorberController SpawnAbsorber(GridElementController container, AbsorberType type) 37 | { 38 | var prefab = ItemsMap.Absorbers.FirstOrDefault((p) => p.Type == type).Prefab; 39 | var absorber = Instantiate(prefab, container.transform, false); 40 | return absorber; 41 | } 42 | 43 | public ReflectorController SpawnReflector(GridElementController container, ReflectorType type) 44 | { 45 | var prefab = ItemsMap.Reflectors.FirstOrDefault((p) => p.Type == type).Prefab; 46 | var reflector = Instantiate(prefab, container.transform, false); 47 | return reflector; 48 | } 49 | 50 | public GameObject InstantiateEntity(GridElementController container, LevelEntity entity) 51 | { 52 | switch (entity.Type) 53 | { 54 | case EntityType.Emitter: 55 | return SpawnEmitter(container, entity.EmitterType).gameObject; 56 | case EntityType.Absorber: 57 | return SpawnAbsorber(container, entity.AbsorberType).gameObject; 58 | case EntityType.Reflector: 59 | return SpawnReflector(container, entity.ReflectorType).gameObject; 60 | default: 61 | throw new Exception($"Unknown entity type {entity.Type}."); 62 | } 63 | } 64 | 65 | public LevelEntityController SpawnEntity(LevelEntity entity) 66 | { 67 | var gridElem = CreateGridElement(entity.Tile); 68 | gridElem.name = $"GridElement_{entity.Type}"; 69 | 70 | var entityController = InstantiateEntity(gridElem, entity).GetComponent(); 71 | entityController.Orientation = entity.Orientation; 72 | entityController.ApplyOrientation(true); 73 | entityController.RulesBridge = rulesBridge; 74 | return entityController; 75 | } 76 | 77 | public void Load(LevelData data) 78 | { 79 | Unload(); 80 | 81 | for (int i = 0; i < data.Entities.Count; ++i) 82 | { 83 | var entity = data.Entities[i]; 84 | if (!entity.IsTiled) 85 | { 86 | throw new NotImplementedException(); 87 | } 88 | 89 | var entityController = SpawnEntity(entity); 90 | Entities.Add(entityController); 91 | 92 | if (entityController.Type == EntityType.Emitter) 93 | { 94 | Emitters.Add(entityController.GetComponent()); 95 | } 96 | } 97 | 98 | levelLoaded = true; 99 | Grid.IsDirty = true; 100 | State = LevelState.None; 101 | } 102 | 103 | public void Load(string name) 104 | { 105 | var text = Resources.Load($"Levels/{name}"); 106 | var data = JsonConvert.DeserializeObject(text.text); 107 | 108 | Load(data); 109 | } 110 | 111 | public void Unload() 112 | { 113 | Grid.transform.DestroyChildrens(true); 114 | Entities.Clear(); 115 | Emitters.Clear(); 116 | levelLoaded = false; 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /Assets/Source/Game/Utils/CameraController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace Laser.Game.Utils 5 | { 6 | [RequireComponent(typeof(Camera))] 7 | public class CameraController : MonoBehaviour 8 | { 9 | public Plane Floor 10 | { get { return floor; } } 11 | 12 | public float MinCameraSize = 8; 13 | public float MaxCameraSize = 12; 14 | public Vector2 BoundsA; 15 | public Vector2 BoundsB; 16 | public float TouchZoomSpeed = 0.5f; 17 | [Range(0, 5)] 18 | public float Smoothness = 1f; 19 | 20 | private CameraScrollAreaController scrollArea; 21 | private new Camera camera; 22 | private Vector3 dragStartCameraPos; 23 | private Vector3 dragStartMousePos; 24 | private Plane floor = new Plane(Vector3.up, Vector3.zero); 25 | private bool dragging; 26 | private Vector3 target; 27 | private Vector3 velocity; 28 | private float targetSize; 29 | private float targetFov; 30 | private float sizeVelocity; 31 | private float fovVelocity; 32 | 33 | private CameraScrollAreaController GetScrollAreaController() 34 | { 35 | if (scrollArea == null) 36 | { 37 | scrollArea = FindObjectOfType(); 38 | } 39 | 40 | return scrollArea; 41 | } 42 | 43 | private void Awake() 44 | { 45 | camera = GetComponent(); 46 | target = transform.position; 47 | targetSize = camera.orthographicSize; 48 | targetFov = camera.fieldOfView; 49 | } 50 | 51 | private void Update() 52 | { 53 | UpdateDrag(); 54 | UpdateZoom(); 55 | 56 | target = new Vector3( 57 | Mathf.Clamp(target.x, BoundsA.x, BoundsB.x), 58 | target.y, 59 | Mathf.Clamp(target.z, BoundsA.y, BoundsB.y) 60 | ); 61 | 62 | transform.position = SmoothDamp(transform.position, target, ref velocity, 0.075f * Smoothness); 63 | camera.orthographicSize = Mathf.Clamp(Mathf.SmoothDamp(camera.orthographicSize, targetSize, ref sizeVelocity, 0.1f), MinCameraSize, MaxCameraSize); 64 | } 65 | 66 | private void FocusOnPoint(Vector3 point, bool immediately) 67 | { 68 | var dir = camera.transform.rotation * Vector3.back; 69 | var plane = new Plane(Vector3.down, camera.transform.position); 70 | if (plane.Raycast(new Ray(point, dir), out float distance)) 71 | { 72 | var pos = point + dir.normalized * distance; 73 | target = pos; 74 | 75 | if (immediately) 76 | { 77 | camera.transform.position = pos; 78 | } 79 | } 80 | } 81 | 82 | private void UpdateZoom() 83 | { 84 | var delta = 0f; 85 | 86 | if (Input.mouseScrollDelta.y != 0) 87 | { 88 | delta = Input.mouseScrollDelta.y; 89 | } 90 | 91 | if (delta != 0) 92 | { 93 | targetSize = Mathf.Clamp(targetSize - delta, MinCameraSize, MaxCameraSize); 94 | } 95 | } 96 | 97 | private void UpdateDrag() 98 | { 99 | if (Input.GetMouseButtonDown(0) && (GetScrollAreaController()?.CanScroll ?? true)) 100 | { 101 | dragStartCameraPos = transform.position; 102 | dragStartMousePos = Input.mousePosition; 103 | dragging = true; 104 | return; 105 | } 106 | 107 | if (dragging && Input.GetMouseButton(0)) 108 | { 109 | var p0 = RaycastFloor(camera.ScreenPointToRay(Input.mousePosition)); 110 | var p1 = RaycastFloor(camera.ScreenPointToRay(dragStartMousePos)); 111 | var delta = p0 - p1; 112 | target = dragStartCameraPos - new Vector3(delta.x, 0, delta.z); 113 | } 114 | 115 | if (Input.GetMouseButtonUp(0)) 116 | { 117 | dragging = false; 118 | } 119 | } 120 | 121 | private Vector3 RaycastFloor(Ray ray) 122 | { 123 | var distance = 0f; 124 | if (floor.Raycast(ray, out distance)) 125 | { 126 | return ray.GetPoint(distance); 127 | } 128 | else 129 | { 130 | return Vector3.zero; 131 | } 132 | } 133 | 134 | public static Vector3 SmoothDamp(Vector3 current, Vector3 target, ref Vector3 velocity, float time) 135 | { 136 | var x = Mathf.SmoothDamp(current.x, target.x, ref velocity.x, time); 137 | var y = Mathf.SmoothDamp(current.y, target.y, ref velocity.y, time); 138 | var z = Mathf.SmoothDamp(current.z, target.z, ref velocity.z, time); 139 | 140 | return new Vector3(x, y, z); 141 | } 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /Assets/Source/Game/Main/Grid/GridController.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using UnityEngine; 3 | 4 | namespace Laser.Game.Main.Grid 5 | { 6 | [JsonObject(MemberSerialization = MemberSerialization.OptIn)] 7 | public struct GridTile 8 | { 9 | [JsonProperty("x")] 10 | public int X; 11 | [JsonProperty("y")] 12 | public int Y; 13 | 14 | public GridTile(int x, int y) 15 | { 16 | X = x; 17 | Y = y; 18 | } 19 | } 20 | 21 | [ExecuteInEditMode] 22 | public class GridController : MonoBehaviour 23 | { 24 | public bool IsDirty 25 | { 26 | get 27 | { 28 | return isDirty; 29 | } 30 | set 31 | { 32 | if (isDirty != value) 33 | { 34 | isDirty = value; 35 | } 36 | } 37 | } 38 | 39 | public float CellSize; 40 | [Range(1, 30)] 41 | public int Width; 42 | [Range(1, 30)] 43 | public int Height; 44 | 45 | private Vector3 Origin 46 | { get { return transform.position; } } 47 | 48 | private bool isDirty; 49 | private float prevCellSize; 50 | 51 | private void Start() 52 | { 53 | Layout(); 54 | } 55 | 56 | private void Update() 57 | { 58 | if (isDirty) 59 | { 60 | Layout(); 61 | isDirty = false; 62 | } 63 | } 64 | 65 | public void Layout() 66 | { 67 | for (int i = 0; i < transform.childCount; ++i) 68 | { 69 | var element = transform.GetChild(i).GetComponent(); 70 | if (element != null) 71 | { 72 | element.transform.position = GridToWorld(GetTileCenter(new GridTile(element.X, element.Y))) + new Vector3(0, element.transform.position.y, 0); 73 | element.IsDirty = false; 74 | } 75 | } 76 | } 77 | 78 | public bool CanPlaceIn(GridElementController newElement, GridTile tile) 79 | { 80 | for (int i = 0; i < transform.childCount; ++i) 81 | { 82 | var element = transform.GetChild(i).GetComponent(); 83 | if (element != null) 84 | { 85 | if (element != newElement && element.X == tile.X && element.Y == tile.Y) 86 | { 87 | return false; 88 | } 89 | } 90 | } 91 | 92 | return true; 93 | } 94 | 95 | public Vector2? RaycastGrid(Ray ray) 96 | { 97 | var plane = new Plane(Vector3.up, Origin); 98 | if (plane.Raycast(ray, out var distance)) 99 | { 100 | var p = ray.GetPoint(distance); 101 | return WorldToGrid(p); 102 | } 103 | 104 | return null; 105 | } 106 | 107 | public GridTile? RaycastTile(Ray ray) 108 | { 109 | var gp = RaycastGrid(ray); 110 | if (gp == null) 111 | { 112 | return null; 113 | } 114 | 115 | return GetGridTile(gp.Value); 116 | } 117 | 118 | public Vector2 WorldToGrid(Vector3 worldPosition) 119 | { 120 | var local = transform.InverseTransformPoint(worldPosition); 121 | return new Vector2(local.x, local.z); 122 | } 123 | 124 | public Vector3 GridToWorld(Vector2 gridPosition) 125 | { 126 | var world = transform.TransformPoint(new Vector3(gridPosition.x, 0, gridPosition.y)); 127 | return world; 128 | } 129 | 130 | public GridTile GetGridTile(Vector2 gridPosition) 131 | { 132 | var x = (gridPosition.x / CellSize); 133 | var y = (gridPosition.y / CellSize); 134 | 135 | if (x < 0) x -= 1; 136 | if (y < 0) y -= 1; 137 | 138 | return new GridTile() { X = (int)x, Y = (int)y }; 139 | } 140 | 141 | public Vector2 GetTileCenter(GridTile tile) 142 | { 143 | var x = (tile.X * CellSize) + (CellSize / 2f); 144 | var y = (tile.Y * CellSize) + (CellSize / 2f); 145 | 146 | return new Vector2(x, y); 147 | } 148 | 149 | public Rect GetTileRect(GridTile tile) 150 | { 151 | var x0 = (tile.X * CellSize); 152 | var y0 = (tile.Y * CellSize); 153 | 154 | return new Rect(x0, y0, CellSize, CellSize); 155 | } 156 | 157 | public Vector3[] GetWorldSpacedTileRect(GridTile tile) 158 | { 159 | var rect = GetTileRect(tile); 160 | var v0 = GridToWorld(new Vector2(rect.xMin, rect.yMin)); 161 | var v1 = GridToWorld(new Vector2(rect.xMax, rect.yMin)); 162 | var v2 = GridToWorld(new Vector2(rect.xMax, rect.yMax)); 163 | var v3 = GridToWorld(new Vector2(rect.xMin, rect.yMax)); 164 | 165 | return new Vector3[4] { v0, v1, v2, v3 }; 166 | } 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /Assets/Resources/Prefabs/Absorbers/Cubic.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &5583018659133975093 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 5583018659133975092} 12 | - component: {fileID: 5583018659133975089} 13 | - component: {fileID: 5583018659133975094} 14 | - component: {fileID: 5583018659133975091} 15 | m_Layer: 0 16 | m_Name: Cube 17 | m_TagString: Untagged 18 | m_Icon: {fileID: 0} 19 | m_NavMeshLayer: 0 20 | m_StaticEditorFlags: 0 21 | m_IsActive: 1 22 | --- !u!4 &5583018659133975092 23 | Transform: 24 | m_ObjectHideFlags: 0 25 | m_CorrespondingSourceObject: {fileID: 0} 26 | m_PrefabInstance: {fileID: 0} 27 | m_PrefabAsset: {fileID: 0} 28 | m_GameObject: {fileID: 5583018659133975093} 29 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 30 | m_LocalPosition: {x: 0, y: 1.5, z: 0} 31 | m_LocalScale: {x: 3, y: 3, z: 3} 32 | m_Children: [] 33 | m_Father: {fileID: 5583018659158816650} 34 | m_RootOrder: 0 35 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 36 | --- !u!33 &5583018659133975089 37 | MeshFilter: 38 | m_ObjectHideFlags: 0 39 | m_CorrespondingSourceObject: {fileID: 0} 40 | m_PrefabInstance: {fileID: 0} 41 | m_PrefabAsset: {fileID: 0} 42 | m_GameObject: {fileID: 5583018659133975093} 43 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 44 | --- !u!23 &5583018659133975094 45 | MeshRenderer: 46 | m_ObjectHideFlags: 0 47 | m_CorrespondingSourceObject: {fileID: 0} 48 | m_PrefabInstance: {fileID: 0} 49 | m_PrefabAsset: {fileID: 0} 50 | m_GameObject: {fileID: 5583018659133975093} 51 | m_Enabled: 1 52 | m_CastShadows: 1 53 | m_ReceiveShadows: 1 54 | m_DynamicOccludee: 1 55 | m_MotionVectors: 1 56 | m_LightProbeUsage: 1 57 | m_ReflectionProbeUsage: 1 58 | m_RenderingLayerMask: 1 59 | m_RendererPriority: 0 60 | m_Materials: 61 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 62 | m_StaticBatchInfo: 63 | firstSubMesh: 0 64 | subMeshCount: 0 65 | m_StaticBatchRoot: {fileID: 0} 66 | m_ProbeAnchor: {fileID: 0} 67 | m_LightProbeVolumeOverride: {fileID: 0} 68 | m_ScaleInLightmap: 1 69 | m_ReceiveGI: 1 70 | m_PreserveUVs: 0 71 | m_IgnoreNormalsForChartDetection: 0 72 | m_ImportantGI: 0 73 | m_StitchLightmapSeams: 1 74 | m_SelectedEditorRenderState: 3 75 | m_MinimumChartSize: 4 76 | m_AutoUVMaxDistance: 0.5 77 | m_AutoUVMaxAngle: 89 78 | m_LightmapParameters: {fileID: 0} 79 | m_SortingLayerID: 0 80 | m_SortingLayer: 0 81 | m_SortingOrder: 0 82 | --- !u!65 &5583018659133975091 83 | BoxCollider: 84 | m_ObjectHideFlags: 0 85 | m_CorrespondingSourceObject: {fileID: 0} 86 | m_PrefabInstance: {fileID: 0} 87 | m_PrefabAsset: {fileID: 0} 88 | m_GameObject: {fileID: 5583018659133975093} 89 | m_Material: {fileID: 0} 90 | m_IsTrigger: 1 91 | m_Enabled: 1 92 | serializedVersion: 2 93 | m_Size: {x: 1.0000001, y: 1.0000001, z: 1.0000001} 94 | m_Center: {x: 0, y: 0.000000059604645, z: 0} 95 | --- !u!1 &5583018659158816651 96 | GameObject: 97 | m_ObjectHideFlags: 0 98 | m_CorrespondingSourceObject: {fileID: 0} 99 | m_PrefabInstance: {fileID: 0} 100 | m_PrefabAsset: {fileID: 0} 101 | serializedVersion: 6 102 | m_Component: 103 | - component: {fileID: 5583018659158816650} 104 | - component: {fileID: 2089368858} 105 | - component: {fileID: 2089368856} 106 | - component: {fileID: 2089368857} 107 | m_Layer: 0 108 | m_Name: Cubic 109 | m_TagString: Untagged 110 | m_Icon: {fileID: 0} 111 | m_NavMeshLayer: 0 112 | m_StaticEditorFlags: 0 113 | m_IsActive: 1 114 | --- !u!4 &5583018659158816650 115 | Transform: 116 | m_ObjectHideFlags: 0 117 | m_CorrespondingSourceObject: {fileID: 0} 118 | m_PrefabInstance: {fileID: 0} 119 | m_PrefabAsset: {fileID: 0} 120 | m_GameObject: {fileID: 5583018659158816651} 121 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 122 | m_LocalPosition: {x: 0, y: 0, z: 0} 123 | m_LocalScale: {x: 1, y: 1, z: 1} 124 | m_Children: 125 | - {fileID: 5583018659133975092} 126 | m_Father: {fileID: 0} 127 | m_RootOrder: 0 128 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 129 | --- !u!54 &2089368858 130 | Rigidbody: 131 | m_ObjectHideFlags: 0 132 | m_CorrespondingSourceObject: {fileID: 0} 133 | m_PrefabInstance: {fileID: 0} 134 | m_PrefabAsset: {fileID: 0} 135 | m_GameObject: {fileID: 5583018659158816651} 136 | serializedVersion: 2 137 | m_Mass: 1 138 | m_Drag: 0 139 | m_AngularDrag: 0 140 | m_UseGravity: 0 141 | m_IsKinematic: 0 142 | m_Interpolate: 0 143 | m_Constraints: 0 144 | m_CollisionDetection: 0 145 | --- !u!114 &2089368856 146 | MonoBehaviour: 147 | m_ObjectHideFlags: 0 148 | m_CorrespondingSourceObject: {fileID: 0} 149 | m_PrefabInstance: {fileID: 0} 150 | m_PrefabAsset: {fileID: 0} 151 | m_GameObject: {fileID: 5583018659158816651} 152 | m_Enabled: 1 153 | m_EditorHideFlags: 0 154 | m_Script: {fileID: 11500000, guid: 03aff2ac8f753924aa4a8a0807b354eb, type: 3} 155 | m_Name: 156 | m_EditorClassIdentifier: 157 | Type: 3 158 | --- !u!114 &2089368857 159 | MonoBehaviour: 160 | m_ObjectHideFlags: 0 161 | m_CorrespondingSourceObject: {fileID: 0} 162 | m_PrefabInstance: {fileID: 0} 163 | m_PrefabAsset: {fileID: 0} 164 | m_GameObject: {fileID: 5583018659158816651} 165 | m_Enabled: 1 166 | m_EditorHideFlags: 0 167 | m_Script: {fileID: 11500000, guid: 71ffa5e07653668418b82fcd3e74a895, type: 3} 168 | m_Name: 169 | m_EditorClassIdentifier: 170 | Type: 1 171 | -------------------------------------------------------------------------------- /Assets/Source/Editor/LevelEditor.cs: -------------------------------------------------------------------------------- 1 | using Laser.Editor.Utilities; 2 | using Laser.Game.Level; 3 | using Laser.Game.Main.Grid; 4 | using UnityEditor; 5 | using UnityEngine; 6 | 7 | namespace Laser.Editor 8 | { 9 | [CustomEditor(typeof(LevelController))] 10 | public class LevelEditor : UnityEditor.Editor 11 | { 12 | private GridElementController entityToSpawnGridElementContainer; 13 | private int placeControlId; 14 | 15 | private void OnEnable() 16 | { 17 | Selection.selectionChanged += SelectionChanged; 18 | } 19 | 20 | private void OnDisable() 21 | { 22 | Selection.selectionChanged -= SelectionChanged; 23 | } 24 | 25 | public override void OnInspectorGUI() 26 | { 27 | base.OnInspectorGUI(); 28 | 29 | if (GUILayout.Button("Open Editor")) 30 | { 31 | LevelEditorWindow.Open(); 32 | } 33 | 34 | var _target = ((LevelController)target); 35 | GUILayout.Label(_target.IsLevelLoaded ? "Level is loaded" : "Level isn't loaded"); 36 | } 37 | 38 | private void OnSceneGUI() 39 | { 40 | RenderEntityPreview(); 41 | } 42 | 43 | private void RenderEntityPreview() 44 | { 45 | var level = ((LevelController)target); 46 | placeControlId = EditorGUIUtility.GetControlID(FocusType.Keyboard); 47 | 48 | if (level.EntityToSpawn != null && entityToSpawnGridElementContainer == null) 49 | { 50 | var grid = level.GetComponent(); 51 | var ray = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition); 52 | var tile = grid.RaycastTile(ray); 53 | 54 | if (tile == null) 55 | { 56 | tile = new GridTile(0, 0); 57 | } 58 | 59 | entityToSpawnGridElementContainer = level.CreateGridElement(tile.Value); 60 | entityToSpawnGridElementContainer.tag = "EditorOnly"; 61 | entityToSpawnGridElementContainer.name = $"Temporal_{entityToSpawnGridElementContainer.name}"; 62 | 63 | level.InstantiateEntity(entityToSpawnGridElementContainer, level.EntityToSpawn); 64 | EditorUtilities.ApplyMaterialRecursively(entityToSpawnGridElementContainer.gameObject, (Material)EditorGUIUtility.Load("Materials/temp_grid_item.mat")); 65 | 66 | GUIUtility.hotControl = placeControlId; 67 | } 68 | 69 | if (entityToSpawnGridElementContainer != null && GUIUtility.hotControl == placeControlId) 70 | { 71 | var grid = level.GetComponent(); 72 | var ray = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition); 73 | var tile = grid.RaycastTile(ray); 74 | var isSuitableTile = tile == null ? false : grid.CanPlaceIn(entityToSpawnGridElementContainer, tile.Value); 75 | 76 | if (Event.current.type == EventType.MouseMove) 77 | { 78 | if (tile != null && isSuitableTile) 79 | { 80 | entityToSpawnGridElementContainer.Tile = tile.Value; 81 | level.EntityToSpawn.Tile = tile.Value; 82 | grid.Layout(); 83 | } 84 | 85 | Event.current.Use(); 86 | } 87 | else if (Event.current.type == EventType.Repaint || Event.current.type == EventType.Layout) 88 | { 89 | if (tile != null) 90 | { 91 | var rectColor = isSuitableTile ? new Color(0, 1, 0, 0.1f) : new Color(1, 0, 0, 0.3f); 92 | var outlineColor = isSuitableTile ? new Color(0, 1, 0, 0.5f) : new Color(1, 0, 0, 0.7f); 93 | var rect = grid.GetWorldSpacedTileRect(tile.Value); 94 | Handles.DrawSolidRectangleWithOutline(rect, rectColor, outlineColor); 95 | } 96 | } 97 | else if (Event.current.type == EventType.KeyDown) 98 | { 99 | if (Event.current.keyCode == KeyCode.Delete || Event.current.keyCode == KeyCode.Escape) 100 | { 101 | ResetEntityToSpawn(); 102 | Event.current.Use(); 103 | } 104 | } 105 | } 106 | 107 | if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && level.EntityToSpawn != null) 108 | { 109 | level.SpawnEntity(level.EntityToSpawn); 110 | ResetEntityToSpawn(); 111 | Event.current.Use(); 112 | } 113 | } 114 | 115 | private void SelectionChanged() 116 | { 117 | if (target == null) 118 | { 119 | return; 120 | } 121 | 122 | var _target = target as LevelController; 123 | if (Selection.activeGameObject != _target.gameObject && _target.EntityToSpawn != null) 124 | { 125 | ResetEntityToSpawn(); 126 | } 127 | } 128 | 129 | private void ResetEntityToSpawn() 130 | { 131 | if (placeControlId == GUIUtility.hotControl) 132 | { 133 | GUIUtility.hotControl = 0; 134 | } 135 | 136 | var levelController = ((LevelController)target); 137 | levelController.EntityToSpawn = null; 138 | 139 | if (entityToSpawnGridElementContainer != null) 140 | { 141 | DestroyImmediate(entityToSpawnGridElementContainer.gameObject); 142 | entityToSpawnGridElementContainer = null; 143 | } 144 | } 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /Assets/Source/App.ProfileManager.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.IO; 4 | 5 | namespace Laser 6 | { 7 | public static partial class App 8 | { 9 | public static event Action ProfileLoaded; 10 | public static event Action ProfileUnloaded; 11 | 12 | public static Profile Profile 13 | { get; private set; } 14 | 15 | private static string currentProfileName; 16 | 17 | private static object opLock = new object(); 18 | 19 | public static void UnloadProfile() 20 | { 21 | currentProfileName = null; 22 | Profile = null; 23 | ProfileUnloaded?.Invoke(); 24 | } 25 | 26 | public static void LoadProfile(Profile profile, string name) 27 | { 28 | if (profile == null) 29 | { 30 | throw new ArgumentNullException(nameof(profile)); 31 | } 32 | 33 | if (String.IsNullOrEmpty(name)) 34 | { 35 | throw new ArgumentException($"Invalid profile name: {name}", nameof(name)); 36 | } 37 | 38 | lock (opLock) 39 | { 40 | Profile = profile; 41 | currentProfileName = name; 42 | } 43 | 44 | ProfileLoaded?.Invoke(); 45 | } 46 | 47 | public static void LoadProfile(string name) 48 | { 49 | var path = Path.Combine(GetProfilesDirectory(), name); 50 | var backupPath = $"{path}.backup"; 51 | if (!File.Exists(path) && !File.Exists(backupPath)) 52 | { 53 | throw new FileNotFoundException($"Couldn't find profile at {path}.", path); 54 | } 55 | 56 | Profile loadedProfile = null; 57 | try 58 | { 59 | loadedProfile = DeserializeProfile(path); 60 | } 61 | catch (Exception e0) 62 | { 63 | if (File.Exists(backupPath)) 64 | { 65 | L.Warn($"Trying to load backup after failed to load profile {name}"); 66 | 67 | try 68 | { 69 | if (File.Exists(backupPath)) 70 | { 71 | loadedProfile = DeserializeProfile(backupPath); 72 | } 73 | } 74 | catch (Exception e1) 75 | { 76 | throw new GameException(3, e1, "Failed to deserialize profile and its backup."); 77 | } 78 | } 79 | else 80 | { 81 | throw new GameException(2, e0, "Failed to deserialize profile."); 82 | } 83 | } 84 | 85 | 86 | lock (opLock) 87 | { 88 | Profile = loadedProfile; 89 | currentProfileName = name; 90 | } 91 | 92 | ProfileLoaded?.Invoke(); 93 | } 94 | 95 | public static void SaveProfile() 96 | { 97 | lock (opLock) 98 | { 99 | if (Profile == null) 100 | { 101 | throw new InvalidOperationException("Profile not set."); 102 | } 103 | 104 | if (currentProfileName == null) 105 | { 106 | throw new InvalidOperationException("Profile name not set."); 107 | } 108 | 109 | Profile.SaveTime = GlobalTime.Current; 110 | 111 | var directory = GetProfilesDirectory(); 112 | var path = Path.Combine(directory, currentProfileName); 113 | var newFilePath = $"{path}.new"; 114 | var backupPath = $"{path}.backup"; 115 | 116 | Directory.CreateDirectory(directory); 117 | if (File.Exists(newFilePath)) 118 | { 119 | File.Delete(newFilePath); 120 | } 121 | 122 | try 123 | { 124 | using (var stream = new FileStream(newFilePath, FileMode.Create, FileAccess.Write, FileShare.None)) 125 | using (var writer = new StreamWriter(stream)) 126 | using (var jsonWriter = new JsonTextWriter(writer)) 127 | { 128 | var settings = new JsonSerializerSettings() 129 | { 130 | TypeNameHandling = TypeNameHandling.Auto 131 | }; 132 | 133 | JsonSerializer.Create(settings).Serialize(jsonWriter, Profile); 134 | } 135 | } 136 | catch (Exception e) 137 | { 138 | throw new GameException(0, e, "Failed to serialize profile."); 139 | } 140 | 141 | // TODO: Check if everything is alright with just saved profile 142 | 143 | if (File.Exists(path)) 144 | { 145 | try 146 | { 147 | if (File.Exists(backupPath)) 148 | { 149 | File.Delete(backupPath); 150 | } 151 | 152 | File.Move(path, backupPath); 153 | } 154 | catch (Exception e) 155 | { 156 | throw new GameException(1, e, "Failed to create profile backup."); 157 | } 158 | } 159 | 160 | File.Move(newFilePath, path); 161 | } 162 | } 163 | 164 | private static Profile DeserializeProfile(string path) 165 | { 166 | using (var stream = File.OpenRead(path)) 167 | using (var reader = new StreamReader(stream)) 168 | using (var jsonReader = new JsonTextReader(reader)) 169 | { 170 | var settings = new JsonSerializerSettings() 171 | { 172 | TypeNameHandling = TypeNameHandling.Auto 173 | }; 174 | 175 | return JsonSerializer.Create(settings).Deserialize(jsonReader); 176 | } 177 | } 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | streamingMipmapsActive: 0 33 | streamingMipmapsAddAllCameras: 1 34 | streamingMipmapsMemoryBudget: 512 35 | streamingMipmapsRenderersPerFrame: 512 36 | streamingMipmapsMaxLevelReduction: 2 37 | streamingMipmapsMaxFileIORequests: 1024 38 | particleRaycastBudget: 4 39 | asyncUploadTimeSlice: 2 40 | asyncUploadBufferSize: 16 41 | asyncUploadPersistentBuffer: 1 42 | resolutionScalingFixedDPIFactor: 1 43 | excludedTargetPlatforms: [] 44 | - serializedVersion: 2 45 | name: Low 46 | pixelLightCount: 0 47 | shadows: 0 48 | shadowResolution: 0 49 | shadowProjection: 1 50 | shadowCascades: 1 51 | shadowDistance: 20 52 | shadowNearPlaneOffset: 3 53 | shadowCascade2Split: 0.33333334 54 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 55 | shadowmaskMode: 0 56 | blendWeights: 2 57 | textureQuality: 0 58 | anisotropicTextures: 0 59 | antiAliasing: 0 60 | softParticles: 0 61 | softVegetation: 0 62 | realtimeReflectionProbes: 0 63 | billboardsFaceCameraPosition: 0 64 | vSyncCount: 0 65 | lodBias: 0.4 66 | maximumLODLevel: 0 67 | streamingMipmapsActive: 0 68 | streamingMipmapsAddAllCameras: 1 69 | streamingMipmapsMemoryBudget: 512 70 | streamingMipmapsRenderersPerFrame: 512 71 | streamingMipmapsMaxLevelReduction: 2 72 | streamingMipmapsMaxFileIORequests: 1024 73 | particleRaycastBudget: 16 74 | asyncUploadTimeSlice: 2 75 | asyncUploadBufferSize: 16 76 | asyncUploadPersistentBuffer: 1 77 | resolutionScalingFixedDPIFactor: 1 78 | excludedTargetPlatforms: [] 79 | - serializedVersion: 2 80 | name: Medium 81 | pixelLightCount: 1 82 | shadows: 1 83 | shadowResolution: 0 84 | shadowProjection: 1 85 | shadowCascades: 1 86 | shadowDistance: 20 87 | shadowNearPlaneOffset: 3 88 | shadowCascade2Split: 0.33333334 89 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 90 | shadowmaskMode: 0 91 | blendWeights: 2 92 | textureQuality: 0 93 | anisotropicTextures: 1 94 | antiAliasing: 0 95 | softParticles: 0 96 | softVegetation: 0 97 | realtimeReflectionProbes: 0 98 | billboardsFaceCameraPosition: 0 99 | vSyncCount: 1 100 | lodBias: 0.7 101 | maximumLODLevel: 0 102 | streamingMipmapsActive: 0 103 | streamingMipmapsAddAllCameras: 1 104 | streamingMipmapsMemoryBudget: 512 105 | streamingMipmapsRenderersPerFrame: 512 106 | streamingMipmapsMaxLevelReduction: 2 107 | streamingMipmapsMaxFileIORequests: 1024 108 | particleRaycastBudget: 64 109 | asyncUploadTimeSlice: 2 110 | asyncUploadBufferSize: 16 111 | asyncUploadPersistentBuffer: 1 112 | resolutionScalingFixedDPIFactor: 1 113 | excludedTargetPlatforms: [] 114 | - serializedVersion: 2 115 | name: High 116 | pixelLightCount: 2 117 | shadows: 2 118 | shadowResolution: 1 119 | shadowProjection: 1 120 | shadowCascades: 2 121 | shadowDistance: 40 122 | shadowNearPlaneOffset: 3 123 | shadowCascade2Split: 0.33333334 124 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 125 | shadowmaskMode: 1 126 | blendWeights: 2 127 | textureQuality: 0 128 | anisotropicTextures: 1 129 | antiAliasing: 0 130 | softParticles: 0 131 | softVegetation: 1 132 | realtimeReflectionProbes: 1 133 | billboardsFaceCameraPosition: 1 134 | vSyncCount: 1 135 | lodBias: 1 136 | maximumLODLevel: 0 137 | streamingMipmapsActive: 0 138 | streamingMipmapsAddAllCameras: 1 139 | streamingMipmapsMemoryBudget: 512 140 | streamingMipmapsRenderersPerFrame: 512 141 | streamingMipmapsMaxLevelReduction: 2 142 | streamingMipmapsMaxFileIORequests: 1024 143 | particleRaycastBudget: 256 144 | asyncUploadTimeSlice: 2 145 | asyncUploadBufferSize: 16 146 | asyncUploadPersistentBuffer: 1 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Very High 151 | pixelLightCount: 3 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 2 156 | shadowDistance: 70 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 2 164 | antiAliasing: 2 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 1.5 171 | maximumLODLevel: 0 172 | streamingMipmapsActive: 0 173 | streamingMipmapsAddAllCameras: 1 174 | streamingMipmapsMemoryBudget: 512 175 | streamingMipmapsRenderersPerFrame: 512 176 | streamingMipmapsMaxLevelReduction: 2 177 | streamingMipmapsMaxFileIORequests: 1024 178 | particleRaycastBudget: 1024 179 | asyncUploadTimeSlice: 2 180 | asyncUploadBufferSize: 16 181 | asyncUploadPersistentBuffer: 1 182 | resolutionScalingFixedDPIFactor: 1 183 | excludedTargetPlatforms: [] 184 | - serializedVersion: 2 185 | name: Ultra 186 | pixelLightCount: 4 187 | shadows: 2 188 | shadowResolution: 2 189 | shadowProjection: 1 190 | shadowCascades: 4 191 | shadowDistance: 150 192 | shadowNearPlaneOffset: 3 193 | shadowCascade2Split: 0.33333334 194 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 195 | shadowmaskMode: 1 196 | blendWeights: 4 197 | textureQuality: 0 198 | anisotropicTextures: 2 199 | antiAliasing: 2 200 | softParticles: 1 201 | softVegetation: 1 202 | realtimeReflectionProbes: 1 203 | billboardsFaceCameraPosition: 1 204 | vSyncCount: 1 205 | lodBias: 2 206 | maximumLODLevel: 0 207 | streamingMipmapsActive: 0 208 | streamingMipmapsAddAllCameras: 1 209 | streamingMipmapsMemoryBudget: 512 210 | streamingMipmapsRenderersPerFrame: 512 211 | streamingMipmapsMaxLevelReduction: 2 212 | streamingMipmapsMaxFileIORequests: 1024 213 | particleRaycastBudget: 4096 214 | asyncUploadTimeSlice: 2 215 | asyncUploadBufferSize: 16 216 | asyncUploadPersistentBuffer: 1 217 | resolutionScalingFixedDPIFactor: 1 218 | excludedTargetPlatforms: [] 219 | m_PerPlatformDefaultQuality: 220 | Android: 2 221 | Lumin: 5 222 | Nintendo 3DS: 5 223 | Nintendo Switch: 5 224 | PS4: 5 225 | PSP2: 2 226 | Standalone: 5 227 | WebGL: 3 228 | Windows Store Apps: 5 229 | XboxOne: 5 230 | iPhone: 2 231 | tvOS: 2 232 | -------------------------------------------------------------------------------- /Assets/Source/Editor/GridElementEditor.cs: -------------------------------------------------------------------------------- 1 | using Laser.Game.Main; 2 | using Laser.Game.Main.Grid; 3 | using System; 4 | using System.Collections.Generic; 5 | using UnityEditor; 6 | using UnityEngine; 7 | 8 | namespace Laser.Editor 9 | { 10 | [CustomEditor(typeof(GridElementController))] 11 | public class GridElementEditor : UnityEditor.Editor 12 | { 13 | [DrawGizmo(GizmoType.NonSelected | GizmoType.Pickable)] 14 | private static void DrawGizmos(GridElementController target, GizmoType gizmoType) 15 | { 16 | // Only for convenient grid tile selection 17 | 18 | var grid = target.GetComponentInParent(); 19 | if (grid == null) 20 | { 21 | return; 22 | } 23 | 24 | var gridPos = grid.WorldToGrid(target.transform.position); 25 | var rect = grid.GetTileRect(grid.GetGridTile(gridPos)); 26 | var a = grid.GridToWorld(new Vector2(rect.xMin, rect.yMin)); 27 | var b = grid.GridToWorld(new Vector2(rect.xMax, rect.yMax)); 28 | var p = grid.GridToWorld(rect.center) + new Vector3(0, 0, 0); 29 | var s = new Vector3(b.x - a.x, 0, b.z - a.z); 30 | 31 | Gizmos.color = new Color(0, 0, 0, 0); 32 | Gizmos.DrawCube(p, s); 33 | } 34 | 35 | private void OnEnable() 36 | { 37 | Tools.hidden = true; 38 | Undo.undoRedoPerformed += UndoCallback; 39 | } 40 | 41 | private void OnDisable() 42 | { 43 | Tools.hidden = false; 44 | Undo.undoRedoPerformed -= UndoCallback; 45 | } 46 | 47 | private void UndoCallback() 48 | { 49 | if (target == null) 50 | { 51 | return; 52 | } 53 | var elem = target as GridElementController; 54 | var entity = elem.GetComponentInChildren(); 55 | if (entity != null) 56 | { 57 | entity.ApplyOrientation(true); 58 | } 59 | } 60 | 61 | public GridTile targetTile; 62 | public bool isSuitableTile = true; 63 | private Vector2 dragStartPosition; 64 | private float currentRotation; 65 | 66 | private void OnSceneGUI() 67 | { 68 | var elem = target as GridElementController; 69 | var entity = elem.GetComponentInChildren(); 70 | if (entity != null) 71 | { 72 | LevelEntityEditor.RotationHandle(entity, ref dragStartPosition, ref currentRotation, new Color(0, 1, 0), new Color(1, 1, 0), 7); 73 | } 74 | 75 | MovingHandle(elem); 76 | } 77 | 78 | private void MovingHandle(GridElementController elem) 79 | { 80 | var grid = elem.GetComponentInParent(); 81 | if (grid == null) 82 | { 83 | return; 84 | } 85 | 86 | var id = GUIUtility.GetControlID(FocusType.Passive); 87 | 88 | switch (Event.current.type) 89 | { 90 | case EventType.Layout: 91 | case EventType.Repaint: 92 | var gridPos = grid.WorldToGrid(elem.transform.position); 93 | if (GUIUtility.hotControl == id) 94 | { 95 | var ray = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition); 96 | gridPos = grid.RaycastGrid(ray) ?? gridPos; 97 | } 98 | 99 | var isMoving = GUIUtility.hotControl == id; 100 | var tile = grid.GetGridTile(gridPos); 101 | var tileRect = grid.GetWorldSpacedTileRect(tile); 102 | var rectColor = isSuitableTile ? new Color(0, 1, 0, 0.1f) : new Color(1, 0, 0, 0.3f); 103 | var outlineColor = isSuitableTile ? new Color(0, 1, 0, 0.5f) : new Color(1, 0, 0, 0.7f); 104 | var innerRectColor = isSuitableTile ? (isMoving ? new Color(1, 1, 0, 0.1f) : rectColor) : new Color(1, 0, 0, 0.3f); 105 | var innerRectOutlineColor = isSuitableTile ? (isMoving ? new Color(1, 1, 0, 0.5f) : outlineColor) : new Color(1, 0, 0, 0.7f); 106 | var handlePos = grid.GridToWorld(gridPos); 107 | var size = 4; 108 | var innerRectSize = size * 0.5f; 109 | 110 | Handles.DrawSolidRectangleWithOutline(tileRect, rectColor, outlineColor); 111 | 112 | Handles.color = new Color(1, 1, 1, 1); 113 | Handles.color = innerRectColor; 114 | Handles.DrawSolidDisc(grid.GridToWorld(gridPos), Vector3.up, innerRectSize); 115 | Handles.color = innerRectOutlineColor; 116 | Handles.CircleHandleCap(id, grid.GridToWorld(gridPos), Quaternion.Euler(90, 0, 0), innerRectSize, Event.current.type); 117 | // Handles.DrawSolidRectangleWithOutline(CreateTileRect(handlePos, innerRectSize), innerRectColor, innerRectOutlineColor); 118 | Handles.color = innerRectOutlineColor; 119 | Handles.ArrowHandleCap(id, handlePos + Vector3.forward * innerRectSize, Quaternion.identity, size, Event.current.type); 120 | Handles.ArrowHandleCap(id, handlePos + Vector3.right * innerRectSize, Quaternion.Euler(0, 90, 0), size, Event.current.type); 121 | Handles.ArrowHandleCap(id, handlePos + Vector3.back * innerRectSize, Quaternion.Euler(0, 180, 0), size, Event.current.type); 122 | Handles.ArrowHandleCap(id, handlePos + Vector3.left * innerRectSize, Quaternion.Euler(0, 270, 0), size, Event.current.type); 123 | break; 124 | case EventType.MouseDown: 125 | if (HandleUtility.nearestControl == id && Event.current.button == 0) 126 | { 127 | GUIUtility.hotControl = id; 128 | RefreshTargetTile(grid, elem); 129 | Event.current.Use(); 130 | } 131 | break; 132 | case EventType.MouseUp: 133 | if (GUIUtility.hotControl == id) 134 | { 135 | GUIUtility.hotControl = 0; 136 | RefreshTargetTile(grid, elem, grid.WorldToGrid(elem.transform.position)); 137 | Event.current.Use(); 138 | } 139 | break; 140 | case EventType.MouseDrag: 141 | if (GUIUtility.hotControl == id) 142 | { 143 | RefreshTargetTile(grid, elem); 144 | 145 | if (isSuitableTile) 146 | { 147 | elem.X = targetTile.X; 148 | elem.Y = targetTile.Y; 149 | grid.Layout(); 150 | } 151 | 152 | Event.current.Use(); 153 | } 154 | break; 155 | } 156 | } 157 | 158 | private void RefreshTargetTile(GridController grid, GridElementController elem, Vector2? gridPosition = null) 159 | { 160 | var ray = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition); 161 | gridPosition = gridPosition ?? grid.RaycastGrid(ray); 162 | 163 | targetTile = gridPosition == null ? new GridTile(0, 0) : grid.GetGridTile(gridPosition.Value); 164 | isSuitableTile = grid.CanPlaceIn(elem, targetTile); 165 | } 166 | 167 | private Vector3[] CreateTileRect(Vector3 center, float size) 168 | { 169 | var v0 = new Vector3(center.x - size, 0, center.z - size); 170 | var v1 = new Vector3(center.x + size, 0, center.z - size); 171 | var v2 = new Vector3(center.x + size, 0, center.z + size); 172 | var v3 = new Vector3(center.x - size, 0, center.z + size); 173 | 174 | return new Vector3[4] { v0, v1, v2, v3 }; 175 | } 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /Assets/Source/Editor/LevelEntityEditor.cs: -------------------------------------------------------------------------------- 1 | using Laser.Game.Main; 2 | using System; 3 | using System.Collections.Generic; 4 | using UnityEditor; 5 | using UnityEngine; 6 | 7 | namespace Laser.Editor 8 | { 9 | [CustomEditor(typeof(LevelEntityController))] 10 | public class LevelEntityEditor : UnityEditor.Editor 11 | { 12 | public static List<(EntityOrientation orientation, float angle)> Orientations 13 | { 14 | get 15 | { 16 | if (orientations == null) 17 | { 18 | orientations = new List<(EntityOrientation, float)>(); 19 | foreach (EntityOrientation value in Enum.GetValues(typeof(EntityOrientation))) 20 | { 21 | orientations.Add((value, value.ToRotationAngle())); 22 | } 23 | } 24 | 25 | return orientations; 26 | } 27 | } 28 | 29 | private static List<(EntityOrientation orientation, float angle)> orientations; 30 | 31 | public static void RotationHandle(LevelEntityController entity, ref Vector2 dragStartPosition, ref float currentRotation, Color? baseInactiveColor = null, Color? baseActiveColor = null, int? fixedSize = null) 32 | { 33 | var id = GUIUtility.GetControlID(FocusType.Passive); 34 | baseInactiveColor = baseInactiveColor ?? new Color(0.6f, 1, 0.2f); 35 | baseActiveColor = baseActiveColor ?? new Color(1, 1, 0); 36 | 37 | switch (Event.current.type) 38 | { 39 | case EventType.Repaint: 40 | case EventType.Layout: 41 | var size = fixedSize == null ? HandleUtility.GetHandleSize(entity.transform.position) : fixedSize.Value; 42 | var radius = 1.5f * size; 43 | var isRotating = GUIUtility.hotControl == id; 44 | var fillColor = isRotating ? new Color(1, 1, 1, 0.1f) * baseActiveColor.Value : new Color(1, 1, 1, 0.05f) * baseInactiveColor.Value; 45 | var outlineColor = isRotating ? new Color(1, 1, 1, 0.7f) * baseActiveColor.Value : baseInactiveColor.Value; 46 | var nearestOrientation = NearestOrientation(Orientations, entity.transform.rotation.eulerAngles.y); 47 | 48 | Handles.color = outlineColor; 49 | Handles.CircleHandleCap(id, entity.transform.position, entity.transform.rotation * Quaternion.Euler(90, 0, 0), radius, Event.current.type); 50 | 51 | var currentRotationArcFromPoint = GetCircumferencePoint(entity.Orientation.ToRotationAngle(), size); 52 | var currentRotationArcToPoint = GetCircumferencePoint(entity.Orientation.ToRotationAngle() + currentRotation, radius); 53 | 54 | Handles.color = fillColor; 55 | Handles.DrawSolidArc(entity.transform.position, Vector3.up, currentRotationArcFromPoint, currentRotation, radius); 56 | 57 | if (isRotating) 58 | { 59 | Handles.color = outlineColor; 60 | Handles.DrawLine(entity.transform.position, entity.transform.position + currentRotationArcFromPoint); 61 | Handles.DrawLine(entity.transform.position, entity.transform.position + currentRotationArcToPoint); 62 | } 63 | 64 | for (int i = 0; i < Orientations.Count; ++i) 65 | { 66 | var orientationSnapPoint = GetCircumferencePoint(Orientations[i].angle, radius); 67 | Handles.color = outlineColor; 68 | Handles.CubeHandleCap(id, entity.transform.position + orientationSnapPoint, Quaternion.identity, 0.04f * size, Event.current.type); 69 | 70 | if (Orientations[i].orientation == nearestOrientation) 71 | { 72 | var targetRotationArcToPoint = GetCircumferencePoint(nearestOrientation.ToRotationAngle(), radius); 73 | Handles.DrawDottedLine(entity.transform.position, entity.transform.position + targetRotationArcToPoint, radius / 5); 74 | } 75 | } 76 | 77 | break; 78 | case EventType.MouseDown: 79 | if (HandleUtility.nearestControl == id && Event.current.button == 0) 80 | { 81 | dragStartPosition = Event.current.mousePosition; 82 | Undo.RegisterCompleteObjectUndo(entity, "Rotating"); 83 | GUIUtility.hotControl = id; 84 | Event.current.Use(); 85 | } 86 | break; 87 | case EventType.MouseLeaveWindow: 88 | case EventType.MouseUp: 89 | if (Event.current.type == EventType.MouseLeaveWindow || GUIUtility.hotControl == id) 90 | { 91 | entity.Orientation = NearestOrientation(Orientations, entity.transform.rotation.eulerAngles.y); 92 | entity.ApplyOrientation(true); 93 | currentRotation = 0; 94 | GUIUtility.hotControl = 0; 95 | Event.current.Use(); 96 | } 97 | break; 98 | case EventType.MouseDrag: 99 | if (GUIUtility.hotControl == id && Event.current.button == 0) 100 | { 101 | var deltax = (Event.current.mousePosition - dragStartPosition).x; 102 | var deltay = (Event.current.mousePosition - dragStartPosition).y; 103 | 104 | currentRotation = -deltax / 2; 105 | var angle = entity.Orientation.ToRotationAngle() + currentRotation; 106 | 107 | if (angle < 0) 108 | { 109 | angle = 360 - (Mathf.Abs(angle) % 360); 110 | } 111 | else 112 | { 113 | angle = angle % 360; 114 | } 115 | 116 | var snapAngle = NearestOrientation(Orientations, angle).ToRotationAngle(); 117 | var rotation = Quaternion.Euler(0, snapAngle, 0); 118 | entity.transform.rotation = rotation; 119 | Event.current.Use(); 120 | } 121 | break; 122 | } 123 | } 124 | 125 | public static EntityOrientation NearestOrientation(List<(EntityOrientation orientation, float angle)> orientations, float angle) 126 | { 127 | var minDist = float.MaxValue; 128 | var o = EntityOrientation.N; 129 | 130 | for (int i = 0; i < orientations.Count; ++i) 131 | { 132 | var dist = Mathf.Abs(angle - orientations[i].angle); 133 | if (dist < minDist) 134 | { 135 | minDist = dist; 136 | o = orientations[i].orientation; 137 | } 138 | } 139 | 140 | return o; 141 | } 142 | 143 | public static Vector3 GetCircumferencePoint(float angle, float radius) 144 | { 145 | angle = Mathf.Deg2Rad * angle; 146 | var point = new Vector3((Vector3.forward.x * Mathf.Cos(-angle) - Vector3.forward.z * Mathf.Sin(-angle)), 0, (Vector3.forward.z * Mathf.Cos(-angle) + Vector3.forward.x * Mathf.Sin(-angle))); 147 | return point.normalized * radius; 148 | } 149 | 150 | private Vector2 dragStartPosition; 151 | private float currentRotation; 152 | 153 | private void OnEnable() 154 | { 155 | Undo.undoRedoPerformed += UndoCallback; 156 | } 157 | 158 | private void UndoCallback() 159 | { 160 | if (target == null) 161 | { 162 | return; 163 | } 164 | 165 | var entity = (LevelEntityController)target; 166 | entity.ApplyOrientation(true); 167 | } 168 | 169 | private void OnDisable() 170 | { 171 | Undo.undoRedoPerformed -= UndoCallback; 172 | } 173 | 174 | private void OnSceneGUI() 175 | { 176 | var entity = (LevelEntityController)target; 177 | RotationHandle(entity, ref dragStartPosition, ref currentRotation); 178 | } 179 | } 180 | } 181 | --------------------------------------------------------------------------------