Ejemplo n.º 1
0
        internal Player(string name,Map m,int PlayerID)
        {
            Map = m;
            Name = name;

            mainUnit = new Unit(m);
            mainUnit.Position = new Vector(100, 100);

        }
Ejemplo n.º 2
0
 public BattleQueue(Game game, Unit[] party, Unit[] enemies, int length)
     : base(game)
 {
     this.length = length;
     turnList = new List<Turn>();
     this.party = party;
     this.enemies = enemies;
     units = new List<Unit>();
 }
Ejemplo n.º 3
0
        private Stats stats; // Overall stats

        #endregion Fields

        #region Constructors

        public Unit(String name, Stats stats, Vector2 position)
        {
            this.name = name;
            this.stats = stats;
            this.currentStats = stats;
            this.position = position;
            this.attackState = false;

            this.positionState = PositionState.Stay;
            this.positionTarget = this;

            //movement = new MoveTimer(0,6.0f, position, position, stats.speed);
            movement = new MoveTimer(0,6.0f, position, position, currentStats.speed);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Agressive Intellegence Dellegate
 /// This will blindly attack the closest living opponent, then charge
 /// after it.
 /// </summary>
 /// <param name="me">The unit this AI is making decisions for.</param>
 public void Agressive(Unit me)
 {
     Unit target = null;
     float targetDistance = float.MaxValue, nextDistance;
     foreach (Unit opp in this.opponents) {
         if (opp.CurrentStats.health > 0) {
             if (target == null) {
                 target = opp;
                 targetDistance = Vector2.Distance(
                     me.Position, opp.Position);
             } else {
                 nextDistance = Vector2.Distance(
                      me.Position, opp.Position);
                 if (nextDistance < targetDistance) {
                     targetDistance = nextDistance;
                     target = opp;
                 }
             }
         }
     }
     me.setAttackTarget(target);
     me.setPositionState(PositionState.Charge);
     me.setPositionTarget(target);
 }
Ejemplo n.º 5
0
 public AI(Unit[] team, Unit[] opponents)
 {
     this.team = team;
     this.opponents = opponents;
 }
Ejemplo n.º 6
0
        public Projectile(Map m,Unit o) : base(m)
        {

            Owner = o;
        }
Ejemplo n.º 7
0
 public void setPositionTarget(Vector2 target)
 {
     Unit dummy = new Unit(target);
     positionTarget = dummy;
 }
Ejemplo n.º 8
0
 public void setPositionTarget(Unit target)
 {
     positionTarget = target;
 }
Ejemplo n.º 9
0
 public static int SpeedComparison(Unit x, Unit y)
 {
     return x.CurrentStats.speed.CompareTo (y.CurrentStats.speed);
 }
Ejemplo n.º 10
0
 public void useItem(Unit target, IUseable item)
 {
 }
Ejemplo n.º 11
0
 public void useSkill(Unit target, IUseable skill)
 {
 }
Ejemplo n.º 12
0
 public void guard(Unit target, IUseable usable)
 {
 }
Ejemplo n.º 13
0
 public void escape(Unit target, IUseable usable)
 {
 }
Ejemplo n.º 14
0
 /**
  * Attack: [actor, target]
  *     Skill:  [actor, target(optional)]
  *     Change: Not an Action, just a menu option
  *     Guard:  [actor]
  *     Item:   [actor, target, item]
  *     Escape: [actor]
  */
 public void attack(Unit target, IUseable useable)
 {
 }
Ejemplo n.º 15
0
        private bool hasNoSurvivor( Unit[] team )
        {
            foreach( Unit unit in team )
            {
                if( unit.CurrentStats.health > 0 )
                { return false; }
            }

            return true;
        }
Ejemplo n.º 16
0
 public void setAttackTarget(Unit target)
 {
     attackState = true;
     attackTarget = target;
 }
Ejemplo n.º 17
0
        private void Reset()
        {
            oldState = Keyboard.GetState();
            oldMouseState = Mouse.GetState();

            Stats defaultStats = new Stats(2.68F, 20, 5, 10);
            Vector2 unitPosition = new Vector2(
                4f / 16f * BattleConstants.SCREEN_WIDTH,
                3f / 9f * BattleConstants.SCREEN_HEIGHT);

            // Initialize enemy positions
            for (int i = 0; i < enemyCount; i++)
            {
                enemyTeam[i] = new Unit(
                    "Enemy", defaultStats,
                    new Vector2(unitPosition.X, unitPosition.Y)
                    );
                unitPosition.Y += BattleConstants.SCREEN_HEIGHT / 9f;
            }
            // Initialize player positions
            unitPosition.X = 12f / 16f * BattleConstants.SCREEN_WIDTH;
            unitPosition.Y = 3f / 9f * BattleConstants.SCREEN_HEIGHT;
            for (int i = 0; i < playerCount; i++)
            {
                playerTeam[i] = new Unit(
                    "Player", defaultStats,
                    new Vector2(unitPosition.X, unitPosition.Y));
                unitPosition.Y += BattleConstants.SCREEN_HEIGHT / 9f;
            }
            queue.Initialize();
            queue.Visible = true;

            // Initialize AI
            enemyAI = new AI(enemyTeam, playerTeam);
            foreach(Unit unit in enemyTeam) {
                unit.intelligence = enemyAI.Agressive;
            }

            foreach (BattleMenu menu in menus)
            {
                if (menu != null)
                {
                    menu.Visible = false;
                }
            }
            endGameMenu.Visible = false;
            turnPlayIndex = 0;
            turnInputIndex = 0;
            menuState = new Stack<InputState>();
            gameState = GameState.Initial;
        }
Ejemplo n.º 18
0
 public void setSelectedUnit(Unit selectedUnit)
 {
     this.selectedUnit = selectedUnit;
 }