PhotonView.Get C# (CSharp) Method

Get() public static method

public static Get ( Component component ) : PhotonView,
component Component
return PhotonView,
    public static PhotonView Get(Component component)
    {
        return component.GetComponent<PhotonView>();
    }

Same methods

PhotonView::Get ( GameObject gameObj ) : PhotonView,

Usage Example

Example #1
0
    void Update()
    {
        soundDeath = GetComponent <AudioSource>();
        if (transform.position.x == hitpoint.x && transform.position.z == hitpoint.z)
        {
            if (Anim.GetBool("isgun"))
            {
                GetComponent <Tir>().ActiveArme(armes[0], true);
            }
            else
            {
                GetComponent <Tir>().ActiveArme(armes[0], false);
            }
            PhotonView.Get(this).RPC("PlayAnimWalk", PhotonTargets.MasterClient, false);
            PhotonView.Get(this).RPC("PlayAnimRun", PhotonTargets.MasterClient, false);
            PhotonView.Get(this).RPC("PlayAnimIsgunmove", PhotonTargets.MasterClient, false);
        }

        if (deadd)
        {
            deadText.SetActive(true);
            Cursor.visible   = true;
            Cursor.lockState = CursorLockMode.Confined;
            Time.timeScale   = 0;
        }
        else
        {
//			deadText.SetActive(false);
            Cursor.visible = true;
            Time.timeScale = 1;
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                m.GetComponent <MENU>().ResumeBut();
            }
            if (Input.GetMouseButton(0))
            {
                Ray        ray = cam.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;
                if (Physics.Raycast(ray, out hit, 100000, mask))
                {
                    hitpoint = hit.point;
                    if (!GetComponent <SpellController>().run)
                    {
                        GetComponent <Tir>().ActiveArme(armes[0], false);
                        PhotonView.Get(this).RPC("PlayAnimWalk", PhotonTargets.MasterClient, true);
                        PhotonView.Get(this).RPC("PlayAnimIsgun", PhotonTargets.MasterClient, false);
                        PhotonView.Get(this).RPC("PlayAnimIsgunmove", PhotonTargets.MasterClient, true);
                    }

                    else
                    {
                        GetComponent <Tir>().ActiveArme(armes[0], false);
                        PhotonView.Get(this).RPC("PlayAnimRun", PhotonTargets.MasterClient, true);
                        PhotonView.Get(this).RPC("PlayAnimIsgun", PhotonTargets.MasterClient, false);
                        PhotonView.Get(this).RPC("PlayAnimIsgunmove", PhotonTargets.MasterClient, true);
                    }
                    motor.MoveToPoint(hit.point);
                }
            }
            if (Input.GetMouseButton(2))
            {
                Ray        ray1 = cam.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit1;
                if (Physics.Raycast(ray1, out hit1, 100000, mask) && Vector3.Distance(hit1.point, transform.position) >= 3)
                {
                    transform.LookAt(hit1.point);
                }
            }



            if (Input.GetKeyDown(KeyCode.L))
            {
                if (Life - 15 > 0)
                {
                    Life -= 15;
                }
                else
                {
                    Life = 0;
                    deadText.SetActive(true);
                }
            }
            if (Input.GetKeyDown(KeyCode.M))
            {
                if (Life + 20 < maxlife)
                {
                    Life += 20;
                }
                else
                {
                    Life = maxlife;
                }
            }
            if (energieV >= maxenergie)
            {
                energieV = maxenergie;
            }

            if (Life >= maxlife)
            {
                Life = maxlife;
            }
            else if (Life <= 0)
            {
                if (PlayerPrefs.GetInt("Resurection") == 1)
                {
                    Life       = 50;
                    energieV   = 0;
                    consT.text = "Resurection !!!!!!!!!!!!!!!!!!!!!!";
                }
                else
                {
                    soundDeath.clip = rip;
                    soundDeath.Play();
                    Life  = 0;
                    deadd = true;
                }
            }

            vieSlider.GetComponent <AffichageNumb>().n.GetComponent <Text>().text     = Life + " / " + maxlife;
            energieSlider.GetComponent <AffichageNumb>().n.GetComponent <Text>().text = energieV + " / " + maxenergie;
            vieSlide.value     = Life / maxlife;
            energieSlide.value = energieV / maxenergie;
            vie.value          = (float)Life / maxlife;
            energie.value      = (float)energieV / maxenergie;


            if (Input.GetKeyDown(KeyCode.I))
            {
                int index2 = index + 1;
                GetComponent <PlayerController>().consT.text = index2 + ":" + " " + inventaire[index];
                index += 1;
                if (inventaire[index] == "" | -index >= 10)
                {
                    index = 0;
                }
            }
        }
    }
All Usage Examples Of PhotonView::Get