Esempio n. 1
0
    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");
        }
    }
Esempio n. 2
0
 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");
        }
    }
Esempio n. 4
0
 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);
 }
Esempio n. 5
0
 // Update is called once per frame
 void Update()
 {
     if (health <= 0)
     {
         Soundmanagerscript.PlaySound("EDie");
         Destroy(this.gameObject);
     }
 }
Esempio n. 6
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Enemy")
     {
         PlayerPrefs.SetInt("Coin", PlayerPrefs.GetInt("Coin") - 1);
         Soundmanagerscript.PlaySound("Death");
         Soundmanagerscript.PlaySound("Drop");
     }
 }
Esempio n. 7
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Bat")
     {
         //when the player runs into an enemy reduce the players health
         health--;
         Soundmanagerscript.PlaySound("EHurt");
     }
 }
Esempio n. 8
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Enemy")
     {
         //when the player runs into an enemy reduce the players health
         health++;
         Soundmanagerscript.PlaySound("attack");
     }
 }
Esempio n. 9
0
 // 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");
     }
 }
Esempio n. 10
0
 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");
     }
 }
Esempio n. 11
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Coin"))
        {
            PlayerPrefs.SetInt("Coin", PlayerPrefs.GetInt("Coin") + 1);
            Soundmanagerscript.PlaySound("Coin");


            Debug.Log("Coin");
        }
    }
Esempio n. 12
0
    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);
        }
    }
Esempio n. 13
0
    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");
        }
    }
Esempio n. 14
0
    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");
        }
    }
Esempio n. 15
0
    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);
        }
    }
Esempio n. 16
0
    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");
        }
    }
Esempio n. 17
0
 public void InventoryOut()
 {
     inventoryAnim.Play("InventorySlideOut");
     Soundmanagerscript.PlaySound("exit");
 }
Esempio n. 18
0
 public void InventoryIn()
 {
     inventoryAnim.enabled = true;
     inventoryAnim.Play("InventorySlideIn");
     Soundmanagerscript.PlaySound("Select");
 }
Esempio n. 19
0
 public void TeamOut()
 {
     teamAnim.Play("TeamSlideOut");
     Soundmanagerscript.PlaySound("exit");
 }