void Update() { if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1)) { GameObject projectile = Instantiate(prefab) as GameObject; projectile.transform.position = transform.position + Camera.main.transform.forward * 2; Rigidbody rb = projectile.GetComponent <Rigidbody>(); rb.velocity = Camera.main.transform.forward * 20; } if (Input.GetMouseButtonDown(0)) { Soundmanagerscript.PlaySound("Whiff1"); } if (Input.GetMouseButtonDown(1)) { Soundmanagerscript.PlaySound("Whiff2"); } if (Input.GetKeyDown("space")) { Soundmanagerscript.PlaySound("Hop"); } if (Input.GetKeyDown(KeyCode.LeftShift)) { Soundmanagerscript.PlaySound("Halt"); } if (Input.GetKeyDown("w")) { Soundmanagerscript.PlaySound("Run"); } }
public void TeamIn() { Debug.Log(gameObject.name); teamAnim.enabled = true; teamAnim.Play("TeamSlideIn"); Soundmanagerscript.PlaySound("Select"); }
void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("HP")) { PlayerPrefs.SetInt("Health", PlayerPrefs.GetInt("Health") + 1); Soundmanagerscript.PlaySound("NHP"); } if (other.gameObject.CompareTag("Coin")) { PlayerPrefs.SetInt("Coin", PlayerPrefs.GetInt("Coin") + 1); Soundmanagerscript.PlaySound("Coin"); } if (other.gameObject.CompareTag("Enemy")) { PlayerPrefs.SetInt("Health", PlayerPrefs.GetInt("Health") - 1); Soundmanagerscript.PlaySound("NHurt"); } if (other.gameObject.CompareTag("KILL")) { PlayerPrefs.SetInt("Health", PlayerPrefs.GetInt("Health") - 15); Soundmanagerscript.PlaySound("NHurt"); } }
private void Dead() { PlayerPrefs.SetInt("Coin", PlayerPrefs.GetInt("Coin") + 10); Soundmanagerscript.PlaySound("Coin"); Instantiate(deathEffect, gameObject.transform.position, transform.rotation); Debug.Log("Bird has been Killed"); Destroy(gameObject); }
// Update is called once per frame void Update() { if (health <= 0) { Soundmanagerscript.PlaySound("EDie"); Destroy(this.gameObject); } }
void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Enemy") { PlayerPrefs.SetInt("Coin", PlayerPrefs.GetInt("Coin") - 1); Soundmanagerscript.PlaySound("Death"); Soundmanagerscript.PlaySound("Drop"); } }
void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Bat") { //when the player runs into an enemy reduce the players health health--; Soundmanagerscript.PlaySound("EHurt"); } }
void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Enemy") { //when the player runs into an enemy reduce the players health health++; Soundmanagerscript.PlaySound("attack"); } }
// Update is called once per frame void Update() { if (PlayerPrefs.GetInt("Health") <= 0) { Soundmanagerscript.PlaySound("Death"); //reload the scene Scene scene = SceneManager.GetActiveScene(); SceneManager.LoadScene("Testz"); } }
public void InPen() { if (on == true) { on = false; Instantiate(effect, gameObject.transform.position, effect.transform.rotation); Debug.Log("InPen"); PlayerPrefs.SetInt("Coin", PlayerPrefs.GetInt("Coin") + 20); Soundmanagerscript.PlaySound("Coin"); } }
void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Coin")) { PlayerPrefs.SetInt("Coin", PlayerPrefs.GetInt("Coin") + 1); Soundmanagerscript.PlaySound("Coin"); Debug.Log("Coin"); } }
public GameObject destroyedVersion; // Reference to the shattered version of the object // If the player clicks on the object void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Fist" || collision.gameObject.tag == "bullet") { Soundmanagerscript.PlaySound("Glass"); // Spawn a shattered object Instantiate(destroyedVersion, transform.position, transform.rotation); // Remove the current object Destroy(gameObject); } }
void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Bat") { PlayerPrefs.SetInt("Healthe", PlayerPrefs.GetInt("Healthe") - 5); Soundmanagerscript.PlaySound("PHurt"); } if (collision.gameObject.tag == "Glove") { PlayerPrefs.SetInt("Healthe", PlayerPrefs.GetInt("Healthe") - 2); Soundmanagerscript.PlaySound("punch"); } }
void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Enemy") { PlayerPrefs.SetInt("Health", PlayerPrefs.GetInt("Health") - 1); Soundmanagerscript.PlaySound("NHurt"); } if (collision.gameObject.tag == "lazer") { PlayerPrefs.SetInt("Health", PlayerPrefs.GetInt("Health") - 1); //Soundmanagerscript.PlaySound("Hurt"); } }
void OnCollisionEnter(Collision collision) { // force is how forcefully we will push the player away from the enemy. //float force = 3; if (collision.gameObject.tag == "Fist") { //when the player runs into an enemy reduce the players health health--; Soundmanagerscript.PlaySound("Hit"); // Calculate Angle Between the collision point and the player // Vector3 dir = collision.contacts[0].point - transform.position; // We then get the opposite (-Vector3) and normalize it // dir = -dir.normalized; // And finally we add force in the direction of dir and multiply it by force. // This will push back the player // GetComponent<Rigidbody>().AddForce(dir * force); } }
void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Enemy") { PlayerPrefs.SetInt("Health", PlayerPrefs.GetInt("Health") - 1); Soundmanagerscript.PlaySound("PHurt"); } if (collision.gameObject.tag == "lazer") { PlayerPrefs.SetInt("Health", PlayerPrefs.GetInt("Health") - 1); //Soundmanagerscript.PlaySound("Hurt"); } if (collision.gameObject.tag == "END") { Scene scene = SceneManager.GetActiveScene(); SceneManager.LoadScene("Tutorial"); } }
public void InventoryOut() { inventoryAnim.Play("InventorySlideOut"); Soundmanagerscript.PlaySound("exit"); }
public void InventoryIn() { inventoryAnim.enabled = true; inventoryAnim.Play("InventorySlideIn"); Soundmanagerscript.PlaySound("Select"); }
public void TeamOut() { teamAnim.Play("TeamSlideOut"); Soundmanagerscript.PlaySound("exit"); }