Last active
August 29, 2015 14:10
-
-
Save soyliquid/e6574c30650092e2b4f9 to your computer and use it in GitHub Desktop.
[Unity][Photon][Oculus]プレイヤー制御用
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
/// <summary> | |
/// Organze scripts for Photon usage. | |
/// </summary> | |
public class PhotonPlayerManager : Photon.MonoBehaviour { | |
public Transform CameraPosition; | |
public MonoBehaviour[] OwnerBehaviors; | |
public RelativeTransform LookPoint; | |
// Use this for initialization | |
void Start () { | |
if(photonView.isMine) { | |
// when player is mine, set camera and lookpoint. | |
Camera.main.transform.parent = CameraPosition.transform; | |
LookPoint.TargetPosition = GameObject.FindWithTag("LookPoint"); | |
} else { | |
foreach(MonoBehaviour b in OwnerBehaviors){ | |
// when player is not mine, disable registered scripts. | |
b.enabled = false; | |
} | |
} | |
} | |
// Update is called once per frame | |
void Update () { | |
if(Input.GetKeyDown(KeyCode.R)) { | |
OVRManager.display.RecenterPose(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment