void Update()
    {
        //if (fpsCam == null)
        //fpsCam = GameObject.Find("/CameraBase/GunCamera").GetComponent<Camera>();

        if (canShoot)
        {
            if (player == null)
            {
                player = GameObject.FindGameObjectWithTag("Player").GetComponent <MainController>();
            }

            //apuntar y disparar
            if (Input.GetButton("Fire1") && Input.GetButton("Fire2") && Time.time >= nextTimeToFire && munitionDose > 0)
            {
                //posicion jeringuilla en disparo
                //gameObject.transform.position = new Vector3(0.17f, -0.037f, -0.001f);
                //gameObject.transform.Rotate(48.991f, -183.5f, -349.5f, Space.Self);

                player.anim.Play("Gunplay");
                cameras.Point();
                Shooting();
            }
            //disparar
            else if (Input.GetButton("Fire1") && Time.time >= nextTimeToFire && munitionDose > 0)
            {
                //posicion jeringuilla en disparo
                //gameObject.transform.position = new Vector3(0.17f, -0.037f, -0.001f);
                //gameObject.transform.Rotate(48.991f, -183.5f, -349.5f, Space.Self);

                player.anim.Play("Gunplay");
                cameras.ThirdPersonPoint();
                Shooting();
            }
            //apuntar
            else if (Input.GetButton("Fire2"))
            {
                //posicion jeringuilla en disparo
                //gameObject.transform.position = new Vector3(0.17f, -0.037f, -0.001f);
                //gameObject.transform.Rotate(48.991f, -183.5f, -349.5f, Space.Self);

                player.anim.Play("Point");
                cameras.Point();
            }
            else
            {
                //volver jeringuilla a su transform
                //gameObject.transform.position = actualTransform.transform.position;
                //gameObject.transform.rotation = actualTransform.transform.rotation;
                cameras.Dispoint();
            }
        }
    }
示例#2
0
    void Update()
    {
        //if (fpsCam == null)
        //fpsCam = GameObject.Find("/CameraBase/GunCamera").GetComponent<Camera>();

        if (cameras == null)
        {
            cameras = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <changingCameras>();
        }

        if (ammoDisplay == null)
        {
            ammoDisplay      = GameManager.manager.interfaceDisplay.transform.GetChild(0).gameObject.GetComponent <Text>();
            ammoDisplay.text = GameManager.manager.munitionDose.ToString();
        }

        if (GameManager.manager != null)
        {
            if (GameManager.manager.munitionDose <= 0)
            {
                canShoot = false;
                player.gameObject.GetComponent <Health_and_Damage>().GameOver();
            }
        }

        if (canShoot)
        {
            //apuntar y disparar
            if (Input.GetButton("Fire1") && Input.GetButton("Fire2") && Time.time >= nextTimeToFire && GameManager.manager.munitionDose > 0)
            {
                //posicion jeringuilla en disparo
                //gameObject.transform.position = new Vector3(0.17f, -0.037f, -0.001f);
                //gameObject.transform.Rotate(48.991f, -183.5f, -349.5f, Space.Self);

                player.anim.Play("Gunplay");
                cameras.Point();
                Shooting();
            }
            //disparar
            else if (Input.GetButton("Fire1") && Time.time >= nextTimeToFire /**&& GameManager.manager.munitionDose > 0**/)
            {
                //posicion jeringuilla en disparo
                //gameObject.transform.position = new Vector3(0.17f, -0.037f, -0.001f);
                //gameObject.transform.Rotate(48.991f, -183.5f, -349.5f, Space.Self);

                player.anim.Play("Gunplay");
                cameras.ThirdPersonPoint();
                Shooting();
            }
            //apuntar
            else if (Input.GetButton("Fire2"))
            {
                //posicion jeringuilla en disparo
                //gameObject.transform.position = new Vector3(0.17f, -0.037f, -0.001f);
                //gameObject.transform.Rotate(48.991f, -183.5f, -349.5f, Space.Self);

                player.anim.Play("Point");
                cameras.Point();
            }
            else
            {
                //volver jeringuilla a su transform
                //gameObject.transform.position = actualTransform.transform.position;
                //gameObject.transform.rotation = actualTransform.transform.rotation;
                cameras.Dispoint();
            }
        }
    }