示例#1
0
 void Awake()
 {
     if (instance == null)
     {
         DontDestroyOnLoad(transform.parent.gameObject);
         instance = this;
     }
     else
     {
         DestroyImmediate(transform.parent.gameObject);
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
示例#3
0
        public virtual void Awake()
        {
            if (_transitionPanel == null)
            {
                _transitionPanel = FindObjectOfType <TransitionPanel>();
            }

            if (_accountButton == null)
            {
                _accountButton = FindObjectOfType <AccountButton>();
            }
        }
示例#4
0
 // Start is called before the first frame update
 void Start()
 {
     if (persistentPlayerData == null)
     {
         object readData = DataManagement.ReadDataFromFile();
         if (readData != null)
         {
             persistentPlayerData = (ScenePlayerData)readData;
         }
         else
         {
             persistentPlayerData = new ScenePlayerData();
             persistentPlayerData.SetAllData(0, startPoint, Quaternion.identity);
             DataManagement.WriteDataToFile(persistentPlayerData);
         }
     }
     player = GameObject.FindGameObjectWithTag("Player").GetComponent <MovScript> ();
     player.activeControl = true;
     panel = TransitionPanel.instance;
     panel.Initialize();
     player.GetComponent <PlayerAtributes> ().Initialize();
 }