Example #1
0
        public NodeEntity GetEnemyTown(NobleQuestGame game, Vector2 position)
        {
            // Instantiate and Set Properties in GameEntity
            TownNode town = new TownNode(game, Owners.ENEMY);

            town.Texture         = game.Content.Load <Texture2D>("EnemyCity");
            town.Position        = position;
            town.Velocity        = new Vector2(0f, 0f);
            town.Midpoint        = new Vector2(town.Texture.Width / 2, town.Texture.Height / 2);
            town.Rotation        = 0.0f;
            town.SrcRectangle    = new Rectangle(0, 0, town.Texture.Width, town.Texture.Height);
            town.DestRectangle   = new Rectangle(0, 0, town.Texture.Width, town.Texture.Height);
            town.DestRectangle.X = (int)(town.Position.X - town.Midpoint.X);
            town.DestRectangle.Y = (int)(town.Position.Y - town.Midpoint.Y);
            town.Owner           = Owners.ENEMY;

            // Set Properties in NodeEntity
            town.HasResourceStructure = true;
            town.LeftPaths            = new List <PathEntity>();
            town.RightPaths           = null;
            town.PreferredPathEntity  = null;
            town.HasFort = true;
            town.isTown  = true;

            // Set Properties in TownNode


            return(town);
        }
Example #2
0
        public NodeEntity GetNode(NobleQuestGame game, Vector2 position)
        {
            // Instantiate and Set Properties in GameEntity
            NodeEntity grassNode = new NodeEntity(game);

            grassNode.Position = position;
            grassNode.Velocity = new Vector2(0f, 0f);
            grassNode.Midpoint = new Vector2(grassNode.Texture.Width / 2, grassNode.Texture.Height / 2);
            //grassNode.Midpoint = new Vector2(0f, 0f);
            grassNode.Rotation        = 0.0f;
            grassNode.SrcRectangle    = new Rectangle(0, 0, grassNode.Texture.Width, grassNode.Texture.Height);
            grassNode.DestRectangle   = new Rectangle(0, 0, grassNode.Texture.Width, grassNode.Texture.Height);
            grassNode.DestRectangle.X = (int)(grassNode.Position.X - grassNode.Midpoint.X);
            grassNode.DestRectangle.Y = (int)(grassNode.Position.Y - grassNode.Midpoint.Y);
            grassNode.Owner           = Owners.NEUTRAL;

            // Set Properties in NodeEntity
            grassNode.HasResourceStructure = false;
            grassNode.LeftPaths            = new List <PathEntity>();
            grassNode.RightPaths           = new List <PathEntity>();
            grassNode.PreferredPathEntity  = null;
            grassNode.HasFort = false;
            grassNode.Fort    = null;
            grassNode.isTown  = false;

            return(grassNode);
        }
Example #3
0
        public TownNode(NobleQuestGame Game, Owners Owner) : base(Game)
        {
            this.HitPointMax = 1000;
            this.HitPoint    = 1000;
            this.Damage      = 5;

            this.Owner = Owner;

            this.HitBar = new HitPointBarEntity(this.Game);
            this.HitBar.AssociatedEntity = this;
            this.HitBar.Background       =
                this.Game.Content.Load <Texture2D>("TownHitBarBackground");
            this.HitBar.Foreground =
                this.Game.Content.Load <Texture2D>("TownHitBar");
            this.HitBar.UpdatePosition = false;
            if (this.Owner == Owners.PLAYER)
            {
                this.HitBar.Position.X = 10;
                this.HitBar.Position.Y = 10;
            }
            else
            {
                this.HitBar.Position.X =
                    this.Game.Graphics.PreferredBackBufferWidth - this.HitBar.Background.Width - 10;
                this.HitBar.Position.Y      = 10;
                this.HitBar.InvertDirection = true;
            }
        }
Example #4
0
 public InfantryEntity(NobleQuestGame Game) : base(Game)
 {
     this.unitType = UnitType.INFANTRY;
     HitPointMax   = 100;
     HitPoint      = 100;
     Damage        = 20;
     this.Game     = Game;
 }
Example #5
0
 public ArcherEntity(NobleQuestGame Game)
     : base(Game)
 {
     HitPointMax   = 100;
     HitPoint      = 100;
     Damage        = 20;
     this.Game     = Game;
     this.unitType = UnitType.ARCHER;
 }
Example #6
0
 public KnightEntity(NobleQuestGame Game)
     : base(Game)
 {
     HitPointMax   = 100;
     HitPoint      = 100;
     Damage        = 20;
     this.Game     = Game;
     this.unitType = UnitType.KNIGHT;
 }
