// Use this for initialization void Start() { cargoBag = GetComponent<CargoBag>(); OnLevelUIObject = (GameObject)GameObject.Find ("OnLevelUI"); OnLevelUI = OnLevelUIObject.GetComponent<OnLevelUI>(); cargoBag.ProduceBag (); SetNextCargo (); SpawnCargo (); }
// Use this for initialization void Awake() { cargoObject = GameObject.Find ("NewCrane"); cargoBag = cargoObject.GetComponent<CargoBag>(); missionWinObject = GameObject.Find ("MissionWinUI"); missionWinUI = missionWinObject.GetComponent<MissionWinUI>(); //fields timeObject = GameObject.Find ("Time"); time = timeObject.GetComponent<Text>(); levelObject = GameObject.Find ("Level"); level = levelObject.GetComponent<Text>(); nextObject = GameObject.Find ("Next"); next = nextObject.GetComponent<Text>(); woodObject = GameObject.Find ("Wood"); wood = woodObject.GetComponent<Text> (); ironObject = GameObject.Find ("Iron"); iron = ironObject.GetComponent<Text>(); glassObject = GameObject.Find ("Glass"); glass = glassObject.GetComponent<Text>(); glassLabelObject = GameObject.Find ("GlassLabel"); glassLabel = glassLabelObject.GetComponent<Text>(); cargoImageObject = GameObject.Find ("CargoImage"); cargoImage = cargoImageObject.GetComponent<Image>(); truck = GameObject.Find ("Truck").GetComponent<Truck> (); timeLeft = maxTime; tutorialObject = GameObject.Find ("Tutorial"); level.text = (Application.loadedLevel).ToString(); }
// Use this for initialization void Start() { truckObject = GameObject.Find ("Truck"); truck = truckObject.GetComponent<Truck>(); crackedGlassObject = GameObject.Find ("CrackedGlass"); crackedWoodbject = GameObject.Find ("CrackedWood"); destroyedGlassObject = GameObject.Find ("DestroyGlass"); destroyedWoodObject = GameObject.Find ("DestroyWood"); crackedGlass = crackedGlassObject.GetComponent<AudioSource>(); crackedWood = crackedWoodbject.GetComponent<AudioSource>();; destroyedGlass = destroyedGlassObject.GetComponent<AudioSource>();; destoryedWood = destroyedWoodObject.GetComponent<AudioSource>();; collisionObject = GameObject.Find ("Collision"); collision = collisionObject.GetComponent<AudioSource>(); newCrane = (GameObject)GameObject.Find ("NewCrane"); cargoBag = newCrane.GetComponent<CargoBag>(); Rigidbody rigid = GetComponent<Rigidbody>(); int num = Random.Range (0,2); if (num == 1) { rigid.AddForce (transform.forward*swingPower); } else { rigid.AddForce (-transform.forward*swingPower); } }