private void OnCollisionEnter2D(Collision2D collision) { if (destroy_now) { if (collision.gameObject.tag == "Top" || collision.gameObject.tag == "Block_Top") { Destroy(this.gameObject); } } if (collision.gameObject.tag == "Player") { audio_manager.Play("Player"); destroy_now = true; } if (collision.gameObject.tag == "Bottom") { if (Carry_Current_Score.current_score > 10) { audio_manager.Play("Decrease Score"); } score_ui_manager.Decrease_Score(10); Destroy(this.gameObject); } }
IEnumerator Wait_Before_Load_Yes_Button() { audio_manager.Play("Button"); scene_transition.SetBool("end_transition", true); yield return(new WaitForSeconds(1f)); SceneManager.LoadScene(14); }
IEnumerator Wait_Before_Load_Stats_Button() { audio_manager.Play("Button"); scene_transition.SetBool("end_transition", true); yield return(new WaitForSeconds(1f)); scene_loader.Load_Scene_By_Index(18); }
private void OnCollisionEnter2D(Collision2D collision) { if (this.gameObject.name == "A.I. Easy") { audio_manager.Play("A.I. 2"); } else { audio_manager.Play("A.I."); } }
public void On_Click_Next_Button() { audio_manager.Play("Button"); if (description_index == 0) { StartCoroutine(Play_Touch_Left()); } else if (description_index == 1) { StartCoroutine(Play_Right_Left()); } else if (description_index == 2) { StartCoroutine(Play_Level_Up()); } else if (description_index == 3) { StartCoroutine(Play_Game_Over()); } else if (description_index == 4) { StartCoroutine(Play_Above_Blocks()); } else if (description_index == 5) { StartCoroutine(Play_Below_Blocks()); } else if (description_index >= 6) { Next_Description(); } }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Player") { if (game_is_started == true) { audio_manager.Play("Player"); } } if (collision.gameObject.tag == "Block_Bottom") { //find better place for this line of code(if you can) // scene_transition.SetBool("level_start", false); if (Block.block_has_been_destroyed) { score_manager.Increase_Score(10); Block.block_has_been_destroyed = false; } } // Giving some randomness to the Ball Direction on collision. Apply_Random_Friction(); if (collision.gameObject.tag == "Player") { rb_ball.velocity = new Vector2((transform.position.x - player_pos.position.x) * 500f * Time.deltaTime, rb_ball.velocity.y); } if (collision.gameObject.tag == "Bottom") { if (Lifes > 1) { GameObject.Find("Life's").transform.Find("Canvas").transform.Find(Lifes.ToString()).gameObject.SetActive(false); Lifes--; if (Lifes == 1) { GameObject.Find("Play_Space").transform.Find("Bottom").GetComponent <BoxCollider2D>().isTrigger = true; } } } }
public void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("bullet")) { Destroy(other); scoreManager.AddScore(); print(scoreManager.currentScore); audioManager.Play("Destroy"); } }
void Pickup() { pickedUp = true; pickupeffect.Play(); CinemachineShake.Instance.ShakeCamera(5f, .1f); Audio_Manager.Play("PickUpComponent"); collectibleCount++; Destroy(gameObject); }
public void AddPiece(GameObject socketObject) { //nick's code parentScript.pieceRigidBody.isKinematic = true; parentScript.pieceRigidBody.useGravity = false; parentScript.pieceRigidBody.rotation = socketObject.GetComponent <ArmChecker>().connectionPosition.transform.rotation; parentScript.pieceRigidBody.position = socketObject.GetComponent <ArmChecker>().connectionPosition.transform.position; Audio_Manager.Play("Connection"); localManager.AddPieceToGlobalManager(socketObject); }
IEnumerator Spawn_Ball() { while (true) { forceY = UnityEngine.Random.Range(1000f, 5000f); yield return(new WaitForSeconds(spawn_time)); if (this.gameObject.name == "Barrel Left") { var ball_instance = Instantiate(ball_prefab, left_spawn_pos.position, Quaternion.identity) as GameObject; ball_instance.GetComponent <Rigidbody2D>().AddForce(new Vector2(forceY * 1.428f, forceY)); // here "1.428" is cot(57.2 degree's). audio_manager.Play("Falling Ball"); } else if (this.gameObject.name == "Barrel Right") { var ball_instance = Instantiate(ball_prefab, right_spawn_pos.position, Quaternion.identity) as GameObject; ball_instance.GetComponent <Rigidbody2D>().AddForce(new Vector2(-forceY * 0.644f, forceY)); // here "0.644" is cot(35 degree's). audio_manager.Play("Falling Ball"); } } }
public void AddPieceToGlobalManager(GameObject socketObject) { //tree stuff globalPartManager.AddPlayerPart(shape, color, socketObject, gameObject); //socket stuff SocketToggle(true); Audio_Manager.Play("Part_Connect"); //connect to object AddToModel(socketLaser.previousCollider.gameObject); }
private void Damage_Block() { // Hitting the block more and more until it breaks. Changing sprites to show the amount of damage block has taken. /* if (count_damage == 0) { * current_sprite.sprite = block_sprites[count_damage]; * count_damage++; * } * else if (count_damage == 1) { * current_sprite.sprite = block_sprites[count_damage]; * count_damage++; * } * else if (count_damage == 2) { * current_sprite.sprite = block_sprites[count_damage]; * count_damage++; * } * else if (count_damage == 3) { * current_sprite.sprite = block_sprites[count_damage]; * count_damage++; * } */ if (count_damage == 0) { audio_manager.Play("block_1"); current_sprite.sprite = block_sprites;// put "count_damage" here count_damage++; } else { audio_manager.Play("block_bottom_2"); level_4_game_mechanics.hit_detected_level4 = true; score_ui_manager.Increase_Score(15); Instantiate(partical_prefab, transform.position, Quaternion.identity); Destroy(this.gameObject); } }
private void Damage_Block() { if (count_damage == 0) { audio_manager.Play("block_1"); current_sprite.sprite = block_sprites[3]; count_damage++; } else { if (Scene_Loader.scene_index == 11) { audio_manager.Play("block_1"); } else { audio_manager.Play("block_top_2"); } if (Scene_Loader.scene_index == 6) { level_6_game_mechanics.hit_detected_level6 = true; } if (Scene_Loader.scene_index == 11) { score_ui_manager.Increase_Score(5); level_10_block_spawner.count_blocks--; } Instantiate(partical_prefab, transform.position, Quaternion.identity); Destroy(this.gameObject); } }
private void Damage_Block() { if (count_damage == 0) { audio_manager.Play("Level_10_block_1"); current_sprite.sprite = block_sprites[1]; // put "count_damage" here count_damage++; } else if (count_damage == 1) { audio_manager.Play("Level_10_block_1"); current_sprite.sprite = block_sprites[3]; count_damage++; } else if (count_damage == 2) { audio_manager.Play("Level_10_block_1"); current_sprite.sprite = block_sprites[4]; count_damage++; } else { audio_manager.Play("Level_10_block_2"); score_ui_manager.Increase_Score(20); level_10_game_mechanics.hit_detected_level10 = true; FindObjectOfType <Level_10_Spacial_block_spawn>().GetComponent <Level_10_Spacial_block_spawn>().is_destroyed = true; Instantiate(partical_prefab, transform.position, Quaternion.identity); Destroy(this.gameObject); } }
public void respawn() { cameraShake.Shake(camShakeAmt, camShakelng); explosion = Instantiate(explosion, transform.position, transform.rotation); audioManager.Play("Respawn"); disablespriteRenderer.enabled = false; disableboxCollider.enabled = false; disableShooting.enabled = false; foreach (ParticleSystem s in PlayerPS) { s.Stop(); } StartCoroutine(finishRespawn()); }
public void ButtonPress() { if (buttonDone) //how interact with apk { Audio_Manager.Play("Button"); thisAnimator.SetBool("Pressed", true); buttonDone = false; //maybe add a delay? partManager.NonCoreRemovePart(); partParent.transform.position = partParentLocation.transform.position; StartCoroutine(crateManager.CrateCycle()); //create parts is in crate manager as it manages the transition } //else play unsuccessful press sound }
private void OnTriggerEnter2D(Collider2D collision) { // If player collide with bullet then score will be reduced. if (collision.gameObject.tag == "Player") { if (Carry_Current_Score.current_score > 10) { audio_manager.Play("Decrease Score"); } FindObjectOfType <Score_UI_Manager>().GetComponent <Score_UI_Manager>().Decrease_Score(5); } if (collision.gameObject.tag != "Ball") { Destroy(this.gameObject); } }
private void Update() { if (isGrounded == true) { extraJumps = extraJumpsValue; } if (Input.GetKeyDown(KeyCode.UpArrow) && extraJumps > 0) { rb.velocity = Vector2.up * jumpforce; extraJumps--; } else if (Input.GetKeyDown(KeyCode.UpArrow) && extraJumps == 0 && isGrounded == true) { rb.velocity = Vector2.up * jumpforce; } if (Input.GetKeyDown(KeyCode.W) && extraJumps > 0) { rb.velocity = Vector2.up * jumpforce; extraJumps--; } else if (Input.GetKeyDown(KeyCode.W) && extraJumps == 0 && isGrounded == true) { rb.velocity = Vector2.up * jumpforce; } if (Input.GetKeyDown(KeyCode.Space) && extraJumps > 0) { rb.velocity = Vector2.up * jumpforce; extraJumps--; } else if (Input.GetKeyDown(KeyCode.Space) && extraJumps == 0 && isGrounded == true) { rb.velocity = Vector2.up * jumpforce; } if (Input.GetKeyDown(KeyCode.Space) && isGrounded == true) { audio_Manager.Play("Jump"); animator.SetTrigger("jump"); } if (Input.GetKeyDown(KeyCode.W) && isGrounded == true) { audio_Manager.Play("Jump"); animator.SetTrigger("jump"); } if (Input.GetKeyDown(KeyCode.UpArrow) && isGrounded == true) { audio_Manager.Play("Jump"); animator.SetTrigger("jump"); } if (extraJumps == 0) { doubleJumpUI.SetActive(false); } else { doubleJumpUI.SetActive(true); } }
public void On_Click_Resume_Button() { Time.timeScale = 1; audio_manager.Play("Button"); Pause_UI.SetActive(false); }
private void OnCollisionEnter2D(Collision2D collision) { audio_manager.Play("A.I."); }
void Shoot() { audio_Manager.Play("Shoot"); Instantiate(bulletPrefab, firepoint.position, firepoint.rotation); }
public void takeDamage(int damage) { Audio_Manager.Play("PlayerDeath"); currentHealth -= damage; }
private void Damage_Block() { // Hitting the block more and more until it breaks. Changing sprites to show the amount of damage block has taken. /* if (count_damage == 0) { * current_sprite.sprite = block_sprites[count_damage]; * count_damage++; * } * else if (count_damage == 1) { * current_sprite.sprite = block_sprites[count_damage]; * count_damage++; * } * else if (count_damage == 2) { * current_sprite.sprite = block_sprites[count_damage]; * count_damage++; * } * else if (count_damage == 3) { * current_sprite.sprite = block_sprites[count_damage]; * count_damage++; * } */ if (count_damage == 0) { audio_manager.Play("block_1"); current_sprite.sprite = block_sprites[3]; // put "count_damage" here count_damage++; } else { if (gameObject.tag == "Block_Top") { if (Scene_Loader.scene_index != 10) { audio_manager.Play("block_top_2"); } else { audio_manager.Play("block_1"); } } else { audio_manager.Play("block_bottom_2"); } // Finally, destroying the block. Reduce_Count(); Hit_Ditected(); // Related to Score UI system. if (this.gameObject.tag == "Block_Bottom") { block_has_been_destroyed = true; } Instantiate(partical_prefab, transform.position, Quaternion.identity); Destroy(this.gameObject); } }