/// <summary> /// 初始化产生的甜品位置信息 /// </summary> /// <param name="_x"></param> /// <param name="_y"></param> /// <param name="_gameManager"></param> /// <param name="_type"></param> public void Init(int _x, int _y, GamaManager _gameManager, GamaManager.SweetsType _type) { X = _x; Y = _y; gameManager = _gameManager; type = _type; }
void Awake() { if (gm == null) { gm = this; } }
void Start() { cellUnderMouse = null; isInvertoryActive = false; pc = GameObject.Find("Maya").GetComponent <PlayerController>(); gm = GameObject.Find("GamaManager").GetComponent <GamaManager>(); foreach (var cell in cells) { if (cell.GetComponent <InventoryCell>().currentWeapon) { weaponsNmber++; } } }
void Awake() { m_Instance = this; //Check if instance already exists //If instance already exists and it's not this: //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a gamaManager. if (m_Instance == null) { m_Instance = this; } else if (m_Instance != this) { Destroy(gameObject); } //Sets this to not be destroyed when reloading scene DontDestroyOnLoad(gameObject); MqttSetting.allObjects = UnityEngine.Object.FindObjectsOfType <GameObject>(); allObjects = UnityEngine.Object.FindObjectsOfType <GameObject>(); gamaManager = gameObject; MainCamera = GameObject.Find("MainCamera"); /* * * // Create the plane game Object * plane = GameObject.CreatePrimitive(PrimitiveType.Plane); * plane.transform.localScale = new Vector3(20, 1, 20); * plane.GetComponent<Renderer>().material = planeMaterial; * */ // Create the Topic's manager GameObjects new GameObject(MqttSetting.COLOR_TOPIC_MANAGER).AddComponent <ColorTopic>(); new GameObject(MqttSetting.POSITION_TOPIC_MANAGER).AddComponent <PositionTopic>(); new GameObject(MqttSetting.SET_TOPIC_MANAGER).AddComponent <SetTopic>(); new GameObject(MqttSetting.GET_TOPIC_MANAGER).AddComponent <GetTopic>(); new GameObject(MqttSetting.MONO_FREE_TOPIC_MANAGER).AddComponent <MonoFreeTopic>(); new GameObject(MqttSetting.MULTIPLE_FREE_TOPIC_MANAGER).AddComponent <MultipleFreeTopic>(); new GameObject(MqttSetting.CREATE_TOPIC_MANAGER).AddComponent <CreateTopic>(); new GameObject(MqttSetting.DESTROY_TOPIC_MANAGER).AddComponent <DestroyTopic>(); new GameObject(MqttSetting.MOVE_TOPIC_MANAGER).AddComponent <MoveTopic>(); new GameObject(MqttSetting.NOTIFICATION_TOPIC_MANAGER).AddComponent <NotificationTopic>(); new GameObject(MqttSetting.PROPERTY_TOPIC_MANAGER).AddComponent <PropertyTopic>(); new GameObject(MqttSetting.MAIN_TOPIC_MANAGER).AddComponent <MainTopic>(); }
private void Start() { link = FindObjectOfType <GamaManager>(); }
void OnDestroy() { m_Instance = null; }
void Awake() { Instance = this; }
void Awake() { instance = this; }
private void Awake() { Instance = this; }
void Awake() { DontDestroyOnLoad(gameObject); instance = this; }