Пример #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
 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
 private void KillEvent(PhotonRPCModel model)
 {
     KillCommandSample command = JsonUtility.FromJson<KillCommandSample>(model.message);
     if (command.target == gameObject.name)
     {
         Destroy(gameObject);
     }
 }
Пример #6
0
 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
 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
    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
    // 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
    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;
 }