コード例 #1
0
ファイル: Menu.cs プロジェクト: righnatios/HenryRTS
 public Menu() : base("MenuBackgroundDefault") {
     //a menu will fit its bounds to the camera
     Bounds = new Zone(Global.Camera.TopLeftCorner.X, Global.Camera.TopLeftCorner.Y,
                         (Global.Camera.Center.X - Global.Camera.TopLeftCorner.X) * 2,
                         (Global.Camera.Center.Y - Global.Camera.TopLeftCorner.Y) * 2);
     background.Bounds.Center = Bounds.Center;
 }
コード例 #2
0
 public ControllableObject(Player owner, Zone initialBounds)
     : base(initialBounds)
 {
     Owner = owner;
     Owner.AddObject(this);
     currentTask = new IdleTask();
     currentTask.Finished = true;
 }
コード例 #3
0
ファイル: Resource.cs プロジェクト: righnatios/HenryRTS
 public Resource(Zone initialBounds)
     : base(initialBounds)
 {
     //initialize element array
     elements = new int[88];
     for (int i = 0; i < Elements.Length; i++) {
         elements[i] = 0;
     }
     //initialize sprites
     Idle = new Animation("WhitePixel");
     BeingMined = new Animation("WhitePixel");
     Consumed = new Animation("WhitePixel");
 }
コード例 #4
0
ファイル: SpriteGroup.cs プロジェクト: righnatios/HenryRTS
 public override void Draw()
 {
     base.Draw();
     foreach (GroupedSprite gs in Sprites.Values) {
         if (gs.IsVisible) {
             if (FitSpritesToBounds)
                 gs.Sprite.Draw(new Zone(Left, Top, Width, Height));
             else {
                 Zone z = new Zone(0, 0, gs.Sprite.Bounds.Width, gs.Sprite.Bounds.Height);
                 z.Center = Center + gs.Offset;
                 gs.Sprite.Draw(z);
             }
         }
     }
 }
コード例 #5
0
ファイル: MapObject.cs プロジェクト: righnatios/HenryRTS
        private Vector2 position; //the center of the MapObject

        #endregion Fields

        #region Constructors

        public MapObject(Zone initialBounds)
        {
            this.bounds = initialBounds;
            this.bounds.LockDimensions = true;
            this.position = new Vector2(-1, -1);
            if (!(this is EmptySpace || this is Location)) {
                //set the position of this object to place in the map array
                Position = new Vector2(bounds.Left, bounds.Top);
                //add this object to the list of map objects
                Scenario.Map.AddObject(this);
            }
            this.position = bounds.Center.Vector;

            //development diagnostic
            DrawBorder = true;
        }
コード例 #6
0
ファイル: Scenario.cs プロジェクト: righnatios/HenryRTS
        //moar to come!
        public Scenario()
        {
            //set up Screen stuff
            Bounds = new Zone(0, 0, 2048, 2048);
            background.SpriteName = "Dirt";
            background.Bounds = new Zone(0, 0, 2048, 2048);

            //set up Map (based on configuration variables above)
            map = new RandomMap(new Point(2048, 2048), MapType);
            players = new List<Player>();

            instance = this;

            ((RandomMap)map).Populate();
            players.Add(new HumanPlayer(Color.Red));

            new Gatherer(Players[0], new Point(400, 400));
            new BigAssWall(Players[0], Map, new Point(500, 20));
        }
コード例 #7
0
ファイル: ProgressBar.cs プロジェクト: righnatios/HenryRTS
 public override void Draw()
 {
     Zone z = new Zone(Bounds.Center.X, Bounds.Center.Y, 0, 0);
     //draw the border
     pixel.Color = BorderColor;
     pixel.Draw(Bounds);
     //draw the left half
     pixel.Color = FillColor1;
     z.Left = Bounds.Left + BorderThickness;
     z.Top = Bounds.Top - BorderThickness;
     z.Bottom = Bounds.Bottom + BorderThickness;
     z.Right = z.Left + (int)(factorFull * (Bounds.Width - 2 * BorderThickness));
     pixel.Draw(z);
     //draw the right half
     pixel.Color = FillColor2;
     z.Right = Bounds.Right - BorderThickness;
     z.Left = z.Right - (int)((1.0f - factorFull) * (Bounds.Width - 2 * BorderThickness));
     pixel.Draw(z);
 }
