Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented Generic Singleton #145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions Assets/Editor.meta

This file was deleted.

5 changes: 2 additions & 3 deletions Assets/Animators.meta → Assets/Models/Materials.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 76 additions & 0 deletions Assets/Models/Materials/TankColour.mat
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: TankColour
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.08751589, g: 0.48627454, b: 0.08581315, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 0}
8 changes: 8 additions & 0 deletions Assets/Models/Materials/TankColour.mat.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Assets/Prefabs/DustTrail.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ ParticleSystem:
m_RotationOrder: 4
startSizeY:
serializedVersion: 2
minMaxState: 0
minMaxState: 3
scalar: 1
minScalar: 1
maxCurve:
Expand Down Expand Up @@ -311,7 +311,7 @@ ParticleSystem:
m_RotationOrder: 4
startSizeZ:
serializedVersion: 2
minMaxState: 0
minMaxState: 3
scalar: 1
minScalar: 1
maxCurve:
Expand Down
5 changes: 2 additions & 3 deletions Assets/Scripts.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Assets/Scripts/EnemyTank.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
public class EnemyTank : MonoSingletonGeneric<EnemyTank> {

Check notice on line 1 in Assets/Scripts/EnemyTank.cs

View check run for this annotation

codefactor.io / CodeFactor

Assets/Scripts/EnemyTank.cs#L1

An opening curly bracket must not be followed by a blank line. (SA1505)

protected override void Awake()
{
base.Awake();
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/EnemyTank.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions Assets/Scripts/MonoSingletonGeneric.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using UnityEngine;

public class MonoSingletonGeneric<T> : MonoBehaviour where T : MonoSingletonGeneric<T> {

Check notice on line 3 in Assets/Scripts/MonoSingletonGeneric.cs

View check run for this annotation

codefactor.io / CodeFactor

Assets/Scripts/MonoSingletonGeneric.cs#L3

An opening curly bracket must not be followed by a blank line. (SA1505)

private static T instance;
public static T Instance { get { return instance; } }

protected virtual void Awake()
{
if(instance == null)
{
instance = (T)this;
}
else
{
Destroy(this);
}
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/MonoSingletonGeneric.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Assets/Scripts/PlayerTank.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
public class PlayerTank : MonoSingletonGeneric<PlayerTank> {

Check notice on line 1 in Assets/Scripts/PlayerTank.cs

View check run for this annotation

codefactor.io / CodeFactor

Assets/Scripts/PlayerTank.cs#L1

An opening curly bracket must not be followed by a blank line. (SA1505)

protected override void Awake()
{
base.Awake();
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/PlayerTank.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.