コード例 #1
0
    //Singleton
    private void Awake()
    {
        //Check if instance already exists
        if (Instance == null)
        {
            //if not, set instance to this
            Instance = this;
        }

        //If instance already exists and it's not this:
        else if (Instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }
    }
コード例 #2
0
ファイル: Player.cs プロジェクト: Zeploc/DungeonSamurai
 // Use this for initialization
 void Start()
 {
     QTEManagerRef = FindObjectOfType <QTEManager>();
 }
コード例 #3
0
 // Use this for initialization
 protected void Start()
 {
     Health            = InitialHealth;
     GameControllerRef = FindObjectOfType <GameController> ();
     QTEManagerRef     = GameControllerRef.QTEManagerRef;
 }
コード例 #4
0
 private void Start()
 {
     Instance = this;
 }
コード例 #5
0
 // Use this for initialization
 void Start()
 {
     QTEManagerRef = FindObjectOfType <QTEManager>();
     PlayerRef     = FindObjectOfType <GameController>().GetPlayer();
     gameObject.SetActive(false);
 }