Esempio n. 1
0
        void FixedUpdate()
        {
            if (Player)
            {
                //get the Input from Horizontal axis
                float horizontalInput = Input.GetAxis("Horizontal");
                //get the Input from Vertical axis
                float verticalInput = Input.GetAxis("Vertical");
                //update the position
                transform.position = transform.position + new Vector3(horizontalInput * movementSpeed * Time.deltaTime, 0, verticalInput * movementSpeed * Time.deltaTime);

                //touch movil
                if (Input.touchCount > 0)
                {
                    touch = Input.GetTouch(0);

                    if (touch.phase == TouchPhase.Moved)
                    {
                        transform.position = new Vector3(
                            transform.position.x + touch.deltaPosition.x * speedModifier,
                            transform.position.y,
                            transform.position.z + touch.deltaPosition.y * speedModifier);
                    }
                }
            }
            else
            {
                Player = photonView.IsMine;
            }
            //databaseAcces.GetPaloma();
            if (paloma.transform.position.y < -1)
            {
                if (SceneManager.GetActiveScene().buildIndex == 1)
                {
                    muerteAudioPaloma();
                    resetPosForLVL(new Vector3(-0.07120486f, 7, -0.1657899f));
                }
                else
                {
                    PalomasListasControler = GameObject.FindGameObjectWithTag("revancha").GetComponent <PalomasListas>();
                    PalomasListasControler.MuertePalomaMetodo();
                    if (Photon.Pun.PhotonNetwork.IsMasterClient && Photon.Pun.PhotonNetwork.CurrentRoom != null)
                    {
                        StartCoroutine(GravityFalseithSecond());
                    }
                }

                //Photon.Pun.PhotonNetwork.Destroy(paloma);
                //Destroy(paloma);
                //photonView.RPC("muertoNumero", Photon.Pun.RpcTarget.All);
            }
            //if (!GameStates.gameActive) return;


            //output to log the position change
            //Debug.Log(transform.position);
        }
Esempio n. 2
0
        void OnTriggerEnter(Collider collidedObject)
        {
            if (collidedObject.tag == "car")
            {
                PalomasListasControler = GameObject.FindGameObjectWithTag("revancha").GetComponent <PalomasListas>();
            }
            if (collidedObject.tag == "car" && paloma.GetPhotonView().IsMine)
            {
                muerteAudioPaloma();
                Debug.Log("MUERTE " + collidedObject.tag);

                //collidedObject.SendMessage("hitByPlayerBullet", null, SendMessageOptions.DontRequireReceiver);
                //if (!deletedPigeon)
                //{
                //if (Photon.Pun.PhotonNetwork.IsMasterClient && Photon.Pun.PhotonNetwork.CurrentRoom != null/* && SceneManager.GetActiveScene().buildIndex == 1*/)
                //{
                gavitiFalse();
                //}

                // Photon.Pun.PhotonNetwork.Destroy(paloma);
                //Destroy(paloma);
                //deletedPigeon = true;
                PalomasListasControler.MuertePalomaMetodo();
                //}
            }
            else if (collidedObject.tag == "CuboLila")
            {
                cuerpoPaloma.GetComponent <Renderer>().material = materialLila;
                cubos[0].GetComponent <girarCubo>().GrirarMas1(4);
                colorPaloma = materialLila;
            }
            else if (collidedObject.tag == "CuboVerde")
            {
                cuerpoPaloma.GetComponent <Renderer>().material = materialVerde;
                cubos[1].GetComponent <girarCubo>().GrirarMas1(4);
                colorPaloma = materialVerde;
            }
            else if (collidedObject.tag == "CuboPaloma")
            {
                cuerpoPaloma.GetComponent <Renderer>().material = materialPaloma;
                cubos[2].GetComponent <girarCubo>().GrirarMas1(4);
                colorPaloma = materialPaloma;
            }
            else if (collidedObject.tag == "CuboAzul")
            {
                cuerpoPaloma.GetComponent <Renderer>().material = materialAzul;
                cubos[3].GetComponent <girarCubo>().GrirarMas1(4);
                colorPaloma = materialAzul;
            }
            else if (collidedObject.tag == "CuboRojo")
            {
                cuerpoPaloma.GetComponent <Renderer>().material = materialRojo;
                cubos[4].GetComponent <girarCubo>().GrirarMas1(4);
                colorPaloma = materialRojo;
            }
        }