Example #1
0
 void OnDeparture(PhotonRPCModel model)
 {
     if (!GameManager.GetInstance().myInfo.isHost)
     {
         Departure(model.message);
     }
 }
Example #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);
 }
Example #3
0
 private void OnDeparture(PhotonRPCModel model)
 {
     if (!GameManager.GetInstance().myInfo.isHost)
     {
         SceneChange();
     }
 }
Example #4
0
 public void OnSyncPositionEvent(PhotonRPCModel model)
 {
     SyncCommand command = JsonUtility.FromJson<SyncCommand>(model.message);
     if (characterDictionary.ContainsKey(model.senderId))
     {
         characterDictionary[model.senderId].RepositionPlayer(command);
     }
 }
Example #5
0
 private void KillEvent(PhotonRPCModel model)
 {
     KillCommandSample command = JsonUtility.FromJson<KillCommandSample>(model.message);
     if (command.target == gameObject.name)
     {
         Destroy(gameObject);
     }
 }
Example #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;
     }
 }
Example #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);
     }
 }
Example #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);
     }
 }
Example #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);
        }

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

        if (roundCount == 0)
        {
            //最終リザルト
        }
        else
        {
            //ラウンドリザルト
        }
    }
Example #24
0
 private static void OnUpdateReady(PhotonRPCModel model)
 {
     updateReadyEvent(model);
 }
Example #25
0
 private static void OnKillTimeEvent(PhotonRPCModel model) {
     killtimeEvent(model);
 }
Example #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();
    }
Example #27
0
 private static void OnJoinEvent(PhotonRPCModel model)
 {
     joinEvent(model);
 }
Example #28
0
 private void CallTimeOver()
 {
     PhotonRPCModel model = new PhotonRPCModel();
     model.command = PhotonRPCCommand.TimeOver;
     PhotonRPCHandler.GetInstance().PostRPC(model);
 }
Example #29
0
 private static void OnStartSync(PhotonRPCModel model)
 {
     if (startSyncEvent != null)
     {
         startSyncEvent(model);
     }
 }
Example #30
0
 private void OnStartBattleEvent(PhotonRPCModel model)
 {
     startedGame = true;
 }