public void ClearGameContent() { _starsShow.Dispose(); _starsShow = null; _isGameOver = true; //清除界面 Object.Destroy(GameObject.Find("gameBg")); Object.Destroy(GameObject.Find("gameMessageUI")); Object.Destroy(GameObject.Find("propUI")); }
public void Init(int color, int posId, StarsShow starsShow) { _color = color; _posId = posId; //_starsShow = starsShow; _moveX = 1e6f; _moveY = 1e6f; _initPos = new Vector2(gameObject.transform.position.x, gameObject.transform.position.y); _game = GameObject.Find("Main Camera").GetComponent <Game>(); _particle = (GameObject)GameObject.Instantiate((GameObject)Resources.Load("Prefabs/StarParticle"), Vector3.zero, new Quaternion()); ChangeColor(_color); }
/**播放完文字动画后执行*/ public void NewLevelB() { _starsShow = new StarsShow(); _starsShow.Init(this, new Vector2(-2.4f, -3.6f)); RandomArr.Instance(); int[] cnts = RandomArr.RandElement(100, 5, 12, 28);//得到长度为5的数组,各个元素的和为100,元素最小12最大28如:[16, 14, 26, 24, 20 ] /* for(int i=0; i<5; i++){ * Debug.Log(cnts[i]); * }*/ _starsShow.NewStarsPosition(cnts); // SoundMan.instance.PlayOneShot("星星出现动画"); }