/// <summary> /// 唤醒的时候 /// </summary> private void Awake() { int nowMap = PlayerPrefUtil.GetNowMap(); GetComponent <Camera>().backgroundColor = new Color(colorArr[nowMap, 0] / 255, colorArr[nowMap, 1] / 255, colorArr[nowMap, 2] / 255); }
private AudioSource audioSource; //声音源组件 private void Awake() { audioSource = GetComponent <AudioSource>(); int nowMap = PlayerPrefUtil.GetNowMap(); audioSource.clip = backGroundMusic[nowMap]; //设置背景音乐 }
public GameObject nextBt; //主页按钮 /// <summary> /// 显示的时候 /// </summary> private void Start() { int nowLevel = PlayerPrefUtil.GetNowLevel(); //当前关卡 int nowMap = PlayerPrefUtil.GetNowMap(); //当前地图 int sumLevel = GameLevelUtil.sLevelNumArray[nowMap]; if (nowLevel + 1 == sumLevel) { nextBt.SetActive(false); //失活 homeBt.GetComponent <RectTransform>().anchoredPosition = new Vector2(-60, homeBt.GetComponent <RectTransform>().anchoredPosition.y); //重新定位 retryBt.GetComponent <RectTransform>().anchoredPosition = new Vector2(60, retryBt.GetComponent <RectTransform>().anchoredPosition.y); } }
/// <summary> /// 唤醒的时候 /// </summary> private void Awake() { int nowMap = PlayerPrefUtil.GetNowMap(); //当前地图 transform.GetChild(nowMap).gameObject.SetActive(true); //激活游戏介绍 }