Ejemplo n.º 1
0
    void Update()
    {
        if (!photonView.isMine) {
            transform.position = Vector3.Lerp(transform.position, this.correctPlayerPos, Time.deltaTime * 5);
            transform.rotation = Quaternion.Lerp(transform.rotation, this.correctPlayerRot, Time.deltaTime * 5);
        } else {
            if (!gotFirstUpdate) {

                photonView.RPC("setNick", PhotonTargets.OthersBuffered, PhotonNetwork.player.name);

                healthBar = GameObject.Find ("Canvas/PlayerPanel/HP Orb").GetComponent<UIBar>();
                expBar = GameObject.Find ("Canvas/PlayerPanel/ExpBar").GetComponent<UIBar>();
                manaBar = GameObject.Find ("Canvas/PlayerPanel/Mana Semicircle").GetComponent<UIBar>();

                healthBar.updateVertical(characterData.health, characterData.maxHealth);
                expBar.updateHoritzontal(characterData.exp, 100);
                manaBar.updateHoritzontal(characterData.mana, characterData.maxMana);

                gotFirstUpdate = true;
            }

            //looks like player is falling
            if (transform.position.y < -100) {
                transform.position = GameObject.Find("SpawnPoints/FirstJoin").transform.position;
            }
        }
    }