void Update() { if (fail == true) { Piece1.GetComponent <SpriteRenderer>().sprite = CrumbleWall; Piece2.GetComponent <SpriteRenderer>().sprite = CrumbleWall; Piece3.GetComponent <SpriteRenderer>().sprite = CrumbleWall; Piece4.GetComponent <SpriteRenderer>().sprite = CrumbleWall; Win = 0; } else if (p1 == true && p2 == true && p3 == true && p4 == true) { Piece1.GetComponent <SpriteRenderer>().sprite = FixWall; Piece2.GetComponent <SpriteRenderer>().sprite = FixWall; Piece3.GetComponent <SpriteRenderer>().sprite = FixWall; Piece4.GetComponent <SpriteRenderer>().sprite = FixWall; Win = 1; } else { if (p1 == true) { Piece1.GetComponent <SpriteRenderer>().sprite = FixWall; } if (p2 == true) { Piece2.GetComponent <SpriteRenderer>().sprite = FixWall; } if (p3 == true) { Piece3.GetComponent <SpriteRenderer>().sprite = FixWall; } if (p4 == true) { Piece4.GetComponent <SpriteRenderer>().sprite = FixWall; } p1 = Piece1.GetComponent <ClickItem>().Clicked; p2 = Piece2.GetComponent <ClickItem>().Clicked; p3 = Piece3.GetComponent <ClickItem>().Clicked; p4 = Piece4.GetComponent <ClickItem>().Clicked; fail = Back.GetComponent <ClickItem>().Clicked; } if (T < 0) { PlayerPrefs.SetInt("Result", Win); Back.GetComponent <PresentResults>().enabled = true; Back.GetComponent <GameWall>().enabled = false; } else { T = T - Time.deltaTime; } }
void Start() { ScoreText.enabled = false; LivesText.enabled = false; RuleText.enabled = false; Progress = 1; Win = 0; T = PlayerPrefs.GetFloat("PTime"); tt = T; p1 = Piece1.GetComponent <ClickItem>().Clicked; p2 = Piece2.GetComponent <ClickItem>().Clicked; p3 = Piece3.GetComponent <ClickItem>().Clicked; p4 = Piece4.GetComponent <ClickItem>().Clicked; fail = Back.GetComponent <ClickItem>().Clicked; }