Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        //setting copyCount to the value of the count variable which is used in the player script to track the score of the player
        int copyCount = Player.count;



        //Let the player shrink when the buttons are pressed and the player has a score which is higher or equal 5. Afterwards, decreasing the score of the player by 5
        //the last part checks if the other shield is currently used
        if (KutiInput.GetKutiButtonDown(EKutiButton.P1_RIGHT) && KutiInput.GetKutiButtonDown(EKutiButton.P2_RIGHT) && copyCount >= 5 && shield_anim == false)
        {
            //checking if the cooldown is already over
            if (Time.time > shrinkStart + shrinkCooldown)
            {
                anim.Play("Shrink");
                Player.count = Player.count - 5;
                shrinkStart  = Time.time;
            }
        }

        //Let the player spawn a shield when the buttons are pressed and the player has a score which is higher or equal 5. Afterwards, decreasing the score of the player by 5
        //the last part checks if the other shrink is currently used
        if (KutiInput.GetKutiButtonDown(EKutiButton.P1_LEFT) && KutiInput.GetKutiButtonDown(EKutiButton.P2_LEFT) && copyCount >= 5 && shrink_anim == false)
        {
            //checking if the cooldown is already over
            if (Time.time > shieldStart + shieldCooldown)
            {
                anim.Play("Shield");
                Player.count = Player.count - 5;
                shieldStart  = Time.time;
            }
        }
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    void FixedUpdate()
    {
        //Update the currently displayed count by calling the SetCountText function.
        SetScoreText();



        //Move upwards
        if (KutiInput.GetKutiButtonDown(EKutiButton.P1_MID))
        {
            GetComponent <Rigidbody2D>().velocity = Vector2.zero;
            GetComponent <Rigidbody2D>().AddForce(jumpForce);
        }
        //Move down(upwards for Player 2 on a KUTI)
        if (KutiInput.GetKutiButtonDown(EKutiButton.P2_MID))
        {
            GetComponent <Rigidbody2D>().velocity = Vector2.zero;
            GetComponent <Rigidbody2D>().AddForce(-jumpForce);
        }

        //Dying by touching the border of the screen
        if (Vector3.Distance(transform.position, upperBorderDeathSpot) < 0.65f | Vector3.Distance(transform.position, bottomBorderDeathSpot) < 0.65f)
        {
            FindObjectOfType <AudioManager>().Play("Death");
            Die();
        }
    }
Ejemplo n.º 3
0
 // Update is called once per frame
 void Update()
 {
     //Press any Button to start another round
     if (KutiInput.GetKutiButtonDown(EKutiButton.P1_MID) | KutiInput.GetKutiButtonDown(EKutiButton.P2_MID) | KutiInput.GetKutiButtonDown(EKutiButton.P1_LEFT) | KutiInput.GetKutiButtonDown(EKutiButton.P2_LEFT) | KutiInput.GetKutiButtonDown(EKutiButton.P1_RIGHT) | KutiInput.GetKutiButtonDown(EKutiButton.P2_RIGHT))
     {
         SceneManager.LoadScene("FlappyUboot");
     }
     //hitting escape closes the game...for testing in Unity
     if (Input.GetKeyDown("escape"))
     {
         Application.Quit();
     }
 }