IEnumerator SheepFlyOut_bak() { while (_theHouse.sheep > 0) { ++_outSheep; _theHouse.OnInfected(); if (_theHouse.sheep == 0) { var ins = Instantiate <TheSheep> (_theInfectedShepherdPrefab, _theShepherd.transform.position, Quaternion.identity); var forward = transform.position - ins.transform.position; forward.Normalize(); ins.speed = _theSheepSpeed / 2.5f; _theShepherd.gameObject.SetActive(false); } else { var pos = _theHouse.transform.position; pos.x = Random.Range(-.8f, .8f); var ins = Instantiate <TheSheep> (_theSheepPrefab, pos, Quaternion.identity); ins.transform.localScale = Vector3.one * Random.Range(.7f, 1f); var forward = transform.position - ins.transform.position; forward.Normalize(); ins.speed = Random.Range(_theSheepSpeed / 2.5f, _theSheepSpeed); } yield return(new WaitForSeconds(.085f)); } }
public void Hit() { Instantiate(_dissolvedEffectOnHit, Vector3.up * 1.01f, Quaternion.identity); _theHouse.OnInfected(); _settings.Vibrate(); if (_theHouse.sheep <= 0) { _settings.GameOver(); } }
IEnumerator GoingOut(Transform goOutPoint) { yield return(new WaitForSeconds(1f)); var particleMain = particle.main; particleMain.loop = true; particle.Play(); speed = infectedSpeed; transform.localScale = Vector3.one; gameObject.SetActive(true); transform.position = new Vector3(transform.position.x, goOutPoint.position.y, transform.position.z); _theHouse.OnInfected(); }