コード例 #1
0
ファイル: Player.cs プロジェクト: toshinto/2dBattleground
        internal Player(string name,Map m,int PlayerID)
        {
            Map = m;
            Name = name;

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

        }
コード例 #2
0
ファイル: BattleQueue.cs プロジェクト: ramsay/RedditRPG
 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>();
 }
コード例 #3
0
ファイル: Unit.cs プロジェクト: sleepyalways/RedditRPG
        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);
        }
コード例 #4
0
ファイル: AI.cs プロジェクト: ramsay/RedditRPG
 /// <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);
 }
コード例 #5
0
ファイル: AI.cs プロジェクト: ramsay/RedditRPG
 public AI(Unit[] team, Unit[] opponents)
 {
     this.team = team;
     this.opponents = opponents;
 }
コード例 #6
0
ファイル: Projectile.cs プロジェクト: toshinto/2dBattleground
        public Projectile(Map m,Unit o) : base(m)
        {

            Owner = o;
        }
コード例 #7
0
ファイル: Unit.cs プロジェクト: sleepyalways/RedditRPG
 public void setPositionTarget(Vector2 target)
 {
     Unit dummy = new Unit(target);
     positionTarget = dummy;
 }
コード例 #8
0
ファイル: Unit.cs プロジェクト: sleepyalways/RedditRPG
 public void setPositionTarget(Unit target)
 {
     positionTarget = target;
 }
コード例 #9
0
ファイル: Unit.cs プロジェクト: ramsay/RedditRPG
 public static int SpeedComparison(Unit x, Unit y)
 {
     return x.CurrentStats.speed.CompareTo (y.CurrentStats.speed);
 }
コード例 #10
0
ファイル: Unit.cs プロジェクト: ramsay/RedditRPG
 public void useItem(Unit target, IUseable item)
 {
 }
コード例 #11
0
ファイル: Unit.cs プロジェクト: ramsay/RedditRPG
 public void useSkill(Unit target, IUseable skill)
 {
 }
コード例 #12
0
ファイル: Unit.cs プロジェクト: ramsay/RedditRPG
 public void guard(Unit target, IUseable usable)
 {
 }
コード例 #13
0
ファイル: Unit.cs プロジェクト: ramsay/RedditRPG
 public void escape(Unit target, IUseable usable)
 {
 }
コード例 #14
0
ファイル: Unit.cs プロジェクト: ramsay/RedditRPG
 /**
  * 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)
 {
 }
コード例 #15
0
ファイル: Game.cs プロジェクト: ramsay/RedditRPG
        private bool hasNoSurvivor( Unit[] team )
        {
            foreach( Unit unit in team )
            {
                if( unit.CurrentStats.health > 0 )
                { return false; }
            }

            return true;
        }
コード例 #16
0
ファイル: Unit.cs プロジェクト: sleepyalways/RedditRPG
 public void setAttackTarget(Unit target)
 {
     attackState = true;
     attackTarget = target;
 }
コード例 #17
0
ファイル: Game.cs プロジェクト: ramsay/RedditRPG
        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;
        }
コード例 #18
0
ファイル: StatsMenu.cs プロジェクト: ramsay/RedditRPG
 public void setSelectedUnit(Unit selectedUnit)
 {
     this.selectedUnit = selectedUnit;
 }