コード例 #8
0
ファイル: Unit.cs プロジェクト: righnatios/HenryRTS
        public Unit(Player owner, Zone initialBounds)
            : base(owner, initialBounds)
        {
            Idle = new Animation("WhitePixel");
            Idle.Bounds.Width = this.Width;
            Idle.Bounds.Height = this.Height;

            Moving = new Animation("WhitePixel");
            Moving.Bounds.Width = this.Width;
            Moving.Bounds.Height = this.Height;

            Attacking = new Animation("WhitePixel");
            Attacking.Bounds.Width = this.Width;
            Attacking.Bounds.Height = this.Height;

            Dying = new Animation("WhitePixel");
            Dying.Bounds.Width = this.Width;
            Dying.Bounds.Height = this.Height;
        }
コード例 #9
0
ファイル: ResourceBar.cs プロジェクト: righnatios/HenryRTS
        public void Draw(Resource r)
        {
            //draw the border
            pixel.Color = BorderColor;
            pixel.Draw(new Zone(Bounds.Left, Bounds.Top, Bounds.Width - 1, Bounds.Height));

            //draw each element
            Zone z = new Zone(Bounds.Left + BorderThickness, Bounds.Top + BorderThickness, 0, 0);
            z.Bottom = Bounds.Bottom - BorderThickness;
            float percentageComplete = 0.0f;
            for (int i = 0; i < 88; i++) {
                if (r.Elements[i] == 0) continue; //only proceed if there's something worth drawing
                pixel.Color = Elements.GetElement(i).Color; //draw it the corresponding element color
                float width = ((float)r.Elements[i] / (float)r.TotalUnits) * ((float)Bounds.Width - 2 * BorderThickness);

                z.Right = (int)(Bounds.Left + BorderThickness + percentageComplete * (Bounds.Width - 2 * BorderThickness) + width);
                z.Left = (int)(Bounds.Left + BorderThickness + percentageComplete * (Bounds.Width - 2 * BorderThickness));

                percentageComplete += (float)r.Elements[i] / (float)r.TotalUnits;

                pixel.Draw(z);
            }
        }
コード例 #10
0
ファイル: ProgressBar.cs プロジェクト: righnatios/HenryRTS
 public ProgressBar(Zone bounds)
 {
     Bounds = bounds;
 }
コード例 #11
0
ファイル: Utility.cs プロジェクト: righnatios/HenryRTS
 public static void DrawPixel(Zone bounds, Color color) {
     if (pixel == null)
         pixel = new Sprite("WhitePixel");
     pixel.Color = color;
     pixel.Draw(bounds);
 }
コード例 #12
0
ファイル: Zone.cs プロジェクト: righnatios/HenryRTS
 public bool Contains(Zone z)
 {
     if (this.Mode != z.Mode)
         throw new Exception("Attempted to compare zones of differing coordinate modes.");
     else {
         return (this.Left <= z.Left
             && this.Right >= z.Right
             && this.Top <= z.Top
             && this.Bottom >= z.Bottom);
     }
 }
コード例 #13
0
ファイル: Sprite.cs プロジェクト: righnatios/HenryRTS
 public void Draw(Zone z)
 {
     //draw this sprite to an external Zone
     Global.SpriteBatch.Draw(Sprites.Textures[texture], z.WindowCoordinates.Rectangle, frame, Color);
 }
コード例 #14
0
ファイル: Screen.cs プロジェクト: righnatios/HenryRTS
        public Screen(string backgroundSpriteName = "None") {
            
            background = new Sprite(backgroundSpriteName);
            Bounds = new Zone(0, 0, background.Bounds.Width, background.Bounds.Height);

        }
