예제 #1
0
 void OnDeparture(PhotonRPCModel model)
 {
     if (!GameManager.GetInstance().myInfo.isHost)
     {
         Departure(model.message);
     }
 }
예제 #2
0
 void OnActionTicker(PhotonRPCModel model)
 {
     GameObject obj = Instantiate(tickerObject) as GameObject;
     obj.transform.SetParent(tickerParent);
     var ticker = obj.GetComponent<TickerController>();
     ticker.Initialize(model.message);
 }
예제 #3
0
파일: NextScene.cs 프로젝트: K-U-/ggjtut7
 private void OnDeparture(PhotonRPCModel model)
 {
     if (!GameManager.GetInstance().myInfo.isHost)
     {
         SceneChange();
     }
 }
예제 #4
0
 public void OnSyncPositionEvent(PhotonRPCModel model)
 {
     SyncCommand command = JsonUtility.FromJson<SyncCommand>(model.message);
     if (characterDictionary.ContainsKey(model.senderId))
     {
         characterDictionary[model.senderId].RepositionPlayer(command);
     }
 }
예제 #5
0
파일: EventSample.cs 프로젝트: K-U-/ggjtut7
 private void KillEvent(PhotonRPCModel model)
 {
     KillCommandSample command = JsonUtility.FromJson<KillCommandSample>(model.message);
     if (command.target == gameObject.name)
     {
         Destroy(gameObject);
     }
 }
예제 #6
0
파일: EventSample.cs 프로젝트: K-U-/ggjtut7
 private void MoveEvent(PhotonRPCModel model)
 {
     MoveCommandSample command = JsonUtility.FromJson<MoveCommandSample>( model.message );
     if (command.target == gameObject.name)
     {
         transform.position += Vector3.right * command.offset;
     }
 }
예제 #7
0
 IEnumerator SyncRoutine()
 {
     while (true)
     {
         PhotonRPCModel model = new PhotonRPCModel();
         model.command = PhotonRPCCommand.StartSync;
         model.senderId = gameObject.name;
         PhotonRPCHandler.GetInstance().PostRPC(model);
         yield return new WaitForSeconds(3.0f);
     }
 }
예제 #8
0
파일: ArrowEvent.cs 프로젝트: K-U-/ggjtut7
 void move(string id, float x, float z) {
     if (death[int.Parse(id)] == false)
     {
         sampleCommand.target = id;
         sampleCommand.offsetX = x;
         sampleCommand.offsetZ = z;
         PhotonRPCModel model = new PhotonRPCModel();
         model.senderId = PlayerID;
         model.command = PhotonRPCCommand.Move;
         model.message = JsonUtility.ToJson(sampleCommand);
         PhotonRPCHandler.GetInstance().PostRPC(model);
     }
 }
예제 #9
0
파일: NextScene.cs 프로젝트: K-U-/ggjtut7
    public void SceneChange()
    {
        GetComponent<Button>().interactable = false;
        GameManager.GetInstance().LoadScene(mSceneName);



        if (GameManager.GetInstance().myInfo.isHost)
        {
            PhotonRPCModel model = new PhotonRPCModel();
            model.senderId = GameManager.GetInstance().myInfo.id.ToString();
            model.command = PhotonRPCCommand.Departure;
            model.message = mSceneName;
            PhotonRPCHandler.GetInstance().PostRPC(model);
        }

    }
예제 #10
0
 public void Departure()
 {
     if (GameManager.GetInstance().myInfo.isHost)
     {
         var list = GameManager.GetInstance().ReadyStatusList.readyStatusList;
         foreach (var val in list)
         {
             val.info.isHuman = true;
         }
         list[Random.Range(0, list.Count)].info.isHuman = false;
         GameManager.GetInstance().PostUpdateReadyRPC();
         PhotonRPCModel model = new PhotonRPCModel();
         model.senderId = GameManager.GetInstance().myInfo.id.ToString();
         model.command = PhotonRPCCommand.Departure;
         model.message = "";
     
         PhotonRPCHandler.GetInstance().PostRPC(model);
     }
     GameManager.GetInstance().LoadScene("Field");
 }
