void Awake() { instance = this; LocationPanel.SetActive(false); screenwidth = ItemTransform.GetComponent <RectTransform> ().rect.width; ItemTransform.SetActive(false); }
void Start() { StudentCodeInput = GameObject.Find("StudentCodeInput").GetComponent <InputField>(); remember = GameObject.Find("RememberCheckBox").GetComponent <Toggle>(); photoObject = GameObject.Find("TakePicButton").GetComponent <CameraScript>(); network = gameObject.GetComponent <NetworkScript>(); location = gameObject.GetComponent <LocationScript>(); informations = new Informations(); }
// Update is called once per frame void Update() { var referenceLocation = referenceObject.GetComponent <LocationScript>(); float distance = LocationScript.Distance(latitude, longitude, referenceLocation.latitude, referenceLocation.longitude); distance = Mathf.Abs(distance); distanceToReference = distance; if (text != null) { text.text = this.name + "\n Lat: " + referenceLocation.latitude + "\n Lng: " + referenceLocation.longitude + "\n Distance: " + distance; } }
public void GetData(LocationObject data, WaveEvent waveEvent) { spawnList = new List <Transform>(); this.data = data; this.waveEvent = waveEvent; title = data.titel; description = data.description; id = data.id; Location = data.Location; clearOutTarget = data.clearOutTarget; isComlete = false; isBonus = data.isBonus; characters = GameObject.FindGameObjectsWithTag("Character"); //GameObject[] Locations = GameObject.FindGameObjectsWithTag("Location"); //foreach (GameObject location in Locations) //{ // if (location.name == data.Location.name) // { // Location = location; // break; // } //} holder = Instantiate(Location); holder.transform.position = data.locationPos.position; holder.name = "LocationObjective(" + id + ")"; loScript = holder.GetComponent <LocationScript>(); //if (data.spawnLo) //{ // Location.transform.position = data.locationPos.position; //} //else //{ //} if (startEvents != null) { StartEvent(startEvents); } spawnList.Add(holder.transform); }
//method for returning home //when this method executes we need to do a few different things. We first need to return to the home location. We also need to increment the maximum stress and set current stress = max stress //all visitedToday tags need to be set to uncalled IEnumerator switchLocation(LocationScript destination) { //if we have arrived at the destination, call the function that starts a new event float differenceX = 0; float differenceY = 0; float differenceZ = 0; differenceX = (destination.gameObject.transform.position.x - currentLocation.gameObject.transform.position.x); differenceY = (destination.gameObject.transform.position.y - currentLocation.gameObject.transform.position.y); differenceZ = (destination.gameObject.transform.position.z - currentLocation.gameObject.transform.position.z); rb.velocity = new Vector3(differenceX, differenceY, differenceZ); yield return(new WaitForSeconds(1f)); rb.velocity = new Vector3(0, 0, 0); currentLocation = destination; //Call event coroutines }
void Start() { _Location = this.GetComponent <LocationScript>(); LastLatitude = _Location.latitude; LastLongitude = _Location.longitude; }
// Use this for initialization void Start() { var referenceLocation = referenceObject.GetComponent <LocationScript>(); distanceToReference = LocationScript.Distance(latitude, longitude, referenceLocation.latitude, referenceLocation.longitude); }