Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (joybutton.GetPressed() && this.gameObject.name == "Banana2")
        {
            transform.position = player2.transform.position + new Vector3(0f, 0f, 2f);
            rb.velocity       += new Vector3(0, 0, 3f) * speed;
            joybutton.Hide();
        }
        if (computerAgent.isArmed() && this.gameObject.name == "Banana1")
        {
            transform.position = player1.transform.position - new Vector3(0f, 0f, 2f);
            rb.velocity       -= new Vector3(0, 0, 3f) * speed;
            computerAgent.CantShoot();
        }

        if (Math.Abs(transform.position.z) > 12)
        {
            rb.velocity        = oldVelocity;
            transform.position = new Vector3(5000f, 5000f, 5000f);
        }
    }