CallumP.TradeSys.Controller controller;//the controller script void Awake () { tS = gameObject.GetComponent<CallumP.TradeSys.Trader> ();//need to get the Trader script collect = GameObject.FindGameObjectWithTag (CallumP.TradeSys.Tags.C).GetComponent<CallumP.TradeSys.Controller> ().pickUp;//get the pickUP option in the controller controller = GameObject.FindGameObjectWithTag (CallumP.TradeSys.Tags.C).GetComponent<CallumP.TradeSys.Controller> ();//get the controller script }//end Awake
float textshow;//the time when the pickup text was first shown. this is so that after a time, it will disappear void Start() { controller = GameObject.FindGameObjectWithTag(CallumP.TradeSys.Tags.C).GetComponent<CallumP.TradeSys.Controller>();//Get the controller. This should be the only gameobject with the controller tag. //The TradeSys tags are stored like this to make it easier to find and means that there are no typos which could cause issues! spaceRemaining = cargoSpace;//set the space remaining to the cargo space allowed. This is because it is easier to use the remaining space as a variable //and not have to recalculate it each time cargo = new int[controller.goods.Count][]; for (int g = 0; g < controller.goods.Count; g++) cargo[g] = new int[controller.goods[g].goods.Count]; int unitCount = controller.units.units.Count;//get the number of units defined in the controller if (unitCount > 0)//if there are units defined unitLabel += controller.units.units[unitCount - 1].suffix;//then get the suffix of the highest one InvokeRepeating("UpdatePrices", 0, controller.updateInterval);//call the update prices method so will automatically update the prices at the same //frequency as the controller may be }//end Start