void Update() { piecesCount = Slicer2D.GetListCount(); slicesText.text = "Slices: " + slicesCount + " / " + Levels[currentLevelID].allowedSlices; piecesText.text = "Pieces: " + piecesCount + " / " + Levels[currentLevelID].allowedPieces; Vector3 pos = Camera.main.transform.position; pos.x = pos.x * 0.95f + (float)(currentLevelID * 50f) * 0.05f; Camera.main.transform.position = pos; if (Slicer2D.GetList().Count < 1) { return; } if (slicesCount <= Levels[currentLevelID].allowedSlices && piecesCount == Levels[currentLevelID].allowedPieces) { foreach (Slicer2D slicer in Slicer2D.GetListCopy()) { slicer.gameObject.AddComponent <DivideGreenFade>(); slicer.enabled = false; garbage.Add(slicer.gameObject); } DivideUIFade.instance.state = true; DivideUIFade.instance.menuObjects[0].SetActive(false); DivideUIFade.instance.menuObjects[1].SetActive(false); DivideUIFade.instance.menuObjects[2].SetActive(true); //currentLevelID++; //Levels[currentLevelID].level.SetActive(true); //slicesCount = 0; } else if (slicesCount > Levels[currentLevelID].allowedSlices) { foreach (Slicer2D slicer in Slicer2D.GetListCopy()) { DivideGreenFade fade = slicer.gameObject.AddComponent <DivideGreenFade>(); fade.fadeTyp = DivideGreenFade.FadeType.Red; slicer.enabled = false; garbage.Add(slicer.gameObject); } DivideUIFade.instance.menuObjects[0].SetActive(false); DivideUIFade.instance.menuObjects[1].SetActive(true); DivideUIFade.instance.menuObjects[2].SetActive(false); DivideUIFade.instance.state = true; } }
void Start() { cooldown = TimerHelper.Create(); piecesCount = Slicer2D.GetListCount(); Slicer2D.AddGlobalResultEvent(SliceEvent); DivideUIFade.instance.menuObjects[0].SetActive(true); DivideUIFade.instance.menuObjects[1].SetActive(false); DivideUIFade.instance.menuObjects[2].SetActive(false); // LVL 1 : SQUARE // 1 Slices // 2 Pieces // LVL 2 : Triangle // 3 Slices // 3 Pieces // LVL 3 : U Latter // 2 Slices // 5 Pieces // LVL 4 : T Latter // 2 Slices // 6 Pieces // LVL 6 : OMN Latter // 3 Slices // 8 Pieces // LVL 7 : + // 4 Slices // 10 Pieces Slicer2D.AddGlobalResultEvent(GlobalSliceEvent); }
void OnRenderObject() { Text text = GetComponent <Text> (); text.text = "objects " + Slicer2D.GetListCount(); }