private void PacketReceived(ChangeLevel packet) { Loaded = false; OnChangeLevel(packet); LevelManager.ChangeLevel(packet.nextLevel); }
public void playGame(bool choice) { GameData.Toss = choice; ChangeLevel changeLevel = new ChangeLevel(); changeLevel.gotoGameScene(); }
public void OnChoose() { ChangeLevel.CurrentLevelIndex = levelIndex; GamesManagingState.CurrentGameName = gameName; SceneManager.LoadScene(ChangeLevel.GetCurrentLevelPath()); }
void Start() { DontDestroyOnLoad (transform.gameObject); nameObject = GameObject.Find ("Name Holder"); sender = nameObject.GetComponent<ChangeLevel> (); tempName = sender.nameGetter (); scoreKeeper = GameObject.Find("Main Camera").GetComponent<Score>(); // object die score/string bijhoud(Pakt getter en setter vanaf deze var!) }
void Start() { spawningBossObject = Resources.Load("Portal") as GameObject; spawningBossHp = Resources.Load("BossHpBackground") as GameObject; soulSpawner = GameObject.FindWithTag("SoulSpawner").GetComponent <SoulSpawner>(); UIObject = GameObject.FindWithTag("UI"); soulSpawner.enabled = false; changeLvl = GameObject.Find("Levels").GetComponent <ChangeLevel>(); }
public MapManager() { this.MapIndex = StartingMapIndex; this.MapListPath = new List <string>(); this.currentMap = new Map(this.MapListPath[MapIndex]); this.charManager = new CharacterManager(); this.buildingManager = new BuildingManager(); this.sandWatch = new SandWatch(); this.battlefield = new Battlefield(); this.changeLevel = new ChangeLevel(); }
private void changeLevel(string level) { ChangeLevel changeLevel = new ChangeLevel(); if (level == "retoss") { changeLevel.gotoTossScene(); } else if (level == "play") { playButttonOnClick(); } }
private void goToGameOverScreen(string sceneName) { ChangeLevel changeLevel = new ChangeLevel(); if (sceneName == "game over") { changeLevel.gotoGameOverScene(); } else { changeLevel.gotoTossScene(); } }
void Awake() { //Crea el archivo filePath = Application.persistentDataPath + "/Save/Posicion.json"; Directory.CreateDirectory(Application.persistentDataPath + "/Save/"); CrearArchivo(); //Busca el fade fade = GameObject.FindGameObjectWithTag("Fade"); animacionFade = fade.GetComponent <Animator>(); instance = this; }
public void playButttonOnClick() { ChangeLevel changeLevel = new ChangeLevel(); if (!wonToss) { changeLevel.gotoGameScene(); } else { changeLevel.gotoElectScene(); } }
public void ProgLevelUp(Programmer proger, int num) { if (num <= proger.Count()) { proger.InsertElem(0, proger.Elements(num)); proger.RemoveElem(num + 1); ChangeLevel.Invoke("Порядок списка программистов изменён!"); } else { ChangeLevel.Invoke("Невозможно выполнить операцию!"); } }
private void OnDataMessage(NetIncomingMessage msg) { var type = (PacketType)msg.ReadByte(); if (type == PacketType.Connected) { InitializeFromServer(Packets.Connected.Read(msg)); } if (!Loaded) { return; } switch (type) { case PacketType.PlayerPreferences: PacketReceived(PlayerPreferences.Read(msg)); break; case PacketType.PlayerConnected: PacketReceived(PlayerConnected.Read(msg)); break; case PacketType.PlayerDisconnected: PacketReceived(PlayerDisconnected.Read(msg)); break; case PacketType.WorldState: AddWorldState(WorldState.Read(msg).worldState); break; case PacketType.PlayerDeath: PacketReceived(Packets.PlayerDeath.Read(msg)); break; case PacketType.PlayerShoot: PacketReceived(PlayerShoot.Read(msg)); break; case PacketType.ChangeLevel: PacketReceived(ChangeLevel.Read(msg)); break; case PacketType.GameOver: PacketReceived(Packets.GameOver.Read(msg)); break; } }
private void ClearScene(E_Level p_NextLevel) { if (OnChangeLevel != null) { OnChangeLevel.Invoke(currentLevel, p_NextLevel); } if (OnChangeLevelOnce != null) { OnChangeLevelOnce.Invoke(currentLevel, p_NextLevel); OnChangeLevelOnce = null; } currentLevel = p_NextLevel; }
public Compatibility IsCompatible(ApiVisibility old) { ChangeLevel level = ChangeLevel.NoChange; if (this.Visibility < old.Visibility) { level = ChangeLevel.Broken; } else if (this.Visibility > old.Visibility) { level = ChangeLevel.Compatible; } return(new Compatibility(level)); }
public Compatibility IsCompatible(ApiGeneric old) { ChangeLevel level = ChangeLevel.NoChange; StringBuilder sb = new StringBuilder(); foreach (var genpar in old._genericConstraints) { if (_genericConstraints[genpar.Key] != genpar.Value) { sb.Append(string.Format("{0} where : {1} is changed.", genpar.Key, genpar.Value)); level = ChangeLevel.Broken; } } return(new Compatibility(level, sb.ToString())); }
public Compatibility IsCompatible(ApiParent old) { ChangeLevel level = ChangeLevel.NoChange; StringBuilder sb = new StringBuilder(); foreach (var parent in old._parents) { if (!_parents.Contains(parent)) { sb.Append(string.Format("Base class {0} is changed.", parent)); level = ChangeLevel.Broken; } } return(new Compatibility(level, sb.ToString())); }
protected virtual void OnChangeLevel(ChangeLevel packet) { Loaded = false; foreach (var pl in Players) { if (pl == null) { continue; } pl.Kills = 0; pl.Deaths = 0; } LevelChanging?.Invoke(this, packet.nextLevel); }
public void TaskOnClick() { button1.gameObject.SetActive(true); button2.gameObject.SetActive(true); GameObject gob = GameObject.Find("2_players"); gob.SetActive(false); gob = GameObject.Find("1_player"); gob.SetActive(false); ChangeLevel bok = button1.transform.GetChild(1).gameObject.GetComponent <ChangeLevel>(); bok.scene_name = scene_name; bok = button2.transform.GetChild(1).gameObject.GetComponent <ChangeLevel>(); bok.scene_name = scene_name; }
public void TriggerInteraction() { if (!CanTriggerInteraction()) { return; } switch (sequenceType) { case SequenceType.SuddenDeath: BaseDeathTrigger baseDeathTrigger = GetComponent <BaseDeathTrigger>(); baseDeathTrigger.TriggerDeath(); break; case SequenceType.SuddenDeathSkill: SkillDeathTrigger skillDeathTrigger = GetComponent <SkillDeathTrigger>(); skillDeathTrigger.TriggerDeath(); break; case SequenceType.SuddenDeathCollectable: CollectableDeathTrigger collectableDeathTrigger = GetComponent <CollectableDeathTrigger>(); collectableDeathTrigger.TriggerDeath(); break; case SequenceType.Collectable: Collectable collectable = GetComponent <Collectable>(); collectable.Collect(); break; case SequenceType.AnimationThenDeath: break; case SequenceType.ChangeScene: ChangeLevel changleLevel = GetComponent <ChangeLevel>(); changleLevel.LoadLevel(); break; case SequenceType.OpenShop: Shop.Current.OpenShop(); break; case SequenceType.CustomDeath: GetComponent <ICustomDeath>().Trigger(); break; } }
private int MakeChangeRecurse(int amount, ChangeLevel changeLevel) { if (amount == 0 || (changeLevel == ChangeLevel.One && amount > 0)) { return(1); } if (amount < 0) { return(0); } // To prevent duplicates only branch to the level that is lower // From 25 branch to 25, 10 and 1 // From 10 branch to 10 and 1 // From 1 add 1 if the amount is > 0 int count = 0; switch (changeLevel) { case ChangeLevel.TwentyFive: count += MakeChangeRecurse(amount - 25, ChangeLevel.TwentyFive); count += MakeChangeRecurse(amount - 10, ChangeLevel.Ten); count += MakeChangeRecurse(amount - 1, ChangeLevel.One); break; case ChangeLevel.Ten: count += MakeChangeRecurse(amount - 10, ChangeLevel.Ten); count += MakeChangeRecurse(amount - 1, ChangeLevel.One); break; case ChangeLevel.One: count += MakeChangeRecurse(amount - 1, ChangeLevel.One); break; default: break; } return(count); }
public Compatibility IsCompatible(ApiChildren old) { var sigs = GetApiSignatures(); ChangeLevel level = ChangeLevel.NoChange; StringBuilder sb = new StringBuilder(); foreach (var oldApi in old._apis.Values) { if (!sigs.Contains(oldApi.Signature)) { sb.Append(oldApi.Signature + " is removed."); level = ChangeLevel.Broken; } else { sigs.Remove(oldApi.Signature); var comp = _apis[oldApi.Signature].IsCompatible(oldApi); if (comp.ChangeLevel != 0) { sb.Append(comp.Message); level = comp.ChangeLevel; } } } if (!this.NewMemberIsCompatible && sigs.Count > 0) { level = ChangeLevel.Broken; foreach (string sig in sigs) { sb.Append(string.Format("\n{0} is added.", sig)); } } return(new Compatibility(level, sb.ToString())); }
void Update() { // Update Players energy energyText.text = PlayerPrefs.GetInt("energy").ToString() + " kcal"; energyTextShadow.text = energyText.text; dayText.text = "Day: " + PlayerPrefs.GetInt("day").ToString(); dayTextShadow.text = dayText.text; levelText.text = "Level: " + PlayerPrefs.GetInt("level").ToString(); levelTextShadow.text = levelText.text; if (Input.GetKeyDown(KeyCode.Mouse0)) { Ray R = UICamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(R, out hit, 100)) { SoundController.Static.PlayClickSound(); switch (hit.collider.name) { case "level1_text": PlayerPrefs.SetInt("level", 1); PlayerPrefs.Save(); ChangeLevel.SetActive(false); infoText.text = "Level changed to " + PlayerPrefs.GetInt("level"); infoTextShadow.text = infoText.text; break; case "level2_text": PlayerPrefs.SetInt("level", 2); PlayerPrefs.Save(); ChangeLevel.SetActive(false); infoText.text = "Level changed to " + PlayerPrefs.GetInt("level"); infoTextShadow.text = infoText.text; break; case "level3_text": PlayerPrefs.SetInt("level", 3); PlayerPrefs.Save(); ChangeLevel.SetActive(false); infoText.text = "Level changed to " + PlayerPrefs.GetInt("level"); break; case "level4_text": PlayerPrefs.SetInt("level", 4); PlayerPrefs.Save(); ChangeLevel.SetActive(false); infoText.text = "Level changed to " + PlayerPrefs.GetInt("level"); break; case "level5_text": PlayerPrefs.SetInt("level", 5); PlayerPrefs.Save(); ChangeLevel.SetActive(false); infoText.text = "Level changed to " + PlayerPrefs.GetInt("level"); break; case "level6_text": PlayerPrefs.SetInt("level", 6); PlayerPrefs.Save(); ChangeLevel.SetActive(false); infoText.text = "Level changed to " + PlayerPrefs.GetInt("level"); break; case "level7_text": PlayerPrefs.SetInt("level", 7); PlayerPrefs.Save(); ChangeLevel.SetActive(false); infoText.text = "Level changed to " + PlayerPrefs.GetInt("level"); break; case "level8_text": PlayerPrefs.SetInt("level", 8); PlayerPrefs.Save(); ChangeLevel.SetActive(false); infoText.text = "Level changed to " + PlayerPrefs.GetInt("level"); break; case "level9_text": PlayerPrefs.SetInt("level", 9); PlayerPrefs.Save(); ChangeLevel.SetActive(false); infoText.text = "Level changed to " + PlayerPrefs.GetInt("level"); break; case "level10_text": PlayerPrefs.SetInt("level", 10); PlayerPrefs.Save(); ChangeLevel.SetActive(false); infoText.text = "Level changed to " + PlayerPrefs.GetInt("level"); break; case "pullups_text": ScoreBoard.SetActive(false); Application.LoadLevel("PullUps"); break; case "clappingpullups_text": if (PlayerPrefs.GetInt("level") < 9) { ScoreBoard.SetActive(false); infoText.text = "Your Level " + PlayerPrefs.GetInt("level").ToString() + " is too low"; infoTextShadow.text = infoText.text; } else { ScoreBoard.SetActive(false); Application.LoadLevel("ClappingPullUps"); } break; case "muscleups_text": if (PlayerPrefs.GetInt("level") < 6) { ScoreBoard.SetActive(false); infoText.text = "Your Level " + PlayerPrefs.GetInt("level").ToString() + " is too low"; infoTextShadow.text = infoText.text; } else { ScoreBoard.SetActive(false); Application.LoadLevel("MuscleUps"); } break; case "straightbardibs_text": if (PlayerPrefs.GetInt("level") < 4) { ScoreBoard.SetActive(false); infoText.text = "Your Level " + PlayerPrefs.GetInt("level").ToString() + " is too low"; infoTextShadow.text = infoText.text; } else { ScoreBoard.SetActive(false); Application.LoadLevel("StraightBarDibs"); } break; case "pullovers_text": if (PlayerPrefs.GetInt("level") < 3) { ScoreBoard.SetActive(false); infoText.text = "Your Level " + PlayerPrefs.GetInt("level").ToString() + " is too low"; infoTextShadow.text = infoText.text; } else { ScoreBoard.SetActive(false); Application.LoadLevel("PullOvers"); } break; } } } }
public ActionResult <bool> ChangeLevel(ChangeLevel level) { LogContent = "改变隐患等级,参数源:" + JsonConvert.SerializeObject(level); return(ctrbll.ChangeLevel(level)); }
private void DownloadAndSaveCourses(ChangeLevel level) { if (_facAct.Attributes["value"]?.Value == null || _townAct?.Attributes["value"]?.Value == null || _studyTypeAct?.Attributes["value"]?.Value == null || _studyYearAct?.Attributes["value"]?.Value == null || _fieldOfStudyAct?.Attributes["value"]?.Value == null || _fieldOfStudyDetailedAct?.Attributes["value"]?.Value == null) { return; } Debug.WriteLine($"{_facAct}, {_townAct}, {_studyTypeAct}, {_studyYearAct}, {_fieldOfStudyAct}, {_fieldOfStudyDetailedAct}, {level.ToString()}"); var json = DownloadJson( _facAct.Attributes["value"].Value, _townAct.Attributes["value"].Value, _studyTypeAct.Attributes["value"].Value, _studyYearAct.Attributes["value"].Value, _fieldOfStudyAct.Attributes["value"].Value, _fieldOfStudyDetailedAct.Attributes["value"].Value, ((int)level).ToString()); var deserialized = JObject.Parse(json); if (deserialized["msg"] != null) { return; } var tab = ConvertJsonToHtmlNode(deserialized["plany"].ToString()); ParseAndSaveCourses(tab.ChildNodes["table"]); switch (level) { case ChangeLevel.FromDetailedFieldOfStudy: break; case ChangeLevel.FromFieldOfStudy: _selectFieldOfStudyDetailed = ConvertJsonToHtmlNode(deserialized["z"].ToString()); break; case ChangeLevel.FromStudyYear: _selectFieldOfStudyDetailed = ConvertJsonToHtmlNode(deserialized["z"].ToString()); _selectFieldOfStudy = ConvertJsonToHtmlNode(deserialized["o"].ToString()); break; case ChangeLevel.FromStudyType: _selectFieldOfStudyDetailed = ConvertJsonToHtmlNode(deserialized["z"].ToString()); _selectFieldOfStudy = ConvertJsonToHtmlNode(deserialized["o"].ToString()); _selectStudyYear = ConvertJsonToHtmlNode(deserialized["r"].ToString()); break; case ChangeLevel.FromTown: _selectFieldOfStudyDetailed = ConvertJsonToHtmlNode(deserialized["z"].ToString()); _selectFieldOfStudy = ConvertJsonToHtmlNode(deserialized["o"].ToString()); _selectStudyYear = ConvertJsonToHtmlNode(deserialized["r"].ToString()); _selectStudyType = ConvertJsonToHtmlNode(deserialized["m"].ToString()); break; case ChangeLevel.FromFaculty: _selectFieldOfStudyDetailed = ConvertJsonToHtmlNode(deserialized["z"].ToString()); _selectFieldOfStudy = ConvertJsonToHtmlNode(deserialized["o"].ToString()); _selectStudyYear = ConvertJsonToHtmlNode(deserialized["r"].ToString()); _selectStudyType = ConvertJsonToHtmlNode(deserialized["m"].ToString()); _selectTown = ConvertJsonToHtmlNode(deserialized["t"].ToString()); break; } }
public void QuitGame() { _currentLevelState.CalculateFinalScore(_currentGameOptions); EndGame(); ChangeLevel.LoadLevel("ScoreLevel"); }
void Update() { if (Input.GetButtonDown("Cancel")) { #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #elif UNITY_WEBPLAYER Application.OpenURL(webplayerQuitURL); #else Application.Quit(); #endif } playerController PC = gameObject.GetComponent <playerController>(); if (Input.GetButtonDown("Interact") && !PC.isMoving) { GameObject doorOpen = InRangeOfInteract("Door"); GameObject Stairs = InRangeOfInteract("Stairs"); GameObject Ladder = InRangeOfInteract("Ladder"); GameObject Sign = InRangeOfInteract("Sign"); if (Ladder != null) { GameObject[] enemyCount = GameObject.FindGameObjectsWithTag("Enemies"); //Checks if all enemies are killed before going to next level. if (enemyCount.Length == 0) { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); } else { Debug.Log("Need this many enemies to kill: " + enemyCount.Length); } } else if (Stairs != null) { ChangeLevel levelChange = Stairs.GetComponent <ChangeLevel>(); HealthScript HS = gameObject.GetComponent <HealthScript>(); Transform newArea = levelChange.areaLocation.GetChild("Location").transform; gameObject.transform.position = new Vector3(newArea.position.x + 1, newArea.position.y + 0.1f, newArea.position.z); HS.respawnPoint = gameObject.transform.position; Stairs = null; } else if (doorOpen != null) { if (doorOpen.GetChild("Door Closed").activeSelf) //ef hurðin er lokuð { doorOpen.GetChild("Door Closed").SetActive(false); // setur lokuðu hurðina sem ekki active doorOpen.GetChild("Door Open").SetActive(true); // setur opnuðu hurðina sem active } else if (!doorOpen.GetChild("Door Closed").activeSelf) // ef hurðin er opin { doorOpen.GetChild("Door Open").SetActive(false); // setur opnuðu hurðina sem ekki active doorOpen.GetChild("Door Closed").SetActive(true); // setur lokuðu hurðina sem active } } else if (Sign != null) { if (!Sign.GetChild("SignCanvas").activeInHierarchy) { Sign.GetChild("SignCanvas").SetActive(true); } else { Sign.GetChild("SignCanvas").SetActive(false); } } } }
// Update is called once per frame void Update() { RaycastHit2D hit2 = Physics2D.Raycast(transform.position, -Vector2.up); double disY = transform.position.y - hit2.transform.position.y; if (Input.GetKeyDown(KeyCode.Mouse0)) { Ray R = MainCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(R, out hit, 100)) { if (hit.collider.name == "PlayerMover") { if (PlayerPrefs.GetInt("energy") > 0) { infoText.text = ""; infoTextShadow.text = infoText.text; // Decrease Player energy switch (PlayerPrefs.GetInt("level")) { case 1: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.14f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.34f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.29f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.14f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 55); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 60); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 105); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 85); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 95); PlayerPrefs.Save(); break; } break; case 2: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.16f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.36f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.31f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.16f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 50); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 55); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 100); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 80); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 90); PlayerPrefs.Save(); break; } break; case 3: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.18f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.38f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.33f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.18f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 45); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 50); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 95); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 75); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 85); PlayerPrefs.Save(); break; } break; case 4: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.20f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.4f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.35f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.2f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 40); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 45); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 90); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 70); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 80); PlayerPrefs.Save(); break; } break; case 5: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.22f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.42f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.37f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.22f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 35); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 75); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 85); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 65); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 75); PlayerPrefs.Save(); break; } break; case 6: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.24f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.44f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.39f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.24f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 30); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 70); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 80); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 60); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 70); PlayerPrefs.Save(); break; } break; case 7: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.24f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.46f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.41f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.26f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 25); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 65); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 75); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 55); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 65); PlayerPrefs.Save(); break; } break; case 8: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.28f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.48f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.43f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.28f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 20); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 60); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 70); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 50); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 60); PlayerPrefs.Save(); break; } break; case 9: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.30f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.50f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.45f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.30f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 15); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 55); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 65); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 45); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 55); PlayerPrefs.Save(); break; } break; case 10: if (PlayerPrefs.GetInt("bmi") < 18.5) { playerUpwardsForce = 0.32f; } else if (PlayerPrefs.GetInt("bmi") > 18.5) { playerUpwardsForce = 0.52f; } else if (PlayerPrefs.GetInt("bmi") > 24.9) { playerUpwardsForce = 0.47f; } else if (PlayerPrefs.GetInt("bmi") > 29.9) { playerUpwardsForce = 0.32f; } switch (Application.loadedLevelName) { case "PullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 10); PlayerPrefs.Save(); break; case "ClappingPullUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 50); PlayerPrefs.Save(); break; case "MuscleUps": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 60); PlayerPrefs.Save(); break; case "StraightBarDibs": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 40); PlayerPrefs.Save(); break; case "PullOvers": PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") - 50); PlayerPrefs.Save(); break; } break; } Tapper.SetActive(false); switch (Application.loadedLevelName) { case "PullUps": if (disY > 1.5 && disY < 3.2) { rigidbody2D.AddForce(new Vector2(0, playerUpwardsForce * 100)); } break; case "ClappingPullUps": if (disY > 1.5 && disY < 3.2) { rigidbody2D.AddForce(new Vector2(0, playerUpwardsForce * 100)); } break; case "MuscleUps": if (disY > 2.5 && disY < 4.2) { rigidbody2D.AddForce(new Vector2(0, playerUpwardsForce * 100)); } break; case "StraightBarDibs": if (disY > 3.3) { rigidbody2D.AddForce(new Vector2(0, -playerUpwardsForce * 100)); } break; case "PullOvers": if (disY > 1.5 && disY < 4.2) { rigidbody2D.AddForce(new Vector2(0, playerUpwardsForce * 100)); } break; } //to give punch scale effect //iTween.PunchScale(gameObject, iTween.Hash("amount", new Vector3(0.06f, 0.06f, 0), "time", 1.7f, "easetype", iTween.EaseType.linear)); SoundController.Static.PlayBallUp(); //to play ball tap sound. } else { infoText.text = "Your energy too low\n Eat or Pass 1 day"; infoTextShadow.text = infoText.text; } } else if (hit.collider.name == "main_menu_button") { Application.LoadLevel("MainMenu"); } else if (hit.collider.name == "pass_day_button") { PlayerPrefs.SetInt("day", PlayerPrefs.GetInt("day") + 1); PlayerPrefs.SetInt("energy", 3000); PlayerPrefs.Save(); } else if (hit.collider.name == "eat_button") { if (PlayerPrefs.GetInt("dayLimit") == PlayerPrefs.GetInt("day")) { infoText.text = "Your already ate today"; infoTextShadow.text = infoText.text; } else { PlayerPrefs.SetInt("energy", PlayerPrefs.GetInt("energy") + 300); PlayerPrefs.SetInt("dayLimit", PlayerPrefs.GetInt("day")); PlayerPrefs.Save(); } } else if (hit.collider.name == "change_level_button") { Tapper.SetActive(false); Information.SetActive(false); ChangeLevel.transform.localScale = Vector3.zero; ChangeLevel.SetActive(true); iTween.ScaleTo(ChangeLevel, iTween.Hash("scale", Vector3.one, "time", 1.5f, "easetype", iTween.EaseType.easeOutSine, "delay", 0.0f)); //scoreTextMesh.renderer.enabled = true; //ScoreShadowTextMesh.renderer.enabled = false; } else if (hit.collider.name == "tricks_list_button") { Tapper.SetActive(false); Information.SetActive(false); ScoreBoard.transform.localScale = Vector3.zero; ScoreBoard.SetActive(true); iTween.ScaleTo(ScoreBoard, iTween.Hash("scale", Vector3.one, "time", 1.5f, "easetype", iTween.EaseType.easeOutSine, "delay", 0.0f)); //scoreTextMesh.renderer.enabled = true; //ScoreShadowTextMesh.renderer.enabled = false; } } } if (PlayerPrefs.GetInt("energy") > 0) { switch (Application.loadedLevelName) { case "PullUps": if (hit2.collider != null) { if (disY > 3) { if (Input.touchCount > 0) { Touch touch = Input.touches[0]; switch (touch.phase) { case TouchPhase.Began: startPos = touch.position; break; case TouchPhase.Ended: float swipeDistVertical = (new Vector3(0, touch.position.y, 0) - new Vector3(0, startPos.y, 0)).magnitude; if (swipeDistVertical > 100) { float swipeValue = Mathf.Sign(touch.position.y - startPos.y); //up swipe if (swipeValue > 0) { rigidbody2D.AddForce(new Vector2(0, playerUpwardsForce * 400)); } //down swipe } break; } } } } break; case "ClappingPullUps": if (hit2.collider != null) { if (disY > 1.5) { if (Input.touchCount > 0) { Touch touch = Input.touches[0]; switch (touch.phase) { case TouchPhase.Began: startPos = touch.position; break; case TouchPhase.Ended: float swipeDistHorizontal = (new Vector3(touch.position.x, 0, 0) - new Vector3(startPos.x, 0, 0)).magnitude; if (swipeDistHorizontal > 50) { float swipeValue = Mathf.Sign(touch.position.x - startPos.x); //right swipe if (swipeValue > 0) { rigidbody2D.AddForce(new Vector2(0, playerUpwardsForce * 400)); } } break; } } } } break; case "MuscleUps": if (hit2.collider != null) { if (disY > 3) { if (Input.touchCount > 0) { Touch touch = Input.touches[0]; switch (touch.phase) { case TouchPhase.Began: startPos = touch.position; break; case TouchPhase.Ended: float swipeDistVertical = (new Vector3(0, touch.position.y, 0) - new Vector3(0, startPos.y, 0)).magnitude; if (swipeDistVertical > 100) { float swipeValue = Mathf.Sign(touch.position.y - startPos.y); //up swipe if (swipeValue > 0) { rigidbody2D.AddForce(new Vector2(0, playerUpwardsForce * 400)); } //down swipe } break; } } } } break; case "StraightBarDibs": if (hit2.collider != null) { if (disY < 3.4) { if (Input.touchCount > 0) { Touch touch = Input.touches[0]; switch (touch.phase) { case TouchPhase.Began: startPos = touch.position; break; case TouchPhase.Ended: float swipeDistVertical = (new Vector3(0, touch.position.y, 0) - new Vector3(0, startPos.y, 0)).magnitude; if (swipeDistVertical > 50) { float swipeValue = Mathf.Sign(touch.position.y - startPos.y); //down swipe if (swipeValue < 0) { rigidbody2D.AddForce(new Vector2(0, -playerUpwardsForce * 400)); } } break; } } } } break; case "PullOvers": if (hit2.collider != null) { if (disY > 4.4) { if (Input.touchCount > 0) { Touch touch = Input.touches[0]; switch (touch.phase) { case TouchPhase.Began: startPos = touch.position; break; case TouchPhase.Ended: float swipeDistVertical = (new Vector3(0, touch.position.y, 0) - new Vector3(0, startPos.y, 0)).magnitude; if (swipeDistVertical > 100) { float swipeValue = Mathf.Sign(touch.position.y - startPos.y); //up swipe if (swipeValue > 0) { rigidbody2D.AddForce(new Vector2(0, playerUpwardsForce * 400)); } } break; } } } } break; } } }
public Compatibility(ChangeLevel level,string message) { this.ChangeLevel = level; this.Message = message; }
public void OnClickPlayAgain() { SceneManager.LoadScene(ChangeLevel.GetCurrentLevelPath()); }
public Compatibility(ChangeLevel level) : this(level, string.Empty) { }
public Compatibility(ChangeLevel level, string message) { this.ChangeLevel = level; this.Message = message; }
void Awake() { Instance = this; }