Game singleton
This commit is contained in:
parent
be171484c4
commit
bc5f57a0fb
|
@ -0,0 +1,38 @@
|
||||||
|
using UnityEngine;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
public class Game {
|
||||||
|
|
||||||
|
void SetMainPlayer(Player p){
|
||||||
|
m_mainPlayer = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Player GetMainPlayer(){
|
||||||
|
return m_mainPlayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static Game Get() {
|
||||||
|
lock(m_singlmutex) {
|
||||||
|
if(m_inst==null)
|
||||||
|
m_inst = new Game();
|
||||||
|
}
|
||||||
|
return m_inst;
|
||||||
|
}
|
||||||
|
private Game() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static Game m_inst = null;
|
||||||
|
private static object m_singlmutex = new Object();
|
||||||
|
|
||||||
|
|
||||||
|
private Player m_mainPlayer = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fe4a245558e76304cb5e10458a6c3012
|
||||||
|
timeCreated: 1425550993
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue