Пример #1
0
    void FireRightMissile()
    {
        if (ammoManager2.rightAmmo > 0)
        {
            if (Input.GetButtonDown("p2Fire1"))
            {
                Rigidbody missileInstance;
                missileInstance = Instantiate(missilePrefab2, rightCannonTop2.position, rightCannonTop2.rotation) as Rigidbody;
                missileInstance.AddForce(rightCannonTop2.forward * 3000);

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

                playMissileClicker2.rightPlayerFire = false;
            }
            if ((Input.GetButtonDown("p2Fire1")) || Input.GetButtonDown("p2Fire2") && mouseClicked2 == false)
            {
                mouseClicked2 = true;
                mousePos2     = Input.mousePosition;
            }
            if ((Input.GetButtonUp("p2Fire1")) || Input.GetButtonUp("p2Fire2") && mouseClicked2 == true)
            {
                mouseClicked2 = false;
            }
        }
        else
        {
            return;
        }
    }