private void OnCollisionEnter(Collision collision) { WallBrick wall = collision.gameObject.GetComponent <WallBrick>(); if (wall != null) { wall.Destroy(); score = PlayerPrefs.GetInt("Score", 0); score = score + 1; PlayerPrefs.SetInt("Score", score); if (score == 1) { playGamesScript.FirstBlock(); } if (score > 49) { playGamesScript.SmashFiftyBlock(); } if (score > 99) { playGamesScript.SmashHundredBlock(); } if (score > 20000) { playGamesScript.Smesh(); } } DeathPlane die = collision.gameObject.GetComponent <DeathPlane>(); if (die != null) { adMobScript.GameOver(); die.gameOver(); } }
private float sincos45 = 1.0f; /*Mathf.Sqrt(2)/2.0f;*/ // Start is called before the first frame update void Start() { //time and velocity time = 0.0f; velY = 0.0f; velX = 0.0f; velZ = velMod; deathVel = 0.1f; speedUpVel = 0.1f; //components rb = gameObject.GetComponent <Rigidbody>(); rend = demon.GetComponent <Renderer>(); anim = body.gameObject.GetComponent <Animation>(); //animations anim["Correr_F"].speed = 30 * velZ; anim["Correr_L"].speed = 30 * velZ; anim["Correr_R"].speed = 30 * velZ; anim["Saltar"].speed = 40 * velZ; anim["Saltar_F"].speed = 10 * velZ; anim["Saltar_L"].speed = 10 * velZ; anim["Saltar_R"].speed = 10 * velZ; anim["Victoria_idle"].speed = 5; ChangeAnim("Correr_F"); //booleans grounded = false; dead = false; blinking = false; win = false; speedUpb = false; doubleJumpb = false; god = false; //timing blinkingFrames = 2; blinkingStart = 0; time = 0; //game objects particles.SetActive(false); speedParticles.SetActive(false); slowParticles.SetActive(false); doubleJumpImage.SetActive(false); //camera camScript = cam.GetComponent <Camera>(); //death plane deathPlaneScript = deathPlane.GetComponent <DeathPlane>(); //audio source = gameObject.GetComponent <AudioSource>(); //misc lives = 3; }
// Start is called before the first frame update void Start() { mesh = this.GetComponent <MeshRenderer>(); col = this.GetComponentInChildren <MeshCollider>(); destroyed = false; destroyTimer = 0; player1Score = 3; player2Score = 3; deathPlane = GameObject.Find("DeathPlane").GetComponent <DeathPlane>(); destroyLength = 200; }