public void newMole() { GameObject o; if (Random.Range(0f, 10f) > 8f && GameObject.Find("151122_WhackAMole_Otter(Clone)") == null) o = GameObject.Instantiate(otterPrefab); else o = GameObject.Instantiate(molePrefab); o.transform.parent = transform; o.transform.localPosition = new Vector3(0,-1.2f,0); m = o.GetComponent<Minigame_WhackAMole_Mole>(); m.hole = this; m.Init(); taken = true; o.GetComponent<SpriteRenderer>().sortingOrder += sortingOrder; }
public void newMole() { GameObject o; if (Random.Range(0f, 10f) > 8f && GameObject.Find("151122_WhackAMole_Otter(Clone)") == null) { o = GameObject.Instantiate(otterPrefab); } else { o = GameObject.Instantiate(molePrefab); } o.transform.parent = transform; o.transform.localPosition = new Vector3(0, -1.2f, 0); m = o.GetComponent <Minigame_WhackAMole_Mole>(); m.hole = this; m.Init(); taken = true; o.GetComponent <SpriteRenderer>().sortingOrder += sortingOrder; }