// Start is called before the first frame update void Start() { GameObject spaceStation = GameObject.FindWithTag("SpaceStation"); if (spaceStation == null) { Debug.LogError("Unable to find SpaceStation gameObject to initialize inventory!"); return; } spaceStationManager = spaceStation.GetComponent <SpaceStationManager>(); }
protected virtual void Start() { productionAccumulatedTime = 0; GameObject spaceStation = GameObject.FindWithTag("SpaceStation"); if (spaceStation == null) { Debug.LogError("Unable to find SpaceStation gameObject to register \"" + gameObject.name + "\" machine!"); return; } spaceStationManager = spaceStation.GetComponent <SpaceStationManager>(); if (spaceStationManager == null) { Debug.LogError("Unable to find SpaceStation manager script to register \"" + gameObject.name + "\" machine!"); } spaceStationManager.RegisterMachine(this); InvokeRepeating("Produce", resourceProductionFrequency, resourceProductionFrequency); }
void Start() { /*for (int i = 0; i < slots.Length; i++) { * if (placables.Length > i) { * UnityEngine.UI.Image[] images = slots[i].GetComponentsInChildren<UnityEngine.UI.Image>(); * foreach(UnityEngine.UI.Image img in images){ * if(img.name == "SlotItem"){ * img.sprite = placables[i].icon; * float currentSize = img.rectTransform.sizeDelta.x; * img.rectTransform.sizeDelta = new Vector2(currentSize * 3 / 5, currentSize * 3 / 5); * } * } * * } * }*/ GameObject spaceStation = GameObject.FindWithTag("SpaceStation"); if (spaceStation == null) { Debug.LogError("Unable to find SpaceStation gameObject to initialize inventory!"); return; } spaceStationManager = spaceStation.GetComponent <SpaceStationManager>(); }
private void Awake() { SpaceStationManager.stationManager = this; }