예제 #11
0
파일: SetCos.cs 프로젝트: K-U-/ggjtut7
    // Use this for initialization
    void Start () {
        //SetCharaCos(1, 1, 1, 1, 1, 1, 1);
		CharactorCos characterCos = new CharactorCos();
		characterCos.HeadIndex = Random.Range (0, Head.Length);
		characterCos.EyeIndex = Random.Range (0, Eye.Length);
		characterCos.BodyIndex = Random.Range(0, Body.Length);
		characterCos.UarmIndex = Random.Range (0, Uarm.Length);
		characterCos.BarmIndex = Random.Range (0, Barm.Length);
		characterCos.LegIndex = Random.Range (0, Leg.Length);
		characterCos.WeponIndex = Random.Range (0, Wepon.Length);
		SetCharaCos (characterCos);
		PhotonRPCModel model = new PhotonRPCModel ();
		model.senderId = GameManager.GetInstance ().myInfo.id.ToString();
		model.command = PhotonRPCCommand.Costume;
		CostumeCommand command = new CostumeCommand ();
		command.target = model.senderId;
		command.characotorCostume = characterCos;
		model.message = JsonUtility.ToJson(command);
		PhotonRPCHandler.GetInstance().PostRPC(model);
    }
예제 #12
0
    private void MoveEvent(PhotonRPCModel model)
    {
        MoveCommand command = JsonUtility.FromJson<MoveCommand>(model.message);
        if (command.target == gameObject.name)
        {
            Vector3 pos;
            pos = transform.position;
            pos += Vector3.right * command.offsetX;
            pos += Vector3.forward * command.offsetZ;
            if (command.offsetX < 0) {
                if (this.transform.position.x > 0) {
                    search(pos, command);
                }
            }

            if (command.offsetX > 0)
            {
                if (this.transform.position.x < stage.row - 1)
                {
                    search(pos, command);
                }
            }

            if (command.offsetZ < 0)
            {
                if (this.transform.position.z > 0)
                {
                    search(pos, command);
                }
            }

            if (command.offsetZ > 0)
            {
                if (this.transform.position.z < stage.col - 1)
                {
                    search(pos, command);
                }
            }
        }
    }
예제 #13
0
 private static void OnMoveEvent(PhotonRPCModel model)
 {
     moveEvent(model);
 }
예제 #14
0
 private static void OnTimeOverEvent(PhotonRPCModel model)
 {
     timeOverEvent(model);
 }
예제 #15
0
 public void PostRPC(PhotonRPCModel model)
 {
     photonView.RPC("HandleRPC", PhotonTargets.All, JsonUtility.ToJson(model));
 }
예제 #16
0
 private static void OnStartBattleEvent(PhotonRPCModel model){
     startBattleEvent(model);
 }
예제 #17
0
 private static void OnSyncGameRemainTimeEvent(PhotonRPCModel model){
     syncGameRemainTimeEvent(model);
 }
예제 #18
0
	private static void OnCostumeEvent(PhotonRPCModel model)
	{
		costumeEvent (model);
	}
예제 #19
0
 private static void OnActionTickerEvent(PhotonRPCModel model){
     if(actionTickerEvent != null){
         actionTickerEvent(model);
     }
 }
예제 #20
0
 private static void OnSyncPosition(PhotonRPCModel model)
 {
     if (syncPositionEvent != null)
     {
         syncPositionEvent(model);
     }
 }
예제 #21
0
 private static void OnDepartureEvent(PhotonRPCModel model)
 {
     departureEvent(model);
 }
예제 #22
0
 private void SyncGameRemainTime(PhotonRPCModel model)
 {
     gameRemainTime = float.Parse(model.message);
 }
예제 #23
0
    /// <summary>
    /// 時間切れで次に遷移するかもしれない
    /// </summary>
    /// <param name="model"></param>
    public void OnTimeOver(PhotonRPCModel model)
    {
        LoadScene("Field");
        roundCount--;

        if (roundCount == 0)
        {
            //最終リザルト
        }
        else
        {
            //ラウンドリザルト
        }
    }
