Exemplo n.º 1
0
 // Use this for initialization
 void Awake()
 {
     levelcontroll = GetComponent <LevelControll>();
     if (GameData.TestGame)
     {
         //    print("test");
         return;
     }
     else
     {
         //    print("no test");
         if (PlayerPrefsControll.LevelSuccess(levelcontroll.Level - 1))
         {
             play.sprite = playOn;
             GetComponent <Button>().enabled = true;
         }
         else
         {
             play.sprite = playOff;
             GetComponent <Button>().enabled = false;
         }
     }
     txtTarget.gameObject.SetActive(false);
     keo0.gameObject.SetActive(false);
     keo1.gameObject.SetActive(false);
     keo2.gameObject.SetActive(false);
 }
Exemplo n.º 2
0
 private void Start()
 {
     manager = GameObject.FindGameObjectWithTag("Manager").GetComponent <GameManager>();
     tb      = new List <GameObject>();
     lc      = GameObject.FindObjectOfType(typeof(LevelControll)) as LevelControll;
     winPanel.SetActive(false);
     //canvas.enabled = false;
 }
Exemplo n.º 3
0
    void Start()
    {
        if (instace == null)
        {
            instace = this;
        }
        else if (instace != null)
        {
            Destroy(gameObject);
        }

        sceneIndex  = SceneManager.GetActiveScene().buildIndex;
        levelPassed = PlayerPrefs.GetInt("LevelPassed");
    }
Exemplo n.º 4
0
    public void changeLevelItem()
    {
        LevelControll levelcontroll = GameObject.Find("Levels").GetComponent <LevelControll>();

        if (type_1)
        {
            if (this.transform.parent.name == "manocan")
            {
                if (checkMoney())
                {
                    LevelControll.level_manocan++;
                    levelcontroll.changeLevelManocan();
                    if (LevelControll.level_manocan > 1)
                    {
                        this.transform.parent.FindChild("thongbao").gameObject.SetActive(true);
                        this.transform.parent.FindChild("thongbao").FindChild("yes").gameObject.SetActive(true);
                        this.transform.parent.FindChild("thongbao").FindChild("yes").GetChild(0).gameObject.GetComponent <Collider2D>().enabled = true;
                    }
                }
                else
                {
                    if (LevelControll.level_manocan >= 1)
                    {
                        this.transform.parent.FindChild("thongbao").gameObject.SetActive(true);
                        this.transform.parent.FindChild("thongbao").FindChild("no").gameObject.SetActive(true);
                        this.transform.parent.FindChild("thongbao").FindChild("no").GetChild(0).gameObject.GetComponent <Collider2D>().enabled = true;
                    }
                }
            }
            else if (this.transform.parent.name == "table")
            {
                if (checkMoney())
                {
                    LevelControll.level_table++;
                    levelcontroll.changeLevelTable();
                    this.transform.parent.FindChild("thongbao").gameObject.SetActive(true);
                    this.transform.parent.FindChild("thongbao").FindChild("yes").gameObject.SetActive(true);
                    this.transform.parent.FindChild("thongbao").FindChild("yes").GetChild(0).gameObject.GetComponent <Collider2D>().enabled = true;
                }

                else
                {
                    this.transform.parent.FindChild("thongbao").gameObject.SetActive(true);
                    this.transform.parent.FindChild("thongbao").FindChild("no").gameObject.SetActive(true);
                    this.transform.parent.FindChild("thongbao").FindChild("no").GetChild(0).gameObject.GetComponent <Collider2D>().enabled = true;
                }
            }
            else if (this.transform.parent.name == "tivi")
            {
                if (checkMoney())
                {
                    LevelControll.level_tv++;
                    levelcontroll.changeLevelTivi();
                    if (LevelControll.level_tv > 1)
                    {
                        this.transform.parent.FindChild("thongbao").gameObject.SetActive(true);
                        this.transform.parent.FindChild("thongbao").FindChild("yes").gameObject.SetActive(true);
                        this.transform.parent.FindChild("thongbao").FindChild("yes").GetChild(0).gameObject.GetComponent <Collider2D>().enabled = true;
                    }
                }
                else
                {
                    if (LevelControll.level_tv >= 1)
                    {
                        this.transform.parent.FindChild("thongbao").gameObject.SetActive(true);
                        this.transform.parent.FindChild("thongbao").FindChild("no").gameObject.SetActive(true);
                        this.transform.parent.FindChild("thongbao").FindChild("no").GetChild(0).gameObject.GetComponent <Collider2D>().enabled = true;
                    }
                }
            }
        }
        else
        {
            if (this.transform.parent.name == "machines")
            {
                if (checkMoney())
                {
                    LevelControll.level_machine++;
                    levelcontroll.changeSpriteMachine();
                }
            }
            else if (this.transform.parent.name == "lonuong")
            {
                if (checkMoney())
                {
                    LevelControll.level_lo++;
                    levelcontroll.changeSpriteLo();
                }
            }
            else if (this.transform.parent.parent.parent.name == "Gases")
            {
                if (checkMoney())
                {
                    string[] abc       = LevelControll.level_bep.Split('_');
                    string[] thisPaArr = this.transform.parent.parent.name.Split('_');
                    int      parInt    = int.Parse(thisPaArr[1]);
                    int      parVal    = int.Parse(abc[parInt - 1]);
                    parVal++;
                    abc[parInt - 1]         = parVal.ToString();
                    LevelControll.level_bep = abc[0];
                    for (int i = 1; i < abc.Length; i++)
                    {
                        LevelControll.level_bep += "_" + abc[i];
                    }
                    levelcontroll.changeSpriteGas();
                }
            }
        }

        changeBar();
        //	turnOffBox (true);
    }
Exemplo n.º 5
0
 void Awake()
 {
     current = this;
 }