Example #1
0
    //----------------------------------------------------------------------------------------------------
    /// <summary>
    /// 主要オブジェクトを操る設定
    /// </summary>
    /// <param name="isManipulate">操るか</param>
    public void SetManipulateMainObject(bool isManipulate)
    {
        //プレイヤーとボスとカメラを操る設定
        m_player.enabled = !isManipulate;
        m_player.GetComponent <Collider>().enabled     = !isManipulate;
        m_player.GetComponent <Rigidbody>().useGravity = !isManipulate;
        m_player.GetComponent <Rigidbody>().velocity   = Vector3.zero;
        m_boss.enabled   = !isManipulate;
        myCamera.enabled = !isManipulate;

        //反転描画対策
        if (myStage.CurrentField.IsInversionField)
        {
            myCamera.InvertDrawing(myCamera.enabled);
        }
    }
    private void CheckWaitForPlayers()
    {
        //Tant que les 2 joueurs ne sont pas connectés, on affiche un message d'attente
        if (PhotonNetwork.room.PlayerCount < 2)
        {
            PhotonNetwork.SetMasterClient(PhotonNetwork.player);
            txtWaitPlayers.text = "Attente des joueurs ... [" + PhotonNetwork.room.PlayerCount + "/" + PhotonNetwork.room.MaxPlayers + "]";
            return;
        }
        else
        {
            txtWaitPlayers.text = "";
            isStarted           = true;
        }

        //Une fois que nos 2 joueurs sont présent, on les instantie
        Vector3 sp;

        //Point d'apparition dans la scene
        sp = new Vector3(0, 1, -10);

        GameObject MyPlayer;

        MyPlayer = PhotonNetwork.Instantiate
                       ("Player_Game1", sp, Quaternion.identity, 0);
        MyPlayer.GetComponent <PlayerController_1>().enabled = true;
        MyPlayer.GetComponentInChildren <Camera>().enabled   = true;
        MyPlayer.GetComponentInChildren <Canvas>().enabled   = true;
    }
Example #3
0
    private void CheckWaitForPlayers()
    {
        // Tant que les 2 joueurs ne sont pas connectés, on affiche un message d'attente
        if (PhotonNetwork.room.PlayerCount < 2)
        {
            PhotonNetwork.SetMasterClient(PhotonNetwork.player);
            txtWaitPlayers.text = "Attente de l'adversaire ... ";
            return;
        }
        else
        {
            txtWaitPlayers.text = "";
            isStarted           = true;

            var sp = new Vector3(0.0f, 0.0f, 0.0f);

            GameObject MyPlayer;
            MyPlayer = PhotonNetwork.Instantiate(
                "Player_5",
                sp,
                Quaternion.identity,
                0
                );

            MyPlayer.GetComponent <PlayerController_5>().enabled = true;
            MyPlayer.GetComponentInChildren <Camera>().enabled   = true;
            MyPlayer.GetComponentInChildren <Canvas>().enabled   = true;
        }
    }
    private void OnPhotonEvent(byte eventCode, object content, int senderID)
    {
        PhotonEventCodes code = (PhotonEventCodes)eventCode;

        if (code == PhotonEventCodes.RoleDefine)
        {
            object[] datas    = content as object[];
            int      data     = (int)datas[0];
            var      roleName = "";
            var      sp       = new Vector3(0, 0, 0);

            //En fonction du role et du fait que le joueur soit masterclient ou non
            //on défini le role name et la vector correspondants au GameObject
            //de son role
            if (PhotonNetwork.player.IsMasterClient)
            {
                if (data == 1)
                {
                    roleName = "AttackPlayer_2";
                    sp       = new Vector3(0, 0, 120);
                }
                else if (data == 2)
                {
                    roleName = "DefensePlayer_2";
                    sp       = new Vector3(0, 0, 95.2f);
                }
            }
            else
            {
                if (data == 1)
                {
                    roleName = "DefensePlayer_2";
                    sp       = new Vector3(0, 0, 95.2f);
                }
                else if (data == 2)
                {
                    roleName = "AttackPlayer_2";
                    sp       = new Vector3(0, 0, 120);
                }
            }

            //Puis instantiation du GameObject et activation de ses composants
            GameObject MyPlayer;
            MyPlayer = PhotonNetwork.Instantiate(
                roleName,
                sp,
                Quaternion.identity,
                0
                );
            MyPlayer.GetComponent <PlayerController_2>().enabled = true;
            MyPlayer.GetComponentInChildren <Camera>().enabled   = true;
            MyPlayer.GetComponentInChildren <Canvas>().enabled   = true;
        }
    }
