Example #1
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);
        }
Example #2
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;
        }