Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 public override void Attack(TownNode target, GameTime gameTime)
 {
     TotalAttackTime += gameTime.ElapsedGameTime.Milliseconds / 1000f;
     if (TotalAttackTime >= AttackCooldown)
     {
         target.HitPoint      -= this.Damage + this.GetModifier();
         this.HitPoint        -= target.Damage;
         TotalAttackTime      -= AttackCooldown;
         target.LastAttackedBy = this;
     }
 }
Ejemplo n.º 3
0
 public override void HandleCollision(TownNode town)
 {
     if (town.Owner != this.Owner)
     {
         if (this.State != States.ATTACKING)
         {
             this.State        = States.ATTACKING;
             this.TargetTown   = town;
             town.TargetEntity = this;
         }
     }
 }
Ejemplo n.º 4
0
        public override void HandleCollision(TownNode town)
        {
            int nodesVisitedCount = nodesVisited.Count;

            nodesVisitedCount = ((nodesVisitedCount) * (nodesVisitedCount + 1)) / 2;

            if (this.Owner == Owners.PLAYER)
            {
                this.Game.Player.Resources.Gold += nodesVisitedCount;
            }
            else
            {
                this.Game.Enemy.Resources.Gold += nodesVisitedCount;
            }
            nodesVisited.Clear();
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
 public virtual void Attack(TownNode target, GameTime gameTime)
 {
 }
Ejemplo n.º 7
0
 public virtual void HandleCollision(TownNode town)
 {
 }