コード例 #1
0
ファイル: Game.cs プロジェクト: MiYanLiang/PhotonServerDemo
        public void EnterWorld()
        {
            var r        = new Random();
            var d        = this.WorldData.BoundingBox.Max - this.WorldData.BoundingBox.Max;
            var position = this.WorldData.BoundingBox.Min + new Vector {
                X = d.X * (float)r.NextDouble(), Y = d.Y * (float)r.NextDouble()
            };

            this.Avatar.SetPositions(position, position, Vector.Zero, Vector.Zero);

            Operations.EnterWorld(this, this.WorldData.Name, this.Avatar.Id, this.Avatar.BuildProperties(), this.Avatar.Position, this.Avatar.Rotation, this.Avatar.ViewDistanceEnter, this.Avatar.ViewDistanceExit);
        }
コード例 #2
0
        public void EnterWorld()
        {
            var r        = new Random();
            var d        = this.WorldData.BoundingBox.Max - this.WorldData.BoundingBox.Max;
            var position = this.WorldData.BoundingBox.Min + new Vector {
                X = d.X * (float)r.NextDouble(), Y = d.Y * (float)r.NextDouble()
            };

            this.Avatar.SetPositions(position, position, Vector.Zero, Vector.Zero);
            if (this.listener.IsDebugLogEnabled)
            {
                this.listener.LogDebug("Avatar: " + this.Avatar.Id + " has entered da world at");
            }
            Operations.EnterWorld(this, this.WorldData.Name, this.Avatar.Id, this.Avatar.BuildProperties(), this.Avatar.Position, this.Avatar.Rotation, this.Avatar.ViewDistanceEnter, this.Avatar.ViewDistanceExit);
        }
コード例 #3
0
        /// <summary>
        /// The enter world.
        /// </summary>
        public void EnterWorld()
        {
            var r        = new Random();
            var position = new float[]
            {
                r.Next((int)this.Game.WorldData.TopLeftCorner[0], (int)this.Game.WorldData.BottomRightCorner[0]),
                r.Next((int)this.Game.WorldData.TopLeftCorner[1], (int)this.Game.WorldData.BottomRightCorner[1])
            };

            this.SetPositions(position, position, null, null);

            var properties = new Hashtable
            {
                { PropertyKeyInterestAreaAttached, this.InterestAreaAttached },
                { PropertyKeyViewDistanceEnter, this.ViewDistanceEnter },
                { PropertyKeyViewDistanceExit, this.ViewDistanceExit },
                { PropertyKeyColor, this.Color },
                { PropertyKeyText, this.Text }
            };

            Operations.EnterWorld(this.Game, this.Game.WorldData.Name, this.Id, properties, this.Position, this.Rotation, this.ViewDistanceEnter, this.ViewDistanceExit);
        }