Esempio 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);

        }
Esempio 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>();
 }
Esempio 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);
        }
Esempio 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);
 }
Esempio n. 5
0
 public AI(Unit[] team, Unit[] opponents)
 {
     this.team = team;
     this.opponents = opponents;
 }
Esempio n. 6
0
        public Projectile(Map m,Unit o) : base(m)
        {

            Owner = o;
        }
Esempio n. 7
0
 public void setPositionTarget(Vector2 target)
 {
     Unit dummy = new Unit(target);
     positionTarget = dummy;
 }
Esempio n. 8
0
 public void setPositionTarget(Unit target)
 {
     positionTarget = target;
 }
Esempio n. 9
0
 public static int SpeedComparison(Unit x, Unit y)
 {
     return x.CurrentStats.speed.CompareTo (y.CurrentStats.speed);
 }
Esempio n. 10
0
 public void useItem(Unit target, IUseable item)
 {
 }
Esempio n. 11
0
 public void useSkill(Unit target, IUseable skill)
 {
 }
Esempio n. 12
0
 public void guard(Unit target, IUseable usable)
 {
 }
Esempio n. 13
0
 public void escape(Unit target, IUseable usable)
 {
 }
Esempio 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)
 {
 }
Esempio n. 15
0
        private bool hasNoSurvivor( Unit[] team )
        {
            foreach( Unit unit in team )
            {
                if( unit.CurrentStats.health > 0 )
                { return false; }
            }

            return true;
        }
Esempio n. 16
0
 public void setAttackTarget(Unit target)
 {
     attackState = true;
     attackTarget = target;
 }
Esempio 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;
        }
Esempio n. 18
0
 public void setSelectedUnit(Unit selectedUnit)
 {
     this.selectedUnit = selectedUnit;
 }