Example #1
0
        public Game(IGameListener listener, Settings settings, string avatarName)
        {
            this.listener = listener;
            this.settings = settings;

            this.avatar = new MyItem(this, Guid.NewGuid().ToString(), ItemType.Avatar, avatarName);

            this.AddItem(this.Avatar);
            this.AddCamera(new InterestArea(0, this, this.avatar));
            this.WorldData = new WorldData
                {
                    BoundingBox = new BoundingBox
                    {
                        Min = new Vector(),
                        Max = new Vector(settings.GridSize.X, settings.GridSize.Y)
                    },
                    Name = this.settings.WorldName,
                    TileDimensions = this.settings.TileDimensions
                };
        }
Example #2
0
        /// <summary>
        ///   Initializes a new instance of the <see cref = "Game" /> class.
        /// </summary>
        /// <param name = "listener">
        ///   The listener.
        /// </param>
        /// <param name = "settings">
        ///   The settings.
        /// </param>
        /// <param name = "avatarName">
        ///   The avatar Name.
        /// </param>
        public Game(IGameListener listener, Settings settings, string avatarName)
        {
            this.listener = listener;
            this.settings = settings;

            this.avatar = new MyItem(Guid.NewGuid().ToString(), (byte)ItemType.Avatar, this, avatarName);
            this.avatar.AddVisibleInterestArea(0);

            this.AddItem(this.Avatar);
            this.AddCamera(new InterestArea(0, this, this.avatar));
            this.WorldData = new WorldData
                {
                    TopLeftCorner = new[] { 1f, 1f }, 
                    BottomRightCorner = new float[] { this.settings.GridSize[0], this.settings.GridSize[1] }, 
                    Name = this.settings.WorldName, 
                    TileDimensions = new float[] { this.settings.TileDimensions[0], this.settings.TileDimensions[1] }
                };

            this.stateStrategy = Disconnected.Instance;
        }