예제 #24
0
 private static void OnUpdateReady(PhotonRPCModel model)
 {
     updateReadyEvent(model);
 }
예제 #25
0
 private static void OnKillTimeEvent(PhotonRPCModel model) {
     killtimeEvent(model);
 }
예제 #26
0
파일: SampleGUI.cs 프로젝트: K-U-/ggjtut7
    void OnGUI()
    {
        GUILayout.BeginHorizontal();
        {
            GUILayout.BeginVertical();
            {
                MoveCommandSample sampleCommand = new MoveCommandSample();


                if (GUILayout.Button("Right 1"))
                {
                    sampleCommand.target = "1";
                    sampleCommand.offset = 1f;
                    PhotonRPCModel model = new PhotonRPCModel();
                    model.senderId = "AAA";
                    model.command = PhotonRPCCommand.Move;
                    model.message = JsonUtility.ToJson(sampleCommand);
                    GetComponent<PhotonRPCHandler>().PostRPC(model);
                }

                if (GUILayout.Button("Right 2"))
                {
                    sampleCommand.target = "2";
                    sampleCommand.offset = 1f;
                    PhotonRPCModel model = new PhotonRPCModel();
                    model.senderId = "AAA";
                    model.command = PhotonRPCCommand.Move;
                    model.message = JsonUtility.ToJson(sampleCommand);
                    GetComponent<PhotonRPCHandler>().PostRPC(model);
                }

                if (GUILayout.Button("Right 3"))
                {
                    sampleCommand.target = "3";
                    sampleCommand.offset = 1f;
                    PhotonRPCModel model = new PhotonRPCModel();
                    model.senderId = "AAA";
                    model.command = PhotonRPCCommand.Move;
                    model.message = JsonUtility.ToJson(sampleCommand);
                    GetComponent<PhotonRPCHandler>().PostRPC(model);
                }

            } GUILayout.EndVertical();
            GUILayout.BeginVertical();
            {
                KillCommandSample sampleCommand = new KillCommandSample();
                if (GUILayout.Button("Kill 1"))
                {
                    sampleCommand.target = "1";
                    PhotonRPCModel model = new PhotonRPCModel();
                    model.senderId = "AAA";
                    model.command = PhotonRPCCommand.Kill;
                    model.message = JsonUtility.ToJson(sampleCommand);
                    GetComponent<PhotonRPCHandler>().PostRPC(model);
                }

                if (GUILayout.Button("Kill 2"))
                {
                    sampleCommand.target = "2";
                    PhotonRPCModel model = new PhotonRPCModel();
                    model.senderId = "AAA";
                    model.command = PhotonRPCCommand.Kill;
                    model.message = JsonUtility.ToJson(sampleCommand);
                    GetComponent<PhotonRPCHandler>().PostRPC(model);
                }

                if (GUILayout.Button("Kill 3"))
                {
                    sampleCommand.target = "3";
                    PhotonRPCModel model = new PhotonRPCModel();
                    model.senderId = "AAA";
                    model.command = PhotonRPCCommand.Kill;
                    model.message = JsonUtility.ToJson(sampleCommand);
                    GetComponent<PhotonRPCHandler>().PostRPC(model);
                }
            } GUILayout.EndVertical();
        } GUILayout.EndHorizontal();
    }
예제 #27
0
 private static void OnJoinEvent(PhotonRPCModel model)
 {
     joinEvent(model);
 }
예제 #28
0
 private void CallTimeOver()
 {
     PhotonRPCModel model = new PhotonRPCModel();
     model.command = PhotonRPCCommand.TimeOver;
     PhotonRPCHandler.GetInstance().PostRPC(model);
 }
예제 #29
0
 private static void OnStartSync(PhotonRPCModel model)
 {
     if (startSyncEvent != null)
     {
         startSyncEvent(model);
     }
 }
예제 #30
0
 private void OnStartBattleEvent(PhotonRPCModel model)
 {
     startedGame = true;
 }