Ejemplo n.º 1
0
        /// <summary>
        /// Constructor to load the director and initialize all values.
        /// </summary>
        /// <param name="engine">Battle engine for up-to-date information about the battle</param>
        /// <param name="arrowTexture">Texture for the arrow</param>
        public BattleDirector(Texture2D arrowTexture)
        {
            arrow = arrowTexture;

            // Initialize the position vectors
            for (int i = 0; i < BattleEngine.PartyCount; i++)
            {
                BattleEngine.PlayerPartyList[i].Position = new Vector2(cPlayerPositions[i, 0], cPlayerPositions[i, 1]);
            }

            for (int i = 0; i < BattleEngine.EnemyCount; i++)
            {
                BattleEngine.EnemyPartyList[i].Position = new Vector2(cEnemyPositions[i, 0], cEnemyPositions[i, 1]);
            }

            // Load the list of battle texts
            battleTextList = new List<BattleText>(ChronoConstants.cMaxPartyMembers);
            for (int i = 0; i < ChronoConstants.cMaxPartyMembers; i++)
            {
                BattleText tmpBattleText = new BattleText();
                battleTextList.Add(tmpBattleText);
            }

            // Initialize handling what to do when an action is done
            ActionDone += ActionDoneHandler;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a script for commands that only involve one player and one enemy.
        /// </summary>
        /// <param name="action">String that designates the action type</param>
        /// <param name="attacker">Character that is attacking</param>
        /// <param name="defender">Character that is defending</param>
        /// <param name="startPos">Starting position of attacker</param>
        /// <param name="endPos">Position of the defender</param>
        /// <param name="battleText">Text for damage numbers</param>
        /// <returns>A full action script that animates this action in battle</returns>
        public ActionScript createActionScript(string action, CharacterBase attacker, CharacterBase defender, 
            int damage, BattleText battleText)
        {
            Queue<ActionSlot> script = new Queue<ActionSlot>();

            Vector2 startPos = attacker.Position;
            Vector2 endPos = defender.Position - cOffset;

            // DEBUG:  For now, just return the actions for a regular attack
            script.Enqueue(new ActionSlot(ActionCommand.MoveTo, attacker, endPos, 20));
            script.Enqueue(new ActionSlot(ActionCommand.Begin));
            script.Enqueue(new ActionSlot(ActionCommand.ShowAttack, attacker));
            script.Enqueue(new ActionSlot(ActionCommand.ShowText, battleText));
            script.Enqueue(new ActionSlot(ActionCommand.End));
            script.Enqueue(new ActionSlot(ActionCommand.TakeDamage, defender, damage));
            script.Enqueue(new ActionSlot(ActionCommand.MoveTo, attacker, startPos, 20));

            return new ActionScript(script);
        }