Created
July 2, 2015 14:32
-
-
Save johro/9a5352ad7d1430e54499 to your computer and use it in GitHub Desktop.
PUN1.5
This file contains 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; | |
public class NetworkManager : Photon.MonoBehaviour { | |
void Start() | |
{ | |
//photonの初期設定 | |
PhotonNetwork.ConnectUsingSettings("v0.1"); | |
Debug.Log("Called"); | |
} | |
//PhotonNetwork.ConnectUsingSettingsを行うと呼ばれる | |
void OnJoinedLobby() | |
{ | |
//ランダムにルームに入る | |
PhotonNetwork.JoinRandomRoom(); | |
} | |
//ランダムにルームに入れなかった時に呼ばれる | |
void OnPhotonRandomJoinFailed() | |
{ | |
Debug.Log("CreateRoom"); | |
//部屋を自分で作って入る | |
PhotonNetwork.CreateRoom(null); | |
} | |
//ルームに入室成功したときに呼ばれる | |
void OnJoinedRoom() | |
{ | |
Debug.Log("EnterTheRoom"); | |
//キャラクター作成 | |
PlayerMake(); | |
} | |
void PlayerMake() | |
{ | |
PhotonNetwork.Instantiate("sampleCube",new Vector3(0,0,-7),Quaternion.identity,0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment