예제 #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");
        }
    }
예제 #2
0
 public void TeamIn()
 {
     Debug.Log(gameObject.name);
     teamAnim.enabled = true;
     teamAnim.Play("TeamSlideIn");
     Soundmanagerscript.PlaySound("Select");
 }
예제 #3
0
    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");
        }
    }
예제 #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);
 }
예제 #5
0
 // Update is called once per frame
 void Update()
 {
     if (health <= 0)
     {
         Soundmanagerscript.PlaySound("EDie");
         Destroy(this.gameObject);
     }
 }
예제 #6
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Enemy")
     {
         PlayerPrefs.SetInt("Coin", PlayerPrefs.GetInt("Coin") - 1);
         Soundmanagerscript.PlaySound("Death");
         Soundmanagerscript.PlaySound("Drop");
     }
 }
예제 #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");
     }
 }
예제 #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");
     }
 }
예제 #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");
     }
 }
예제 #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");
     }
 }
예제 #11
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Coin"))
        {
            PlayerPrefs.SetInt("Coin", PlayerPrefs.GetInt("Coin") + 1);
            Soundmanagerscript.PlaySound("Coin");


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