Exemplo n.º 1
0
    void FireMiddleMissile()
    {
        if (ammoManager2.middleAmmo > 0)
        {
            if (Input.GetButtonDown("p2Fire1"))
            {
                Debug.Log("test");
                Rigidbody missileInstance;
                missileInstance = Instantiate(missilePrefab2, middleCannonTop2.position, middleCannonTop2.rotation) as Rigidbody;
                missileInstance.AddForce(middleCannonTop2.forward * 3000);

                ammoManager2.MiddleMissile();
                playMissileClicker2.middlePlayerFire = false;
            }
            else if (Input.GetButtonDown("p2Fire2"))
            {
                Rigidbody scattershotInstance;
                scattershotInstance = Instantiate(scatterMissile2, midScatterLauncher2.position, midScatterLauncher2.rotation) as Rigidbody;
                scattershotInstance.AddForce(midScatterLauncher2.forward * 3000);

                playMissileClicker2.middlePlayerFire = false;
            }
            else if (Input.GetMouseButtonDown(2))
            {
            }
            if ((Input.GetButtonDown("p2Fire1")) || Input.GetButtonDown("p2Fire2") && mouseClicked2 == false)
            {
                Debug.Log("test");
                mouseClicked2 = true;
                mousePos2     = Input.mousePosition;
            }
            if ((Input.GetButtonUp("p2Fire1")) || Input.GetButtonUp("p2Fire2") && mouseClicked2 == true)
            {
                Debug.Log("test");
                mouseClicked2 = false;
            }
        }

        else
        {
            return;
        }
    }