Ejemplo n.º 1
0
    void Start()
    {
        //------------------------------------------------------- CLIENT AND SERVER
        NetID = GetComponent <NetworkIdentity>();
        MRD   = GetComponent <MirrorPlayer>();
        MRD.Initialize();

        if (NetID.hasAuthority)//--------------------------------- CLIENT
        {
            this.gameObject.tag = "Player";

            Cam = GameObject.FindWithTag("Camera");
            VC  = GameObject.FindWithTag("Volume").GetComponent <VolumeController>();
            r   = GetComponent <Rigidbody>();

            pitch        = ToPitch.transform.localEulerAngles.x;
            AllColliders = this.transform.GetComponentsInChildren <Collider>();

            GameObject.FindWithTag("Camera").GetComponent <MenuManager>().CM.Init();
        }
        else //-------------------------------------------------- SERVER
        {
            MRD.MirrorStart();
        }

        //Voice.AS.pitch = MRD.VoicePitch; called on rpc
    }
    private void FlipGravity()
    {
        GameObject player       = GameObject.FindWithTag("Player");
        MainPlayer playerScript = player.GetComponent <MainPlayer>();

        GameObject   mirrorPlayer       = GameObject.FindWithTag("MirrorPlayer");
        MirrorPlayer mirrorPlayerScript = mirrorPlayer.GetComponent <MirrorPlayer>();

        // Reverse gravity
        ApplyGravity(player);
        ApplyGravity(mirrorPlayer);

        playerScript.isFlipped           = playerScript.isFlipped == true ? false : true;
        playerScript.jumpVelocity       *= -1;
        mirrorPlayerScript.isFlipped     = mirrorPlayerScript.isFlipped == true ? false : true;
        mirrorPlayerScript.jumpVelocity *= -1;
    }