Example #5
0
    void OnJoinedRoom()
    {
        Debug.Log("OnJoinedRoom");
        TxtRoom.text = PhotonNetwork.player.NickName + " you are in room: " + PhotonNetwork.room.Name;
        UpdateListOfPlayers();

        if (PhotonNetwork.room.PlayerCount < MIN_PLAYER_COUNT)
        {
            TxtWaitForPlayer.text = string.Format("Waiting for {0} more players to start", (MIN_PLAYER_COUNT - PhotonNetwork.room.PlayerCount));// + "/" + PhotonNetwork.room.MaxPlayers);
            return;
        }

        if (PhotonNetwork.isMasterClient)
        {
            view.RPC("SynchronizeTime", PhotonTargets.All, elapsedTime);
        }
        else
        {
            view.RPC("AskTimeSynchronization", PhotonTargets.MasterClient);
        }
        TxtWaitForPlayer.text = "";

        if (!playing)
        {
            //Spawnpoint
            Vector3 sp = new Vector3(SpawnPoint.transform.position.x + Random.Range(-150.0f, 150.0f), SpawnPoint.transform.position.y, SpawnPoint.transform.position.z + Random.Range(-75.0f, 75.0f));

            GameObject MyPlayer;

            MyPlayer = PhotonNetwork.Instantiate(PlayerPrefab.name, sp, Quaternion.identity, 0);
            MyPlayer.GetComponent <FirstPersonController>().enabled = true;
            MyPlayer.GetComponentInChildren <Camera>().enabled      = true;

            MyPlayer.GetComponentInChildren <Camera>().GetComponent <AudioListener>().enabled = true;

            UpdateListOfPlayers();
            playing = true;
        }
    }
    private void CheckWaitForPlayers()
    {
        // Tant que les 2 joueurs ne sont pas connectés, on affiche un message d'attente
        if (PhotonNetwork.room.PlayerCount < 2)
        {
            PhotonNetwork.SetMasterClient(PhotonNetwork.player);
            txtWaitPlayers.text = "Attente des joueurs ... [" + PhotonNetwork.room.PlayerCount + "/" + PhotonNetwork.room.MaxPlayers + "]";
            return;
        }
        else
        {
            txtWaitPlayers.text = "";
            isStarted           = true;

            var sp = new Vector3(0, 0, 0);
            if (PhotonNetwork.isMasterClient)
            {
                sp = new Vector3(0.0f, 1.33f, 0.70f);
            }
            else
            {
                sp = new Vector3(0.0f, 1.33f, 3.30f);
            }

            GameObject MyPlayer;
            MyPlayer = PhotonNetwork.Instantiate(
                "Player_3",
                sp,
                Quaternion.identity,
                0
                );
            MyPlayer.GetComponent <Transform>().Rotate(-90f, 0, 0);
            MyPlayer.GetComponent <PlayerController_3>().enabled = true;
            MyPlayer.GetComponentInChildren <Camera>().enabled   = true;
            MyPlayer.GetComponentInChildren <Canvas>().enabled   = true;
        }
    }
Example #7
0
    void OnJoinedRoom()
    {
        if (PhotonNetwork.room.PlayerCount < PhotonNetwork.room.MaxPlayers)
        {
            TxtAttente.text = "Attente de joueurs " + PhotonNetwork.room.PlayerCount + "/2";
            return;
        }
        else
        {
            PanelAttente.SetActive(false);
        }

        inRoom = true;
        TxtConnexionState.text   = "Room : " + PhotonNetwork.room.Name;
        TxtMyPlayerNickname.text = PhotonNetwork.player.NickName;

        //Spawnpoint

        Vector3 sp;

        sp = new Vector3(
            SpawnPoint.transform.position.x + Random.Range(-4f, 4f),
            SpawnPoint.transform.position.y,
            SpawnPoint.transform.position.z);

        sp += SpawnPoint.transform.position;

        GameObject MyPlayer;

        MyPlayer = PhotonNetwork.Instantiate
                       (PlayerPrefab.name, sp, Quaternion.identity, 0);
        MyPlayer.GetComponent <mummyController>().enabled  = true;
        MyPlayer.GetComponentInChildren <Camera>().enabled = true;
        MyPlayer.GetComponentInChildren <Camera>().GetComponent <AudioListener>().enabled = true;
        UpdateListOfPlayers();
    }
Example #8
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            Game.Services.GetService <Camera2D>().LookAt(MyPlayer.GetComponent <TransformComponent>().Position);
        }