Ejemplo n.º 1
0
    public virtual void reset(bool restartScene)
    {
        life = 100;
        NetworkController.iAmReady         = false;
        NetworkController.otherPlayerReady = false;

        if (restartScene)
        {
            CbInstructionController c = Utility.getCbInstructionController();
            if (c != null)
            {
                c.resetInstruction();
            }

            TbInstructionController t = Utility.getTbInstructionController();
            if (t != null)
            {
                t.resetInstruction();
            }
        }

        if (avatar != null)
        {
            Transform avatarBodyTransform = this.transform.Find("AvatarBody");
            if (avatarBodyTransform != null)
            {
                avatarBodyTransform.position = new Vector3(0, 3f, 0);
            }
        }

        resetting = false;
    }
Ejemplo n.º 2
0
    void Update()
    {
        if (!photonView.isMine)
        {
            //Update remote player (smooth this, this looks good, at the cost of some accuracy)
            cbAvatar.transform.localPosition = Vector3.Lerp(cbAvatar.transform.localPosition, correctAvatarPos, Time.deltaTime * 5);
//			avatar.transform.localRotation = Quaternion.Lerp (avatar.transform.localRotation, correctAvatarRot, Time.deltaTime * 5);
//			headTransform.localRotation = Quaternion.Lerp (headTransform.localRotation, correctHeadRot, Time.deltaTime * 5);
        }
        else
        {
            checkLife();
            checkFallingOutsideTheScene();


            if (cbAvatar != null)
            {
                posSent = cbAvatar.transform.position;
            }

            TbInstructionController t = Utility.getTbInstructionController();
            if (t != null && t.ShowingInstruction)
            {
                instructionHandler();
                print("instructionHandler.....");
            }
            else
            {
                inputHandler();
                print("inputHandler.....");
            }
            if (NetworkController.iAmReady == false)
            {
                if (t.isInstructionFinished(Constants.tbPlayerID))
                {
                    NetworkController.iAmReady = true;
                    photonView.RPC("setOtherPlayerReady", PhotonTargets.Others, true);
                }
            }
        }
    }