-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7645c56
commit 04277e1
Showing
10 changed files
with
297 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using UnityEngine; | ||
|
||
namespace InventorySystem.Tools | ||
{ | ||
/// <summary> | ||
/// Persistent singleton. | ||
/// </summary> | ||
public class PersistentSingleton<T> : MonoBehaviour where T : Component | ||
{ | ||
protected static T _instance; | ||
protected bool _enabled; | ||
|
||
/// <summary> | ||
/// Singleton design pattern | ||
/// </summary> | ||
/// <value>The instance.</value> | ||
public static T Instance | ||
{ | ||
get | ||
{ | ||
if (_instance == null) | ||
{ | ||
_instance = FindObjectOfType<T>(); | ||
if (_instance == null) | ||
{ | ||
GameObject obj = new GameObject(); | ||
_instance = obj.AddComponent<T>(); | ||
} | ||
} | ||
return _instance; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// On awake, we check if there's already a copy of the object in the scene. If there's one, we destroy it. | ||
/// </summary> | ||
protected virtual void Awake() | ||
{ | ||
if (!Application.isPlaying) | ||
{ | ||
return; | ||
} | ||
|
||
if (_instance == null) | ||
{ | ||
//If I am the first instance, make me the Singleton | ||
_instance = this as T; | ||
DontDestroyOnLoad(transform.gameObject); | ||
_enabled = true; | ||
} | ||
else | ||
{ | ||
//If a Singleton already exists and you find | ||
//another reference in scene, destroy it! | ||
if (this != _instance) | ||
{ | ||
Destroy(this.gameObject); | ||
} | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>10.0.20506</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{89C10793-54C2-8094-B12A-CB38A05F3246}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AssemblyName>Assembly-CSharp</AssemblyName> | ||
<FileAlignment>512</FileAlignment> | ||
<ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<TargetFrameworkProfile>Unity Subset v3.5</TargetFrameworkProfile> | ||
<CompilerResponseFile> | ||
</CompilerResponseFile> | ||
<UnityProjectType>Game:1</UnityProjectType> | ||
<UnityBuildTarget>StandaloneWindows64:19</UnityBuildTarget> | ||
<UnityVersion>2017.1.1f1</UnityVersion> | ||
<RootNamespace> | ||
</RootNamespace> | ||
<LangVersion Condition=" '$(VisualStudioVersion)' != '10.0' ">4</LangVersion> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>Temp\UnityVS_bin\Debug\</OutputPath> | ||
<IntermediateOutputPath>Temp\UnityVS_obj\Debug\</IntermediateOutputPath> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_1_1;UNITY_2017_1;UNITY_2017;PLATFORM_ARCH_64;UNITY_64;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_GENERICS;ENABLE_PVR_GI;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_RUNTIME_NAVMESH_BUILDING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_DIRECTOR;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_TIMELINE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_NATIVE_ARRAY;ENABLE_SPRITE_MASKING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;ENABLE_MONO_BDWGC;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_VIDEO;ENABLE_RMGUI;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_STYLE_SHEETS;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_2_0_SUBSET;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_NATIVE_ARRAY_CHECKS;UNITY_TEAM_LICENSE;ENABLE_VSTU</DefineConstants> | ||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>Temp\UnityVS_bin\Release\</OutputPath> | ||
<IntermediateOutputPath>Temp\UnityVS_obj\Release\</IntermediateOutputPath> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<DefineConstants>TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_1_1;UNITY_2017_1;UNITY_2017;PLATFORM_ARCH_64;UNITY_64;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_GENERICS;ENABLE_PVR_GI;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_RUNTIME_NAVMESH_BUILDING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_DIRECTOR;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_TIMELINE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_NATIVE_ARRAY;ENABLE_SPRITE_MASKING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;ENABLE_MONO_BDWGC;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_VIDEO;ENABLE_RMGUI;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_STYLE_SHEETS;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_2_0_SUBSET;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_NATIVE_ARRAY_CHECKS;UNITY_TEAM_LICENSE;ENABLE_VSTU</DefineConstants> | ||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="mscorlib" /> | ||
<Reference Include="System" /> | ||
<Reference Include="System.XML" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="Boo.Lang" /> | ||
<Reference Include="UnityScript.Lang" /> | ||
<Reference Include="System.Runtime.Serialization" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="UnityEditor"> | ||
<HintPath>Library\UnityAssemblies\UnityEditor.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine"> | ||
<HintPath>Library\UnityAssemblies\UnityEngine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UI"> | ||
<HintPath>Library\UnityAssemblies\UnityEngine.UI.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.Networking"> | ||
<HintPath>Library\UnityAssemblies\UnityEngine.Networking.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.TestRunner"> | ||
<HintPath>Library\UnityAssemblies\UnityEngine.TestRunner.dll</HintPath> | ||
</Reference> | ||
<Reference Include="nunit.framework"> | ||
<HintPath>Library\UnityAssemblies\nunit.framework.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.Timeline"> | ||
<HintPath>Library\UnityAssemblies\UnityEngine.Timeline.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.Analytics"> | ||
<HintPath>Library\UnityAssemblies\UnityEngine.Analytics.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.HoloLens"> | ||
<HintPath>Library\UnityAssemblies\UnityEngine.HoloLens.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Assets\Scripts\FileHelper.cs" /> | ||
<Compile Include="Assets\Scripts\InventorySystem\Attribute.cs" /> | ||
<Compile Include="Assets\Scripts\InventorySystem\ItemData.cs" /> | ||
<Compile Include="Assets\Scripts\InventorySystem\ItemDatabase.cs" /> | ||
<Compile Include="Assets\Scripts\InventorySystem\ItemManager.cs" /> | ||
<Compile Include="Assets\Scripts\InventorySystem\UserItemData.cs" /> | ||
<Compile Include="Assets\Scripts\InventorySystem\Utilities.cs" /> | ||
<Compile Include="Assets\Scripts\Singleton\PersistentSingleton.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildExtensionsPath)\SyntaxTree\UnityVS\2015\UnityVS.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 2015 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InventorySystem.CSharp", "InventorySystem.CSharp.csproj", "{89C10793-54C2-8094-B12A-CB38A05F3246}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{89C10793-54C2-8094-B12A-CB38A05F3246}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{89C10793-54C2-8094-B12A-CB38A05F3246}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{89C10793-54C2-8094-B12A-CB38A05F3246}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{89C10793-54C2-8094-B12A-CB38A05F3246}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
m_EditorVersion: 2017.1.0f3 | ||
m_EditorVersion: 2017.1.1f1 |