Ejemplo n.º 1
0
 // Use this for initialization
 public void StartTurnManager(GamePlay gp)
 {
     gPlay            = gp;
     this.turnManager = this.gameObject.AddComponent <PunTurnManager>();
     this.turnManager.TurnManagerListener = this;
     this.turnManager.TurnDuration        = (float)gPlay.TurnDuration;
 }
Ejemplo n.º 2
0
 // Start is called before the first frame update
 public void InitializeTurnManager()
 {
     gameManager      = FindObjectOfType <OnlineGameManager>();
     this.turnManager = this.gameObject.AddComponent <PunTurnManager>();
     this.turnManager.TurnManagerListener = this;
     turnManager.TurnDuration             = 60f;
 }
Ejemplo n.º 3
0
 private void Start()
 {
     t = gameObject.AddComponent <PunTurnManager>();
     t.TurnDuration        = 30;
     t.TurnManagerListener = this;
     InitTurn();
 }
Ejemplo n.º 4
0
        private void Start()
        {
            this.turnManager = this.gameObject.AddComponent <PunTurnManager>();
            this.turnManager.TurnManagerListener = this;
            this.turnManager.TurnDuration        = TurnDuration;

            PlayerText.text = PhotonNetwork.player.NickName;

            Debug.Log("ID" + PhotonNetwork.player.ID);

            if (playerPrefab == null)
            {
                Debug.LogError("<Color=Red><a>Missing</a></Color> playerPrefab Reference. Please set it up in GameObject 'Game Manager'", this);
            }
            else
            {
                if (PlayerManager.LocalPlayerInstance == null)
                {
                    Debug.Log("We are Instantiating LocalPlayer from " + Application.loadedLevelName);
                    // we're in a room. spawn a character for the local player. it gets synced by using PhotonNetwork.Instantiate
                    if (PhotonNetwork.playerList.Length == 1)
                    {
                        PhotonNetwork.Instantiate(this.playerPrefab.name, new Vector3(-4f, -5f, 0f), Quaternion.identity, 0);
                    }
                    else
                    {
                        PhotonNetwork.Instantiate(this.playerPrefab.name, new Vector3(-4f, 5f, 0f), Quaternion.identity, 0);
                    }
                }
                else
                {
                    Debug.Log("Ignoring scene load for " + Application.loadedLevelName);
                }
            }
        }
    private void Start()
    {
        print("Start");
        gameOverText.text = "";
        instance          = this;
        array             = new char[size][];
        for (int i = 0; i < size; ++i)
        {
            array[i] = new char[size];
        }
        offset = new Vector3Int(-size / 2, -size / 2, 0);

        var cell = new Vector3Int();
        int max  = size / 2;

        for (cell.x = offset.x; cell.x <= max; ++cell.x)
        {
            for (cell.y = offset.y; cell.y <= max; ++cell.y)
            {
                background.SetTile(cell, tileGround);
            }
        }
        var col = background.GetComponent <BoxCollider2D>();

        col.size = new Vector2(size, size);
        R.t      = turnManager = gameObject.AddComponent <PunTurnManager>();
        turnManager.TurnManagerListener = this;
        turnManager.TurnDuration        = duration;
        OnPhotonPlayerConnected(null);
        print("Over: " + turnManager.IsOver);
        print("Init Turn: " + turnManager.Turn);
    }
    // Use this for initialization
    void OnEnable()
    {
        init_grid();
        init_color();
        isBlasting   = false;
        totalPlayers = PhotonNetwork.room.PlayerCount;
        isGameOver   = new bool[totalPlayers];
        isTurnCame   = new bool[totalPlayers];
        for (int i = 0; i < totalPlayers; i++)
        {
            isGameOver [i] = false;
            isTurnCame [i] = false;
        }
        turnManager = this.gameObject.AddComponent <PunTurnManager>();
        turnManager.TurnManagerListener = this;

        if (!PhotonNetwork.isMasterClient)
        {
            PhotonView photonView = PhotonView.Get(this);
            if (photonView != null)
            {
                photonView.RPC("updateOnMainScreen", PhotonTargets.MasterClient);
            }
        }
    }
