Beispiel #1
0
        /** 更新。
         */
        public void Main()
        {
            switch (this.mode)
            {
            case Mode.Connect_Auto:
            {
                //自動接続。

                                        #if (USE_DEF_FEE_PUN)
                if (this.connect_auto.Main() == false)
                {
                    this.connect_auto = null;
                    this.mode         = Mode.Reset;
                }
                                        #endif
            } break;

            case Mode.Reset:
            {
                //リセット。

                this.my_player = null;
                this.player_list.Clear();
                this.mode = Mode.None;
            } break;
            }
        }
Beispiel #2
0
        /** [シングルトン]constructor
         */
        private Network()
        {
            //mode
            this.mode = Mode.None;

            //connect_auto
                        #if (USE_DEF_FEE_PUN)
            this.connect_auto = null;
                        #endif

            //ルート。
            this.root_gameobject      = new UnityEngine.GameObject();
            this.root_gameobject.name = "Network";
            UnityEngine.GameObject.DontDestroyOnLoad(this.root_gameobject);
            this.root_transform = this.root_gameobject.GetComponent <UnityEngine.Transform>();

            //disconnect_request
            this.disconnect_request = false;

            //player_list
            this.player_list = new System.Collections.Generic.List <Player_MonoBehaviour>();

            //my_player
            this.my_player = null;

            //recv_callback
            this.recv_callback = null;
        }
Beispiel #3
0
        /** プレイヤープレハブ。削除。
         */
        public void RemovePlayer(Fee.Network.Player_MonoBehaviour a_player)
        {
            if (this.my_player == a_player)
            {
                this.my_player = null;
            }

            this.player_list.Remove(a_player);
        }
Beispiel #4
0
        /** プレイヤ‐プレハブ。追加。
         */
        public int AddPlayer(Fee.Network.Player_MonoBehaviour a_player)
        {
            if (a_player != null)
            {
                if (a_player.IsMine() == true)
                {
                    this.my_player = a_player;
                }
            }

            this.player_list.Add(a_player);
            int t_playerlist_index = this.player_list.Count - 1;

            return(t_playerlist_index);
        }