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

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

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