Ejemplo n.º 7
0
        public void Initialize(PunTurnManager turnManager)
        {
            this.pPunTurnManager = turnManager;
            Debug.Assert(pPunTurnManager != null);

            ResetInput();
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Debug du lieu Turn Manager
 /// </summary>
 /// <param name="t"></param>
 /// <returns></returns>
 public static void Info(this PunTurnManager t)
 {
     Debug.Log($"IsOver: {t.IsOver} ,IsFinishedByMe: {t.IsFinishedByMe} " +
               $",IsCompletedByAll: {t.IsCompletedByAll} \n" +
               $"Turn: {t.Turn} ,TurnDuration: {t.TurnDuration}" +
               $" ,RemainingTime: {t.RemainingSecondsInTurn} \n" +
               $"ElapseTime: {t.ElapsedTimeInTurn}");
 }
    /// <summary>
    /// ターンが時間切れになった時に呼び出される
    /// </summary>
    /// <param name="turn"></param>
    void IPunTurnManagerCallbacks.OnTurnTimeEnds(int turn)
    {
        Debug.LogFormat("OnTurnTimeEnds {0}", turn);
        // 新たなターンを開始する
        PunTurnManager turnManager = GameObject.FindObjectOfType <PunTurnManager>();

        turnManager.BeginTurn();
    }
Ejemplo n.º 10
0
 void Start()
 {
     m_rb   = GetComponent <Rigidbody2D>();
     m_view = GetComponent <PhotonView>();
     // 落ちないようにする
     m_rb.constraints = RigidbodyConstraints2D.FreezePositionY | RigidbodyConstraints2D.FreezeRotation;
     m_turnManager    = GameObject.FindObjectOfType <PunTurnManager>(); // PunTurnManager がシーン内に一つしかないことを前提とする
 }
Ejemplo n.º 11
0
 void Start()
 {
     this.turnManager = this.gameObject.AddComponent <PunTurnManager>(); // добавили компанент
     this.turnManager.TurnManagerListener = this;                        // добавили слушетеля
     this.turnManager.TurnDuration        = 5f;                          // время ожидания между очередями
     PhotonNetwork.ConnectUsingSettings(null);                           //подключаемся
     PhotonHandler.StopFallbackSendAckThread();                          // заморозил соединение
 }
Ejemplo n.º 12
0
    void Start()
    {
        this.turnManager = this.gameObject.AddComponent <PunTurnManager>();
        this.turnManager.TurnManagerListener = this;
        this.turnManager.TurnDuration        = 10f;

        RefreshUIViews();
    }
Ejemplo n.º 13
0
 // Use this for initialization
 void Start()
 {
     this.turnManager = this.gameObject.AddComponent <PunTurnManager>();
     this.turnManager.TurnManagerListener = this;
     this.turnManager.TurnDuration        = 10f;
     listAnswer   = new List <GameObject>();
     boxSpawnArea = spawnArea.GetComponent <BoxCollider>();
 }
Ejemplo n.º 14
0
    public void Start()
    {
        this.turnManager = this.gameObject.AddComponent <PunTurnManager>();
        this.turnManager.TurnManagerListener = this;
        this.turnManager.TurnDuration        = 5f;

        ButtonCanvasGroup.interactable = false;
        RefreshUIViews();
    }
Ejemplo n.º 15
0
 private void Awake()
 {
     PhotonNetwork.autoJoinLobby = false;
     PhotonNetwork.logLevel      = Loglevel;
     Instance         = this;
     this.TurnManager = this.gameObject.AddComponent <PunTurnManager>();
     this.TurnManager.TurnManagerListener = this;
     this.TurnManager.TurnDuration        = 500f;
 }
Ejemplo n.º 16
0
    public void Start()
    {
        this.turnManager = this.gameObject.AddComponent <PunTurnManager>(); //添加组件并赋值
        this.turnManager.TurnManagerListener = this;                        //为监听器赋值,从而触发下面的回调函数来完成游戏逻辑
        this.turnManager.TurnDuration        = 120f;                        //初始化回合持续时间
        Instance = this;

        RefreshUIViews();       //刷新UI视图
    }
Ejemplo n.º 17
0
 public void Start()
 {
     this.turnManager = base.gameObject.AddComponent <PunTurnManager>();
     this.turnManager.TurnManagerListener = this;
     this.turnManager.TurnDuration        = 5f;
     this.localSelectionImage.gameObject.SetActive(false);
     this.remoteSelectionImage.gameObject.SetActive(false);
     base.StartCoroutine("CycleRemoteHandCoroutine");
     this.RefreshUIViews();
 }
Ejemplo n.º 18
0
    public void Start()
    {
        initialiserPersonnages = false;
        initialiserPartie      = false;
        this.TurnManager       = this.gameObject.AddComponent <PunTurnManager>();
        this.TurnManager.TurnManagerListener = this;
        this.TurnManager.TurnDuration        = 30f;
        view = gameObject.GetComponent <PhotonView>();

        RefreshUIViews();
    }
Ejemplo n.º 19
0
    private void Start()
    {
#if UNITY_EDITOR
        Connect();
#endif

        this.turnManager = this.gameObject.AddComponent <PunTurnManager>();
        this.turnManager.TurnManagerListener = this;
        this.turnManager.TurnDuration        = 60f;

        GameManager.Inst.UISetup();
    }
Ejemplo n.º 20
0
    // Use this for initialization
    void Start()
    {
        // Start scene for selecting Champ/Deck and retrieve that information

        // Pass Info from GUI selection to connect - later these selections will be passed to SpawnPlayer so that they have dekc /hand dealing info
        TurnManager       = this.GetComponent <PunTurnManager>();
        oppHandContainer  = GameObject.FindWithTag("OppHand");
        oppLeftContainer  = GameObject.Find("OppLeft");
        oppRightContainer = GameObject.Find("OppRight");

        Connect();
    }
Ejemplo n.º 21
0
    public void Start()
    {
        this.turnManager = this.gameObject.AddComponent <PunTurnManager>(); //添加组件并赋值
        this.turnManager.TurnManagerListener = this;                        //为监听器赋值,从而触发下面的回调函数来完成游戏逻辑
        this.turnManager.TurnDuration        = 5f;                          //初始化回合持续时间


        this.localSelectionImage.gameObject.SetActive(false);  //激活本地选择图片
        this.remoteSelectionImage.gameObject.SetActive(false); //激活远程选择图片
        this.StartCoroutine("CycleRemoteHandCoroutine");       //启动协程,间隔0.5秒随机一个手势

        RefreshUIViews();                                      //刷新UI视图
    }
Ejemplo n.º 22
0
    public void Start()
    {
        this.turnManager = this.gameObject.AddComponent <PunTurnManager>(); // добавили компанент
        this.turnManager.TurnManagerListener = this;                        // добавили слушетеля
        this.turnManager.TurnDuration        = 5f;                          //аремя поворота?


        this.localSelectionImage.gameObject.SetActive(false);  //картинка
        this.remoteSelectionImage.gameObject.SetActive(false); //картинка
        this.StartCoroutine("CycleRemoteHandCoroutine");       // пошла коратина, возращает от 1 до 4

        RefreshUIViews();
    }
Ejemplo n.º 23
0
    public void Start()
    {
        this.turnManager = this.gameObject.AddComponent <PunTurnManager>(); //添加组件并赋值
        this.turnManager.TurnManagerListener = this;                        //为监听器赋值,从而触发下面的回调函数来完成游戏逻辑
        this.turnManager.TurnDuration        = TurnTime;                    //初始化回合持续时间
        if (this.source == null)
        {
            this.source = FindObjectOfType <AudioSource>();
        }
        Instance = this;

        RefreshUIViews();               //刷新UI视图
    }
Ejemplo n.º 24
0
        void Start()
        {
            // Demo code, will be removed after test
            //*
            //DemoStart();
            //*/

            // Add and initialize PunTurnManager
            poTurnManager = this.gameObject.AddComponent <PunTurnManager>();
            poTurnManager.TurnManagerListener = this;
            poTurnManager.TurnDuration        = this.turnDuration;

            // Create avatars for local and remote players
            poMyAvatar    = new Avatar();
            poOtherAvatar = new Avatar();

            poMyAvatar.Initialize(PhotonNetwork.LocalPlayer, this.initialHP);
            // TODO: replace null with an actual player
            if (PhotonNetwork.PlayerList[0] == PhotonNetwork.LocalPlayer)
            {
                poOtherAvatar.Initialize(PhotonNetwork.PlayerList[1], this.initialHP);
            }
            else
            {
                poOtherAvatar.Initialize(PhotonNetwork.PlayerList[0], this.initialHP);
            }


            // Initialize ActionManager, it's a singleton
            ActionManager.Initialize(poMyAvatar, poOtherAvatar);

            // Initialize UIManager
            this.pUIManager = this.gameObject.GetComponentInChildren <UIManager>();
            Debug.Assert(pUIManager != null);

            pUIManager.OnInitialize(poMyAvatar, poOtherAvatar);

            // Initialize InputManager
            this.pInputManager = this.gameObject.GetComponentInChildren <InputManager>();
            Debug.Assert(pInputManager != null);

            pInputManager.Initialize(this.poTurnManager);

            //


            StartCoroutine("StartBattle");
        }
Ejemplo n.º 25
0
    public void Start()
    {
        spawn = GameObject.Find("GameManager").GetComponent <Spawn> ();
        sparr = new List <GameObject>();

        this.turnManager = this.gameObject.AddComponent <PunTurnManager>();
        this.turnManager.TurnManagerListener = this;
        this.turnManager.TurnDuration        = 5f;


        this.localSelectionImage.gameObject.SetActive(false);
        this.remoteSelectionImage.gameObject.SetActive(false);
        this.StartCoroutine("CycleRemoteHandCoroutine");

        RefreshUIViews();
    }
Ejemplo n.º 26
0
 void Start()
 {
     ClickBtn         = GetComponentsInChildren <AudioSource>()[0];
     ChooseCard       = GetComponentsInChildren <AudioSource>()[1];
     xmlprocess       = new Xmlprocess();
     this.turnManager = this.gameObject.AddComponent <PunTurnManager>();
     this.turnManager.TurnManagerListener = this;
     this.turnManager.TurnDuration        = 15f;
     cardCount        = 12;
     C_correctNum     = -1; //當前連續答對題數
     max_correctNum   = -1; //最大連續答對數
     correctNum       = 0;  //累計正確題數
     hintLA_count     = 10000; hintST_count = 10000;
     c_hintLA_count   = 0; c_hintST_count = 0;
     wrongNum         = 0;
     IsShowingResults = false;
     RefreshConnectUI();
 }
Ejemplo n.º 27
0
    public void Start()
    {
        this.turnManager = this.gameObject.AddComponent <PunTurnManager>();
        this.turnManager.TurnManagerListener = this;
        this.turnManager.TurnDuration        = 5;


        this.localSelectionImage.gameObject.SetActive(false);
        this.remoteSelectionImage.gameObject.SetActive(false);
        this.StartCoroutine("CycleRemoteHandCoroutine");

        // when we play this scene in the editor (without the other scene), make sure we connect, too
        if (!PhotonNetwork.connected && !PhotonNetwork.connecting)
        {
            RpsDemoConnect dc = gameObject.AddComponent <RpsDemoConnect>();
            dc.ApplyUserIdAndConnect();
        }
    }
    void Update()
    {
        // 自分の番ではない時は何もしない
        if (!m_isMyTurn)
        {
            return;
        }

        // カメラの位置 → マウスでクリックした場所に Ray を飛ばすように設定する
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit; // out パラメータで Ray の衝突情報を受け取るための変数
                        // Ray を飛ばして、コライダーに当たったかどうかを戻り値で受け取る
        bool isHit = Physics.Raycast(ray, out hit);

        // Ray が当たったかどうかで異なる処理をする
        if (isHit)
        {
            // Ray が当たっている時は線を引くために hitpoint にアンカーを移動する
            Vector3 lookAtPosition = hit.point;
            lookAtPosition.y = this.transform.position.y;
            this.transform.LookAt(lookAtPosition);
            m_hitPoint.position = hit.point;
            // Ray が当たっている状態で Fire したら
            if (Input.GetButtonUp("Fire1"))
            {
                // 自分のターンが終わったことを通知する
                PunTurnManager turnManager = GameObject.FindObjectOfType <PunTurnManager>();
                turnManager.SendMove(null, true);                                                 // 第一引数でメッセージを送れるが、今回は何もしない / 第二引数に true を渡すことで「自分のターンを終了する」ことを通知する
                FinishMyTurn();                                                                   // ローカルでの自ターン管理をする
                PhotonNetwork.Instantiate(m_explosionPrefabName, hit.point, Quaternion.identity); // 爆発エフェクトを生成する
            }
        }
        else
        {
            // Ray が当たっていない時は、レーザーを消すために銃口とレーザーの終点を同じ位置にする
            m_hitPoint.position = m_muzzle.position;
        }
    }
Ejemplo n.º 29
0
 public void Construct(float turnDuration)
 {
     _turnManager = gameObject.AddComponent <PunTurnManager>();
     _turnManager.TurnManagerListener = this;
     _turnManager.TurnDuration        = turnDuration;
 }
Ejemplo n.º 30
0
 void Start()
 {
     this.turnManager = this.gameObject.AddComponent <PunTurnManager>();
     this.turnManager.TurnManagerListener = this;
     this.turnManager.TurnDuration        = 5f;
 }
Ejemplo n.º 31
-2
    public void Start()
    {
        this.turnManager = this.gameObject.AddComponent<PunTurnManager>();
        this.turnManager.TurnManagerListener = this;
        this.turnManager.TurnDuration = 5;
        

        this.localSelectionImage.gameObject.SetActive(false);
        this.remoteSelectionImage.gameObject.SetActive(false);
        this.StartCoroutine("CycleRemoteHandCoroutine");

        // when we play this scene in the editor (without the other scene), make sure we connect, too
        if (!PhotonNetwork.connected && !PhotonNetwork.connecting)
        {
            RpsDemoConnect dc = gameObject.AddComponent<RpsDemoConnect>();
            dc.ApplyUserIdAndConnect();
        }
    }
Ejemplo n.º 32
-2
    public void Start()
    {
		this.turnManager = this.gameObject.AddComponent<PunTurnManager>();
        this.turnManager.TurnManagerListener = this;
        this.turnManager.TurnDuration = 5f;
        

        this.localSelectionImage.gameObject.SetActive(false);
        this.remoteSelectionImage.gameObject.SetActive(false);
        this.StartCoroutine("CycleRemoteHandCoroutine");

		RefreshUIViews();
    }