// Use this for initialization void Start() { buttonSpawn.Init(); txtTimer.text = ""; List <Rsc> rscList = ResourceManager.GetResourceList(); for (int i = 0; i < rscList.Count; i++) { if (i == 0) { rscObjList[i].Init(); } else { rscObjList.Add(rscObjList[0].Clone("RscObj" + i, new Vector3(i * 1, -40, 0))); } rscObjList[i].imageIcon.sprite = rscList[i].icon; } OnLife(0); OnNewWave(1); OnResourceChanged(new List <int>()); if (SpawnManager.AutoStart()) { buttonSpawn.rootObj.SetActive(false); //StartCoroutine(AutoStartTimer()); OnSpawnTimer(SpawnManager.GetAutoStartDelay()); } }
public UnityButton Clone(string name, Vector3 posOffset){ UnityButton newBut=new UnityButton(); newBut.rootObj=(GameObject)MonoBehaviour.Instantiate(rootObj); newBut.rootObj.name=name;//=="" ? srcObj.name+"(Clone)" : name; newBut.Init(); newBut.rootT.SetParent(rootT.parent); newBut.rootT.localPosition=rootT.localPosition+posOffset; newBut.rootT.localScale=new Vector3(1, 1, 1); return newBut; }
public UnityButton Clone(string name, Vector3 posOffset) { UnityButton newBut = new UnityButton(); newBut.rootObj = (GameObject)MonoBehaviour.Instantiate(rootObj); newBut.rootObj.name = name; //=="" ? srcObj.name+"(Clone)" : name; newBut.Init(); newBut.rootT.SetParent(rootT.parent); newBut.rootT.localPosition = rootT.localPosition + posOffset; newBut.rootT.localScale = new Vector3(2, 2, 2); return(newBut); }
// Use this for initialization void Start() { buttonSpawn.Init(); txtTimer.text = ""; List <Rsc> rscList = ResourceManager.GetResourceList(); for (int i = 0; i < rscList.Count; i++) { if (i == 0) { rscObjList[i].Init(); } else { rscObjList.Add(rscObjList[0].Clone("RscObj" + i, new Vector3(i * 90, 0, 0))); } rscObjList[i].imageIcon.sprite = rscList[i].icon; } OnLife(0); OnNewWave(1); OnResourceChanged(new List <int>()); OnScoreChanged(0); if (SpawnManager.AutoStart()) { buttonSpawn.rootObj.SetActive(false); //StartCoroutine(AutoStartTimer()); OnSpawnTimer(SpawnManager.GetAutoStartDelay()); } storyRect = storyObj.GetComponent <RectTransform>(); storyRect.Translate(0, 0, 0); defaultX = storyRect.position.x; storyObj.SetActive(true); storyAudio.Play(); infoImages = GameObject.FindGameObjectsWithTag("InfoImagesTag"); OnInfoButton(); }