/// <summary>
 /// Creates a new entity with the given parameters that displays the specified animation.
 /// </summary>
 /// <param name="animation">Animation that the entity should display.</param>
 /// <param name="position">Position to create the entity at.</param>
 /// <param name="layer">The layer of of a <see cref="BasicEntity"/> the object should be assigned to.</param>
 /// <param name="isWalkable">Whether or not this object collides with other non-walkable objects in the same <see cref="BasicMap"/>.</param>
 /// <param name="isTransparent">Whether or not this object is considered blocking line of sight for the sake of FOV.</param>
 public BasicEntity(AnimatedConsole animation, Coord position, int layer, bool isWalkable, bool isTransparent)
     : base(animation) => Initialize(position, layer, isWalkable, isTransparent);
Exemplo n.º 2
0
        public SerializationTests() : base(80, 23)
        {
            //Settings.SerializationIsCompressed = true;
            controlsConsole = new ControlsConsole(80, 4);

            masterView = new Console(34, 15);
            loadedView = new Console(34, 15);

            masterView.Fill(Color.White, Color.Red, 0);
            loadedView.Fill(Color.White, Color.Blue, 0);

            UseMouse = true;

            // Add the consoles to the list.
            Children.Add(controlsConsole);
            Children.Add(masterView);
            Children.Add(loadedView);

            // Setup main view
            masterView.Position = new Point(3, 6);

            // Setup sub view
            loadedView.Position = new Point(80 - 37, 6);


            // Setup controls
            controlsConsole.Position = new Point(0, 0);

            optionButtonSurface = new SadConsole.Controls.RadioButton(18, 1)
            {
                Text     = "Surface",
                Position = new Point(1, 1),
            };
            optionButtonSurface.IsSelectedChanged += OptionButton_IsSelectedChanged;
            controlsConsole.Add(optionButtonSurface);

            optionButtonView = new SadConsole.Controls.RadioButton(18, 1)
            {
                Text     = "Surface View",
                Position = new Point(1, 2)
            };
            optionButtonView.IsSelectedChanged += OptionButton_IsSelectedChanged;
            controlsConsole.Add(optionButtonView);

            optionButtonLayered = new SadConsole.Controls.RadioButton(21, 1)
            {
                Text     = "Layered Surface",
                Position = new Point(optionButtonSurface.Bounds.Right + 1, 1)
            };
            optionButtonLayered.IsSelectedChanged += OptionButton_IsSelectedChanged;
            controlsConsole.Add(optionButtonLayered);

            optionButtonAnimated = new SadConsole.Controls.RadioButton(21, 1)
            {
                Text     = "Animated Surface",
                Position = new Point(optionButtonSurface.Bounds.Right + 1, 2)
            };
            optionButtonAnimated.IsSelectedChanged += OptionButton_IsSelectedChanged;
            controlsConsole.Add(optionButtonAnimated);

            var buttonSave = new SadConsole.Controls.Button(17, 1)
            {
                Text     = "Save and Load",
                Position = new Point(controlsConsole.Width - 19, 1)
            };

            buttonSave.Click += ButtonSave_Click;
            controlsConsole.Add(buttonSave);

            basicSurface = new SadConsole.Console(34, 15);

            animatedSurface = SadConsole.AnimatedConsole.CreateStatic(34, 15, 15, 0.3d);
            viewSurface     = new Console(1, 1);
            viewSurface.SetSurface(basicSurface, new Rectangle(5, 2, 34 - 10, 15 - 4));
            //emptySurface = (SadConsole.Surfaces.BasicSurface)loadedView.TextSurface;

            MakeBasicSurface();
            MakeLayeredSurface();

            optionButtonSurface.IsSelected = true;
        }