Exemple #1
0
    /// <summary>
    /// The start.
    /// </summary>
    public void Start()
    {
        this.mapPosition = new Vector2(50, 250);

        // Make the game run even when in background
        Application.runInBackground = true;
#if UNITY_IPHONE
        iPhoneSettings.verticalOrientation = false;
        iPhoneSettings.screenCanDarken     = false;
#endif

        try
        {
            if (this.IsDebugLogEnabled)
            {
                Debug.Log("Start");
            }

            Settings settings = Settings.GetDefaultSettings();
            this.Game = new Game(this, settings, "Unity");
            this.game.Avatar.SetText("Unity");
            Photon.MmoDemo.Client.PhotonPeer peer = new Photon.MmoDemo.Client.PhotonPeer(this.Game, settings.UseTcp);
            this.Game.Initialize(peer);

            RoundTripTime.Game = this.Game;
        }
        catch (Exception e)
        {
            Debug.Log(e.ToString());
        }
    }
    /// <summary>
    /// The start.
    /// </summary>
    public void Start()
    {
        try
        {
            this.style.normal.textColor = Color.white;

            // Make the game run even when in background
            Application.runInBackground = true;

            if (this.IsDebugLogEnabled)
            {
                Debug.Log("Start");
            }

            Settings settings = Settings.GetDefaultSettings();
            this.engine = new Game(this, settings, "Unity");
            this.engine.Avatar.SetText("Unity");
            GameObject player = GameObject.Find(PlayerAvatarTag);//GameObject.Find("First Person Controller Prefab");
            //
            this.engine.Avatar.MoveAbsolute(Player.GetPosition(player.transform.position), Player.GetRotation(player.transform.rotation.eulerAngles));
            this.engine.Avatar.ResetPreviousPosition();

            Photon.MmoDemo.Client.PhotonPeer peer = new Photon.MmoDemo.Client.PhotonPeer(this.engine, settings.UseTcp);
            this.engine.Initialize(peer);

            RTT rttBehaviour = (RTT)this.gameObject.AddComponent(typeof(RTT));
            rttBehaviour.Initialize(this.engine);

            this.camHeight = Camera.main.transform.position.y - Terrain.activeTerrain.SampleHeight(Camera.main.transform.position);
        }
        catch (Exception e)
        {
            Debug.Log(e);
        }
    }
 public void Awake()
 {
     if (IsDebugLogEnabled)
     {
         Debug.Log("Awake");
     }
     DemoSettings settings = DemoSettings.GetDefaultSettings();
     this.Game = new Game(this, settings, "unity");
     var peer = new PhotonPeer(this.Game, settings.UseTcp ? ConnectionProtocol.Tcp : ConnectionProtocol.Udp) { ChannelCount = 3 };
     this.Game.Initialize(peer);
 }
 /// <summary>
 /// The counter subscribe.
 /// </summary>
 /// <param name="peer">
 /// The photon peer.
 /// </param>
 /// <param name="receiveInterval">
 /// The receive interval.
 /// </param>
 public static void CounterSubscribe(PhotonPeer peer, int receiveInterval)
 {
     var data = new Dictionary<byte, object> { { (byte)ParameterCode.CounterReceiveInterval, receiveInterval } };
     peer.OpCustom((byte)OperationCode.SubscribeCounter, data, true, Settings.DiagnosticsChannel);
 }
 /// <summary>
 /// The radar subscribe.
 /// </summary>
 /// <param name="peer">
 /// The photon peer.
 /// </param>
 /// <param name="worldName">
 /// The world Name.
 /// </param>
 public static void RadarSubscribe(PhotonPeer peer, string worldName)
 {
     var data = new Dictionary<byte, object> { { (byte)ParameterCode.WorldName, worldName } };
     peer.OpCustom((byte)OperationCode.RadarSubscribe, data, true, Settings.RadarChannel);
 }
Exemple #6
0
 /// <summary>
 ///   The initialize.
 /// </summary>
 /// <param name = "photonPeer">
 ///   The photon peer.
 /// </param>
 public void Initialize(PhotonPeer photonPeer)
 {
     this.peer = photonPeer;
     this.stateStrategy = WaitingForConnect.Instance;
     photonPeer.Connect(this.settings.ServerAddress, this.settings.ApplicationName);
 }
Exemple #7
0
    /// <summary>
    /// The start.
    /// </summary>
    public void Start()
    {
        try
        {
            this.style.normal.textColor = Color.white;

            // Make the game run even when in background
            Application.runInBackground = true;

            if (this.IsDebugLogEnabled)
            {
                Debug.Log("Start");
            }

            Settings settings = Settings.GetDefaultSettings();
            this.engine = new Game(this, settings, "Unity");
            this.engine.Avatar.SetText("Player");

            GameObject player = GameObject.Find("player");
            this.engine.Avatar.MoveAbsolute(Player.GetPosition(player.transform.position), Player.GetRotation(player.transform.rotation.eulerAngles));
            this.engine.Avatar.ResetPreviousPosition();

            ChatGUI.MessagesTab1.Add("Initializing MMOEngine...");
            Photon.MmoDemo.Client.PhotonPeer peer = new Photon.MmoDemo.Client.PhotonPeer(this.engine, settings.UseTcp);
            this.engine.Initialize(peer);

            RTT rttBehaviour = (RTT)this.gameObject.AddComponent(typeof(RTT));
            rttBehaviour.Initialize(this.engine);

            this.camHeight = Camera.main.transform.position.y - Terrain.activeTerrain.SampleHeight(Camera.main.transform.position);
        }
        catch (Exception e)
        {
            Debug.Log(e);
        }
    }
    /// <summary>
    /// The start.
    /// </summary>
    public void Start()
    {
        this.mapPosition = new Vector2(50, 250);

        // Make the game run even when in background
        Application.runInBackground = true;
        #if UNITY_IPHONE
            iPhoneSettings.verticalOrientation = false;
            iPhoneSettings.screenCanDarken = false;
        #endif

        try
        {
            if (this.IsDebugLogEnabled)
            {
                Debug.Log("Start");
            }

            Settings settings = Settings.GetDefaultSettings();
            this.Game = new Game(this, settings, "Unity");
            this.game.Avatar.SetText("Unity");
            Photon.MmoDemo.Client.PhotonPeer peer = new Photon.MmoDemo.Client.PhotonPeer(this.Game, settings.UseTcp);
            this.Game.Initialize(peer);

            RoundTripTime.Game = this.Game;
        }
        catch (Exception e)
        {
            Debug.Log(e.ToString());
        }
    }
Exemple #9
0
 public void Initialize(PhotonPeer photonPeer)
 {
     this.peer = photonPeer;
     this.registerTypes();
 }
Exemple #10
0
 private void registerTypes()
 {
     PhotonPeer.RegisterType(typeof(Vector), (byte)Common.Protocol.CustomTypeCodes.Vector, Common.Protocol.SerializeVector, Common.Protocol.DeserializeVector);
     PhotonPeer.RegisterType(typeof(BoundingBox), (byte)Common.Protocol.CustomTypeCodes.BoundingBox, Common.Protocol.SerializeBoundingBox, Common.Protocol.DeserializeBoundingBox);
 }
Exemple #11
0
 public void Initialize(PhotonPeer photonPeer)
 {
     this.peer = photonPeer;
     this.registerTypes();
 }