/// <summary> /// Ha a scene beépített indexe eltér a főmenű indexétől, /// betölti a mentést, más esetben elmenti a slot számot késöbbi művelethez /// </summary> public void LoadGame(int slot) { if (currentScene != 0) { SaveLoadScript.Load(slot); } else { saveslot = slot; } }
void OnCollisionEnter2D(Collision2D collision) { EnemyScript enemy = collision.gameObject.GetComponent <EnemyScript> (); if (enemy != null) { if (GetComponent <Rigidbody2D>().gravityScale <= 0) { if (!Helper.gameOver && !Helper.isGamePaused) { Handheld.Vibrate(); } //Destroy (transform.gameObject); if (!isShieldPresent) { if (enemy.roundedRestSeconds > SaveLoadScript.Load()) { best_score = enemy.roundedRestSeconds; SaveLoadScript.Save(enemy.roundedRestSeconds); } else { best_score = SaveLoadScript.Load(); } MainMenu.current_score = enemy.roundedRestSeconds; if (isMusicPlaying()) { stopMusic(); } if (sound_option == 1 && !Helper.gameOver) // && rigidbody2D.gravityScale <= 0) { playDeathSound(); } //rigidbody2D.gravityScale = 20f;//raj //rigidbody2D.fixedAngle = false;//raj //stopGeneratingBubbles(); //displayAdsBanner(); //Helper.gameOver = true; bloodTransform = Instantiate(blood_Prefab) as Transform; bloodTransform.position = transform.position; gameOver(); } } //transform.GetComponent <SpriteRenderer>().sprite = sprite_cry; //rigidbody2D.gravityScale = 20f; //rigidbody2D.fixedAngle = false; } }
private Animator anim; //Animátor void Awake() { //A rigidbody felvétele, és a karakter nézési irányának megadása (kezdéskor jobbra néz) rb = GetComponent <Rigidbody>(); facingRight = true; if (LoadMenu.saveslot != 0) { SaveLoadScript.Load(LoadMenu.saveslot); //Mentés betöltése (ha kell) LoadMenu.saveslot = 0; } else if (LoadMenu.saveslot == 0) { DialogueManager.prologue = false; //Új játék kezdésénél, legyen prológus } }
void Start() { displaygameOverPopup = false; original_radius = gameObject.GetComponent <CircleCollider2D> ().radius; original_scale = transform.localScale; upperLimit_scale_x = original_scale.x + 0.5f; lowerLimit_scale_x = original_scale.x - 0.5f; label_score.fontSize = Mathf.FloorToInt((label_score.fontSize * Screen.dpi) / 360); label_scoreBest.fontSize = Mathf.FloorToInt((label_scoreBest.fontSize * Screen.dpi) / 340); sound_option = SaveLoadScript.Load_sound(); if (sound_option == 0) { sound_on_off = sound_off; BGSound.loop = false; if (isMusicPlaying()) { BGSound.Stop(); } } else { sound_on_off = sound_on; BGSound.loop = true; if (!isMusicPlaying()) { BGSound.Play(); } } var_bubble_generation_time = bubble_generation_time; var_player_power_hold_time = player_power_hold_time; var_player_shield_hold_time = player_shield_hold_time; Helper.show_power_time = false; Invoke("startGeneratingBubbles", bubble_Init_generation_time - bubble_generation_time); Debug.Log("Data saved: " + SaveLoadScript.Load()); noOfgamePlays = SaveLoadScript.Load_no_of_game_plays(); noOfgamePlays += 1; #if UNITY_ANDROID //StartAppWrapper.loadAd (); #endif }
void Update() { Opossum.velocity = new Vector2(speed * direction, Opossum.velocity.y);// Opossum movement transform.localScale = new Vector3(-direction, Opossum.transform.localScale.y, Opossum.transform.localScale.z); //Saving Opossum position if (Input.GetKeyDown(KeyCode.R)) { SaveLoadScript.Save(this.gameObject, "Opossum"); } //Loading Opossum position if (Input.GetKeyDown(KeyCode.L)) { SaveLoadScript.Load(this.gameObject, "Opossum"); } }
void GenerateMap() { if (!MapProperties.isLoaded) { clearMap = new ClearMapGenerator(MapProperties.height, MapProperties.width, MapProperties.difficulty); clearMap.CreateMap(field); clearMap.CreateObstacles(obstacle); clearMap.CreateStartAndFinish(start, end); } else { SaveLoadScript.Load(); loadedMap = new LoadedMapGenerator(MapProperties.height, MapProperties.width); loadedMap.CreateMap(field); loadedMap.CreateObstacles(obstacle); loadedMap.CreateStartAndFinish(start, end); } }
void Update() { Eagle.velocity = new Vector2(speed * direction, Eagle.velocity.y);//Eagle movement transform.localScale = new Vector3(-direction, transform.localScale.y, transform.localScale.z); //Saving Eagle position if (Input.GetKeyDown(KeyCode.R)) { SaveLoadScript.Save(this.gameObject, "Eagle"); } //Loading Eagle position if (Input.GetKeyDown(KeyCode.L)) { SaveLoadScript.Load(this.gameObject, "Eagle"); } }
void Update() { if (Input.GetMouseButtonDown(2)) { open(); playerDataPath = "D:/" + path + ".db"; elementMaxSize = max(_texture.width, _texture.height) * 80 / 337; setDiagram(); findElement(); //cellSize = max(_texture.width / 12, _texture.height / 12); // playerDataPath = "D:/" + "SchemeFromPhotot" + ".db"; setCornersOnScheme(); setScheme(); setWires(); Save(); SaveLoadScript.playerDataPath = playerDataPath; SaveLoadScript.Load(); //setBorders(); } }
// Use this for initialization void Start() { //Debug.Log ("raj Internet: " + Application.internetReachability); //Debug.Log ("raj Font Size: " + style_label.fontSize); //Debug.Log ("raj Screen.dp: " + (style_label.fontSize * Screen.dpi)/ 320 ); style_label.fontSize = Mathf.FloorToInt((style_label.fontSize * Screen.dpi) / 320); inner_style_box.fontSize = Mathf.FloorToInt((inner_style_box.fontSize * Screen.dpi) / 320); style_popup_label.fontSize = Mathf.FloorToInt((style_popup_label.fontSize * Screen.dpi) / 320); style_popup_button.fontSize = Mathf.FloorToInt((style_popup_button.fontSize * Screen.dpi) / 320); Helper.gameOver = false; best_score = SaveLoadScript.Load(); score_value = getTimeInString(best_score); //background_player = (Texture)TextureScale.Bilinear ((Texture2D)background_player, Screen.width / 2, Screen.width / 2); current_score_value = getTimeInString(current_score); background_heading_x = x_offset; background_heading_y = y_offset; background_heading_w = Screen.width - (x_offset * 2); background_heading_h = Screen.height / 5; //(background_heading.height * background_heading_w) / background_heading.width;// background_heading_chase_x = x_offset; background_heading_chase_y = background_heading_y + background_heading_h; background_heading_chase_w = Screen.width / 2 + Screen.width / 6; background_heading_chase_h = ((background_heading_chase.height * background_heading_chase_w) / background_heading_chase.width) + 30; //Screen.width/8; background_player_x = x_offset; background_player_y = background_heading_chase_y + background_heading_chase_h + (2 * y_offset); //background_enemy_y + (background_enemy_h / 2); background_player_w = Screen.width / 2 - (x_offset * 2); background_player_h = Screen.width / 2 - (x_offset * 2); background_caption_x = Screen.width / 4; background_caption_y = background_heading_chase_y + background_heading_chase_h; background_caption_w = Screen.width / 2; background_caption_h = Screen.width / 8; background_enemy_w = Screen.width / 4; background_enemy_h = Screen.width / 4; background_enemy_x = Screen.width - background_enemy_w - x_offset; background_enemy_y = background_heading_chase_y + (background_heading_chase_h / 2); //background_heading_y + background_heading_h + y_offset; start_button_w = background_player_w * 0.75f; start_button_h = Screen.height / 12; start_button_x = background_player_x + (background_player_w - start_button_w) / 2; start_button_y = background_player_y + background_player_h + (y_offset * 3); score_box_x = Screen.width / 2 + x_offset; score_box_y = background_enemy_y + background_enemy_h + (y_offset * 2); score_box_w = Screen.width / 2 - (x_offset * 2); //score_box_h = style_label.fontSize * 2 + inner_style_box.fontSize * 2 + y_offset*2; bestScore_label_x = score_box_x + x_offset; bestScore_label_y = score_box_y + y_offset; bestScore_label_w = style_label.fontSize * score_label.Length; bestScore_label_h = style_label.fontSize + y_offset; bestScore_box_w = score_box_w * 0.75f; bestScore_box_h = inner_style_box.fontSize + 15; bestScore_box_x = score_box_x + (score_box_w - bestScore_box_w) / 2; bestScore_box_y = bestScore_label_y + bestScore_label_h + y_offset; currentScore_label_x = score_box_x + x_offset; currentScore_label_y = bestScore_box_y + bestScore_box_h + y_offset * 2; currentScore_label_w = style_label.fontSize * current_score_label.Length; currentScore_label_h = style_label.fontSize + y_offset; currentScore_box_w = score_box_w * 0.75f; currentScore_box_h = inner_style_box.fontSize + 15; currentScore_box_x = score_box_x + (score_box_w - currentScore_box_w) / 2; currentScore_box_y = currentScore_label_y + currentScore_label_h + y_offset; score_box_h = bestScore_label_h + bestScore_box_h + currentScore_label_h + currentScore_box_h + (y_offset * 7); challenge_button_x = score_box_x; challenge_button_y = score_box_y + score_box_h + (y_offset * 3); challenge_button_w = score_box_w; challenge_button_h = start_button_h; /*leaderboard_button_x = score_box_x; * leaderboard_button_y = challenge_button_y + challenge_button_h + y_offset; * leaderboard_button_w = score_box_w; * leaderboard_button_h = start_button_h;*/ leaderboard_button_x = x_offset; leaderboard_button_y = start_button_y + start_button_h + y_offset; leaderboard_button_w = background_player_w; leaderboard_button_h = start_button_h; popup_window_x = (Screen.width - Screen.width * 0.75f) / 2; popup_window_y = (Screen.height - Screen.height / 3) / 2; popup_window_w = Screen.width * 0.75f; popup_window_h = Screen.height / 4; popup_button_w = popup_window_w / 2; popup_button_h = style_popup_button.fontSize + y_offset; popup_button_x = (popup_window_w - popup_button_w) / 2; popup_button_y = popup_window_h - popup_button_h - 2 * y_offset; popup_label_x = x_offset; // + (popup_window_w/2); popup_label_y = y_offset * 2; popup_label_w = popup_window_w - (x_offset * 2); popup_label_h = popup_window_h - popup_button_h; /*#if UNITY_ANDROID * * StartAppWrapper.loadAd (); * * StartAppWrapper.addBanner ( * StartAppWrapper.BannerType.AUTOMATIC, * StartAppWrapper.BannerPosition.BOTTOM); * #endif*/ PlayGamesPlatform.Activate(); }
private void FixedUpdate() { // checking grounded parameter and invoking OnLandEvent bool wasGrounded = grounded; grounded = false; Collider2D[] colliders = Physics2D.OverlapCircleAll(GroundCheck.position, GroundRadius, WhatIsGround); for (int i = 0; i < colliders.Length; i++) { if (colliders[i].gameObject != gameObject) { grounded = true; if (!wasGrounded) { OnLandEvent.Invoke(); } } } //movement move = Input.GetAxis("Horizontal"); Hero.velocity = new Vector2(move * speed, Hero.velocity.y); animator.SetFloat("Speed", Mathf.Abs(move)); // Runing animation if ((Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.Space)) && grounded) { Hero.AddForce(new Vector2(0, jumpForce)); animator.SetBool("IsJumping", true); // Jumping animation Debug.Log(Time.fixedDeltaTime); } if (Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.DownArrow)) { animator.SetBool("IsCrouching", true); } if (Input.GetKeyUp(KeyCode.S) || Input.GetKeyUp(KeyCode.DownArrow)) { animator.SetBool("IsCrouching", false); } // Flipping sprite left or right if (move < 0 && FacingRight) { Flip(); } else if (move > 0 && !FacingRight) { Flip(); } //Quit from the game when Lives = 0 if (Lives == 0) { Application.Quit(); } // Saving if (Input.GetKeyDown(KeyCode.R)) { SaveLoadScript.Save(this.gameObject, "Hero"); PlayerPrefs.SetInt("Lives", Lives); PlayerPrefs.SetInt("Gems", Gems); } // Loading if (Input.GetKeyDown(KeyCode.L)) { SaveLoadScript.Load(this.gameObject, "Hero"); Gems = PlayerPrefs.GetInt("Gems"); Lives = PlayerPrefs.GetInt("Lives"); } }
void Awake() { SaveLoadScript.Load(); }