void Update() { currentMoneyText.text = "$" + money; currentGoldText.text = "" + gold; SaveLoadScript.Save(); }
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; } }
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 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"); } }
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"); } }
public void SaveGame() { SaveLoadScript.Save(); BroadcastInfoPopUp("Successfully saved"); }
/// <summary> /// A játék mentése az adott slotra /// </summary> public void SaveGame(int slot) { SaveLoadScript.Save(slot); }
public void Save() { save.Save(); }