public void Click() { if (usable == true) { GetComponent <AudioSource>().Play(); Controller.Score = 0; foreach (GameObject AllBoats in GameObject.FindGameObjectsWithTag("boat")) { GameObject.Destroy(AllBoats); } foreach (GameObject AllGrids in GameObject.FindGameObjectsWithTag("point")) { AllGrids.GetComponent <Pointbehavoir>().Image.enabled = false; AllGrids.GetComponent <Pointbehavoir>().CanInteract = false; } Controller.StartLevel(levelName); foreach (GameObject AllLevels in GameObject.FindGameObjectsWithTag("level")) { AllLevels.GetComponent <Image>().sprite = unUsingSprite; StartCoroutine(AllLevels.GetComponent <Menu>().Working()); } foreach (GameObject AllLevels in GameObject.FindGameObjectsWithTag("niveau")) { StartCoroutine(AllLevels.GetComponent <Menu>().Working()); } GetComponent <Image>().sprite = UsingSprite; Controller.LevelName = levelName; } }
void _NextLevel() { if (usable == true) { GetComponent <AudioSource>().Play(); Controller.Score = 0; foreach (GameObject AllBoats in GameObject.FindGameObjectsWithTag("boat")) { GameObject.Destroy(AllBoats); } foreach (GameObject AllGrids in GameObject.FindGameObjectsWithTag("point")) { AllGrids.GetComponent <Pointbehavoir>().Image.enabled = false; AllGrids.GetComponent <Pointbehavoir>().CanInteract = false; } foreach (GameObject AllLevels in GameObject.FindGameObjectsWithTag("level")) { //AllLevels.GetComponent<Image>().sprite = unUsingSprite; StartCoroutine(AllLevels.GetComponent <Menu>().Working()); } Controller.StartLevel(Controller.LevelName + 1); foreach (GameObject AllLevels in GameObject.FindGameObjectsWithTag("niveau")) { StartCoroutine(AllLevels.GetComponent <Menu>().Working()); } transform.position = new Vector2(100, 100); GetComponent <SpriteRenderer>().sprite = NotPushed; Controller.LevelName = Controller.LevelName + 1; GetComponent <BoxCollider2D>().enabled = true; Debug.Log(Controller.LevelName); } }
public void points() { if (CanUse != false) { StartCoroutine("Working"); GetComponent <AudioSource>().Play(); foreach (GameObject AllGrids in GameObject.FindGameObjectsWithTag("point")) { if (AllGrids.GetComponent <Pointbehavoir>().CanInteract == true) { AllGrids.GetComponent <Pointbehavoir>().Image.enabled = false; AllGrids.GetComponent <Pointbehavoir>().CanInteract = false; } } Vector2 fwd = transform.TransformDirection(Vector2.up); Vector2 bwd = transform.TransformDirection(Vector2.down); SettingActive(fwd, pointOrginFront, true); SettingActive(bwd, pointOrginBack, false); foreach (GameObject Allboeats in GameObject.FindGameObjectsWithTag("boat")) { StartCoroutine(Allboeats.GetComponent <BoatBehavoir>().Working()); Allboeats.GetComponent <Image>().enabled = false; } GetComponent <Image>().enabled = true; StartCoroutine(hit()); } }
public void MoveBoat() { if (CanInteract == true) { boat.GetComponent <Image>().enabled = false; GetComponent <AudioSource>().Play(); StartCoroutine(BoatMoving(boat.GetComponent <BoatBehavoir>().TotalDistance)); foreach (GameObject AllGrids in GameObject.FindGameObjectsWithTag("point")) { if (AllGrids.GetComponent <Pointbehavoir>().CanInteract == true) { AllGrids.GetComponent <Pointbehavoir>().Image.enabled = false; AllGrids.GetComponent <Pointbehavoir>().CanInteract = false; } } Image.enabled = false; CanInteract = false; } else { StartCoroutine(boatvisible()); } }
private void Start() { string Difficulty = GlobalGameSettings.GetSetting("Difficulty"); switch (Difficulty) { case "Beginner": _Difficulty = 0; break; case "Easy": _Difficulty = 8; break; case "Medium": _Difficulty = 16; break; case "Hard": _Difficulty = 24; break; case "Expert": _Difficulty = 32; break; } int Level; int.TryParse(GlobalGameSettings.GetSetting("Level"), out Level); foreach (GameObject AllLevels in GameObject.FindGameObjectsWithTag("level")) { AllLevels.GetComponent <Menu>().levelName = AllLevels.GetComponent <Menu>().level + _Difficulty;//+1; int LevelAmount = AllLevels.GetComponent <Menu>().levelName = AllLevels.GetComponent <Menu>().level + _Difficulty; AllLevels.GetComponentInChildren <Text>().text = "Level " + LevelAmount; //AllLevels.GetComponent<Image>().sprite = unUsingSprite; //if (AllLevels.GetComponent<Menu>()._Difficulty == Controller.LevelName) //{ // AllLevels.GetComponent<Image>().sprite = AllLevels.GetComponent<Menu>().UsingSprite; //} StartCoroutine(AllLevels.GetComponent <Menu>().Working()); } foreach (GameObject AllLevels in GameObject.FindGameObjectsWithTag("niveau")) { //AllLevels.GetComponent<Image>().sprite = unUsingSprite; StartCoroutine(AllLevels.GetComponent <Menu>().Working()); } foreach (GameObject AllGrids in GameObject.FindGameObjectsWithTag("point")) { AllGrids.GetComponent <Pointbehavoir>().Image.enabled = false; AllGrids.GetComponent <Pointbehavoir>().CanInteract = false; } if (off_LEvelName == 0) { StartLevel((Level - 1) + _Difficulty); LevelName = ((Level) + _Difficulty); LevelNameText.text = Difficulty + ":" + Level; minimaleZetten = Levels[LevelName - 1].minimaleZetten; } else { int _lev = Level; StartLevel(_LevelName); LevelName = (_LevelName); int _switch = 0; _lev = (LevelName + 1); Debug.Log(_lev); while (_lev > 0) { _lev = _lev - 8; _switch++; } switch (_switch) { case 1: Difficulty = "Beginner"; break; case 2: Difficulty = "Easy"; break; case 3: Difficulty = "Medium"; break; case 4: Difficulty = "Hard"; break; case 5: Difficulty = "Expert"; break; } Debug.Log(_lev); _lev = _lev + 8; LevelNameText.text = Difficulty + ":" + _lev; minimaleZetten = Levels[LevelName].minimaleZetten; } }