Example #7
0
 public HitPointBarEntity(NobleQuestGame Game)
 {
     this.Game                   = Game;
     this.Background             = this.Game.Content.Load <Texture2D>("HitPointBackground");
     this.Foreground             = this.Game.Content.Load <Texture2D>("HitPointBar");
     this.Rotation               = 0f;
     this.Midpoint               = Vector2.Zero;
     this.ForegroundPosition     = Vector2.Zero;
     this.SrcForegroundRectangle = new Rectangle();
 }
Example #8
0
        public WorkerEntity(NobleQuestGame Game) : base(Game)
        {
            HitPointMax = 100;
            HitPoint    = 100;
            Damage      = 5;

            nodesVisited           = new HashSet <NodeEntity>();
            this.CanMoveToNonOwned = false;
            this.IgnoresOrders     = true;
            this.IsWorker          = true;
        }
Example #9
0
 public NodeEntity(NobleQuestGame Game)
 {
     this.Game          = Game;
     PlayerNodeTexture  = this.Game.Content.Load <Texture2D>("PlayerNodeTexture");
     EnemyNodeTexture   = this.Game.Content.Load <Texture2D>("EnemyNodeTexture");
     NeutralNodeTexture = this.Game.Content.Load <Texture2D>("NeutralNodeTexture");
     OrderTexture       = this.Game.Content.Load <Texture2D>("HaltOrderTexture");
     this.Texture       = NeutralNodeTexture;
     IsOccupied         = false;
     Order = Orders.NONE;
 }
Example #10
0
        public DynamicEntity GetInfantryEntity(NobleQuestGame game, Owners OwnedBy, GameEntity town)
        {
            // Instantiate and Set Properties in GameEntity
            InfantryEntity infantryEntity = new InfantryEntity(game);

            switch (OwnedBy)
            {
            case Owners.PLAYER:
                infantryEntity.Texture   = game.Content.Load <Texture2D>("PlayerInfantry");
                infantryEntity.Direction = DynamicEntity.Directions.RIGHT;
                break;

            case Owners.ENEMY:
                infantryEntity.Texture   = game.Content.Load <Texture2D>("EnemyInfantry");
                infantryEntity.Direction = DynamicEntity.Directions.LEFT;
                break;

            default:
                break;
            }

            infantryEntity.Position      = town.Position;
            infantryEntity.Velocity      = new Vector2(0f, 0f);
            infantryEntity.Midpoint      = new Vector2(DynamicEntity.DIMENSION / 2, DynamicEntity.DIMENSION / 2);
            infantryEntity.Rotation      = 0.0f;
            infantryEntity.SrcRectangle  = new Rectangle(0, 0, DynamicEntity.DIMENSION, DynamicEntity.DIMENSION);
            infantryEntity.DestRectangle = new Rectangle(
                (int)town.Position.X,
                (int)town.Position.Y,
                infantryEntity.SrcRectangle.Width, infantryEntity.SrcRectangle.Height);
            infantryEntity.Game  = game;
            infantryEntity.Owner = OwnedBy;
            infantryEntity.State = States.STOPPED;

            // Set Properties in Dynamic Entity
            infantryEntity.Location = (NodeEntity)town;

            if (town.TargetEntity != null)
            {
                infantryEntity.State        = States.ATTACKING;
                infantryEntity.TargetEntity = town.TargetEntity;
                //infantryEntity.Destination = town.TargetEntity.Location;

                town.TargetEntity.State        = States.ATTACKING;
                town.TargetEntity.TargetEntity = infantryEntity;
            }

            game.DynamicEntityList.Add(infantryEntity);

            return(infantryEntity);
        } // Get Infantry Entity
Example #11
0
        public GameEntity GetBackgroundEntity(NobleQuestGame game)
        {
            // Instantiate and Set Properties in GameEntity
            GameEntity NewEntity = new GameEntity();

            NewEntity.Texture       = game.Content.Load <Texture2D>("Background");
            NewEntity.Game          = game;
            NewEntity.Position      = Vector2.Zero;
            NewEntity.Velocity      = new Vector2(0f, 0f);
            NewEntity.Midpoint      = Vector2.Zero;
            NewEntity.Rotation      = 0.0f;
            NewEntity.SrcRectangle  = new Rectangle(0, 0, NewEntity.Texture.Width, NewEntity.Texture.Height);
            NewEntity.DestRectangle = new Rectangle((int)NewEntity.Position.X, (int)NewEntity.Position.Y,
                                                    NewEntity.SrcRectangle.Width, NewEntity.SrcRectangle.Height);

            return(NewEntity);
        }
Example #12
0
        public DynamicEntity(NobleQuestGame Game)
        {
            this.Game = Game;
            State     = States.STOPPED;
            Direction = Directions.RIGHT;

            HitPointMax = 0;
            HitPoint    = 0;
            Damage      = 0;

            HitBar = new HitPointBarEntity(this.Game);
            HitBar.AssociatedEntity = this;
            HitBar.InitBar();

            VisitedPath = new List <NodeEntity>();
            ToVisitPath = new List <NodeEntity>();
        }
Example #13
0
        } // Get Archer Entity

        public WorkerEntity GetWorkerEntity(NobleQuestGame game, Owners OwnedBy, TownNode town)
        {
            // Instantiate and Set Properties in GameEntity
            WorkerEntity workerEntity = new WorkerEntity(game);

            switch (OwnedBy)
            {
            case Owners.PLAYER:
                workerEntity.Texture   = game.Content.Load <Texture2D>("PlayerWorker");
                workerEntity.Direction = DynamicEntity.Directions.RIGHT;
                break;

            case Owners.ENEMY:
                workerEntity.Texture   = game.Content.Load <Texture2D>("EnemyWorker");
                workerEntity.Direction = DynamicEntity.Directions.LEFT;
                break;

            default:
                break;
            }

            workerEntity.Texture       = game.Content.Load <Texture2D>("Worker");
            workerEntity.Position      = town.Position;
            workerEntity.Velocity      = new Vector2(0f, 0f);
            workerEntity.Midpoint      = new Vector2(workerEntity.Texture.Width / 2, workerEntity.Texture.Height / 2);
            workerEntity.Rotation      = 0.0f;
            workerEntity.SrcRectangle  = new Rectangle(0, 0, DynamicEntity.DIMENSION, DynamicEntity.DIMENSION);
            workerEntity.DestRectangle = new Rectangle((int)town.Position.X, (int)town.Position.Y,
                                                       workerEntity.SrcRectangle.Width, workerEntity.SrcRectangle.Height);
            workerEntity.Game  = game;
            workerEntity.Owner = OwnedBy;
            workerEntity.State = States.STOPPED;

            // Set Properties in Dynamic Entity
            workerEntity.Location = (NodeEntity)town;

            game.DynamicEntityList.Add(workerEntity);

            return(workerEntity);
        }
Example #14
0
        public PathEntity GetPathEntity(NobleQuestGame game, NodeEntity leftNode, NodeEntity rightNode)
        {
            // Get Distance Between Nodes
            float  nodeDistance = Vector2.Distance(leftNode.Position, rightNode.Position);
            double rotation     = Math.Atan2(rightNode.Position.Y - leftNode.Position.Y, rightNode.Position.X - leftNode.Position.X);

            // Instantiate and Set Properties in GameEntity
            PathEntity pathEntity = new Entity.PathEntity();

            pathEntity.Texture  = game.Content.Load <Texture2D>("Path");
            pathEntity.Position = leftNode.Position;
            pathEntity.Velocity = new Vector2(0f, 0f);
            // pathEntity.Midpoint = new Vector2(pathEntity.Texture.Width / 2, pathEntity.Texture.Height / 2);
            pathEntity.Midpoint      = new Vector2(0f, pathEntity.Texture.Height / 2);
            pathEntity.Rotation      = (float)rotation;
            pathEntity.SrcRectangle  = new Rectangle(0, 0, (int)nodeDistance, pathEntity.Texture.Height);
            pathEntity.DestRectangle = new Rectangle((int)pathEntity.Position.X, (int)pathEntity.Position.Y,
                                                     (int)(Math.Abs(rightNode.Position.X - leftNode.Position.X)),
                                                     (int)(Math.Abs(rightNode.Position.Y - leftNode.Position.Y)));
            pathEntity.Game        = game;
            pathEntity.PlayerOwned = false;
            pathEntity.EnemyOwned  = false;

            // Set Properties in PathEntity
            pathEntity.LeftNode  = leftNode;
            pathEntity.RightNode = rightNode;

            // Set Properties in Nodes
            if (leftNode.RightPaths != null)
            {
                leftNode.RightPaths.Add(pathEntity);
            }
            if (rightNode.LeftPaths != null)
            {
                rightNode.LeftPaths.Add(pathEntity);
            }

            return(pathEntity);
        }
