IEnumerator decreaseUnrest() { while (true) { unrestController.IncreaseUnrest(-(Mathf.Abs((unrestController.decay * Time.deltaTime) / 2f))); yield return(new WaitForEndOfFrame()); } }
IEnumerator NewHeadline(float delay) { while (true) { input.GetComponent <KayboardSelect> ().disableField(); input.text = headlines [Random.Range(0, headlines.Length)]; //reset the input yield return(new WaitForSeconds(delay)); //check if a slanderous headline got through if (slanderousHeadlines.Contains(headline.text)) { //increase unrest for the headline unrestController.IncreaseUnrest(unrestValue); cameraController.warning(newsCam); } } }
void Update() { //have we reached the top yet? if (transform.position.y - initialPos.y < wallHeight) { transform.localPosition += new Vector3(0, speed * Time.deltaTime, 0); } //have we moved across the top yet? else if (transform.position.x < initialPos.x + wallWidth) { transform.localPosition += new Vector3(speed * Time.deltaTime, 0, 0); } //yes we have else { unrestController.IncreaseUnrest(escapePenalty); cameraControl.warning(prisonCam); Destroy(gameObject); } }