コード例 #15
0
ファイル: Zone.cs プロジェクト: righnatios/HenryRTS
 public void DrawBorder()
 {
     Zone z = new Zone();
         z.Center = Center;
         //top line
         z.Left = Left - 1;
         z.Top = Top - 1;
         z.Right = Right;
         z.Bottom = Top;
         Utility.DrawPixel(z, Color.Tomato);
         //right line
         z.Right = Right + 1;
         z.Left = Right;
         z.Bottom = Bottom;
         Utility.DrawPixel(z, Color.Tomato);
         //bottom line
         z.Bottom = Bottom + 1;
         z.Top = Bottom;
         z.Left = Left;
         Utility.DrawPixel(z, Color.Tomato);
         //left line
         z.Left = Left - 1;
         z.Right = Left;
         z.Top = Top;
         Utility.DrawPixel(z, Color.Tomato);
 }
コード例 #16
0
ファイル: Mouse.cs プロジェクト: righnatios/HenryRTS
        public static void Draw()
        {
            cursor.Draw();
            pixel.Color = Color.ForestGreen;
            pixel.Color.A = 1;
            pixel.Draw(SelectionBox);

            pixel.Color = Color.White;
            //draw four lines by stretching pixel
            Zone z = new Zone(Zone.ZoneModeEnum.WindowCoordinates, 0, 0, 0, 0);
            //top line
            z.Left = SelectionBox.Left;
            z.Right = SelectionBox.Right;
            z.Top = SelectionBox.Top;
            z.Bottom = SelectionBox.Top + 1;
            pixel.Draw(z);
            //bottom line
            z.Bottom = SelectionBox.Bottom;
            z.Top = SelectionBox.Bottom - 1;
            pixel.Draw(z);
            //left line
            z.Right = SelectionBox.Left + 1;
            z.Top = SelectionBox.Top;
            pixel.Draw(z);
            //right line
            z.Right = SelectionBox.Right;
            z.Left = SelectionBox.Right - 1;
            pixel.Draw(z);
        }
コード例 #17
0
ファイル: BoundedObject.cs プロジェクト: righnatios/HenryRTS
 public BoundedObject() {
     Bounds = new Zone(0, 0, 0, 0);
 }
コード例 #18
0
 public SelectableObject(Zone bounds)
     : base(bounds)
 {
 }
コード例 #19
0
ファイル: ResourceBar.cs プロジェクト: righnatios/HenryRTS
 //this special type of bar is for Resource objects and display all the elements
 //contained by the Resource according to color and percentage
 public ResourceBar(Zone initialBounds)
     : base(initialBounds)
 {
 }
コード例 #20
0
ファイル: SpriteGroup.cs プロジェクト: righnatios/HenryRTS
 public SpriteGroup(Map m, Zone initialBounds)
     : base(m, initialBounds)
 {
 }
コード例 #21
0
ファイル: Tester.cs プロジェクト: righnatios/HenryRTS
 public Tester(Zone z)
 {
     ts.Font = Fonts.Consolas;
     ts.Text = "Test String";
     ts.Origin = Global.Origins.Bottom;
 }
コード例 #22
0
ファイル: EmptySpace.cs プロジェクト: righnatios/HenryRTS
 //this class is used by MapObject and Map to designate an empty area of the map
 public EmptySpace(Zone bounds)
     : base(bounds)
 {
 }
コード例 #23
0
ファイル: BoundedObject.cs プロジェクト: righnatios/HenryRTS
 public BoundedObject(Zone initialBounds) {
     Bounds = initialBounds;
 }
コード例 #24
0
        public AnimatedMapObject(Zone bounds) : base(bounds) {

        }
コード例 #25
0
ファイル: OffensiveUnit.cs プロジェクト: righnatios/HenryRTS
 public OffensiveUnit(Player owner, Zone bounds) : base(owner, bounds) {
 }