Example #15
0
        public GameEntity GetDefeatTextEntity(NobleQuestGame game)
        {
            // Instantiate and Set Properties in GameEntity
            GameEntity NewEntity = new GameEntity();

            NewEntity.Texture       = game.Content.Load <Texture2D>("DefeatText");
            NewEntity.Game          = game;
            NewEntity.Position      = Vector2.Zero;
            NewEntity.Position.X    = game.Graphics.PreferredBackBufferWidth / 2.0f;
            NewEntity.Position.Y    = game.Graphics.PreferredBackBufferHeight / 2.0f;
            NewEntity.Velocity      = new Vector2(0f, 0f);
            NewEntity.Midpoint      = Vector2.Zero;
            NewEntity.Midpoint.X    = NewEntity.Texture.Width / 2;
            NewEntity.Midpoint.Y    = NewEntity.Texture.Height / 2;
            NewEntity.Rotation      = 0.0f;
            NewEntity.Scale         = 2.00f;
            NewEntity.SrcRectangle  = new Rectangle(0, 0, NewEntity.Texture.Width, NewEntity.Texture.Height);
            NewEntity.DestRectangle = new Rectangle((int)NewEntity.Position.X, (int)NewEntity.Position.Y,
                                                    NewEntity.SrcRectangle.Width, NewEntity.SrcRectangle.Height);

            return(NewEntity);
        }
Example #16
0
        public ResourceEntity GetResourceEntity(NobleQuestGame game, Vector2 position, bool visible)
        {
            // Instantiate and Set Properties in GameEntity
            ResourceEntity resource = new ResourceEntity();

            resource.Texture       = game.Content.Load <Texture2D>("ResourceText");
            resource.Position      = position;
            resource.Velocity      = new Vector2(0f, 0f);
            resource.Midpoint      = new Vector2(0f, 0f);
            resource.Rotation      = 0.0f;
            resource.SrcRectangle  = new Rectangle(0, 0, resource.Texture.Width, resource.Texture.Height);
            resource.DestRectangle = new Rectangle((int)position.X, (int)position.Y,
                                                   resource.Texture.Width, resource.Texture.Height);
            resource.Game  = game;
            resource.Scale = 0.50f;

            // Set Properties in ResourceEntity
            resource.IsVisible = visible;

            game.GameEntityList.Add(resource);

            return(resource);
        }
Example #17
0
        public void BuildMap(NobleQuestGame game)
        {
            this.Game = game;

            GameEntity ThisGameEntity = null;

            float hudYOffset = game.Graphics.PreferredBackBufferHeight - 225.0f;

            this.Game.Enemy.Resources = EntityFactory.GetResourceEntity(game, new Vector2(0f, hudYOffset), false);

            ThisGameEntity        = EntityFactory.GetPlayerTown(this.Game, new Vector2(100f, MIDDLE_LANE_HEIGHT));
            this.Game.Player.Town = (TownNode)ThisGameEntity;
            this.Game.NodeEntityList.Add((NodeEntity)this.Game.Player.Town);

            Vector2 PlayerResourcePosition = this.Game.Player.Town.HitBar.Position;

            PlayerResourcePosition.Y += this.Game.Player.Town.HitBar.Background.Height + 5.0f;

            this.Game.Player.Resources = EntityFactory.GetResourceEntity(game, PlayerResourcePosition, true);

            ThisGameEntity       = EntityFactory.GetEnemyTown(this.Game, new Vector2(700f, MIDDLE_LANE_HEIGHT));
            this.Game.Enemy.Town = (TownNode)ThisGameEntity;
            this.Game.NodeEntityList.Add((NodeEntity)this.Game.Enemy.Town);

            // Build Top Lane
            this.BuildLane(TopLane, 100.0f, TOP_LANE_HEIGHT, game.Player.Town, game.Enemy.Town);

            // Build Middle Lane
            this.BuildLane(MiddleLane, 100.0f, MIDDLE_LANE_HEIGHT, game.Player.Town, game.Enemy.Town);

            // Build Bottom Lane
            this.BuildLane(BottomLane, 100.0f, BOTTOM_LANE_HEIGHT, game.Player.Town, game.Enemy.Town);

            // Crossing Paths
            this.buildCrossPaths();
        }
Example #18
0
 public PathSelectionEntity(NobleQuestGame Game)
 {
     this.Game    = Game;
     this.Texture = this.Game.Content.Load <Texture2D>("PathArrow");
 }