public PCCharacter[] CreateUniqueCharacters() { PCCharacter[] retValue = new PCCharacter[characterConfigs.Length]; Dictionary<string, int> nameCountMap = new Dictionary<string, int>(); Dictionary<string, char> namePrefixMap = new Dictionary<string, char>(); // generate unique enemy characters and populate our duplicate name maps for(int i=0; i < characterConfigs.Length; i++) { // first copy over the NPC into the same spot so they are unique retValue[i] = (PCCharacter) Character.CreateFromConfig(characterConfigs[i]); Character enemy = retValue[i]; // store count of name appearance // if we've seen it more than once, increment the count and prefix map if(nameCountMap.ContainsKey(enemy.displayName)) { nameCountMap[enemy.displayName] = nameCountMap[enemy.displayName] + 1; namePrefixMap[enemy.displayName] = 'A'; // set the first letter of multiple enmies to be 'A' } else { nameCountMap[enemy.displayName] = 1; } } // clean up any duplicate names for(int i=0; i < retValue.Length; i++) { Character enemy = retValue[i]; if(namePrefixMap.ContainsKey(enemy.displayName)) { enemy.displayName = enemy.displayName + " " + namePrefixMap[enemy.displayName]; namePrefixMap[enemy.displayName] = namePrefixMap[enemy.displayName]++; } } return retValue; }
/// <summary> /// Gets the PCBattleEntities for this row. /// </summary> /// <returns>The row.</returns> /// <param name="rowPos">Row position.</param> public PCBattleEntity[] GetRow(PCCharacter.RowPosition rowPos) { LazyInit(); switch(rowPos) { case PCCharacter.RowPosition.FRONT: return mFrontRowEntities; case PCCharacter.RowPosition.MIDDLE: return mMiddleRowEntities; case PCCharacter.RowPosition.BACK: return mBackRowEntities; } return null; }
/// <summary> /// Raises the row update event. Should be called upon listening to row changes. /// </summary> /// <param name="character">Character.</param> public void OnRowUpdate(PCCharacter character) { // re-evaluate all rows BuildRowEntities(); }
/// <summary> /// For single targets /// </summary> /// <param name="targetEnum">Target enum.</param> /// <param name="entityManager">Entity manager.</param> public TargetResolverRow(PCCharacter.RowPosition rowPosition, BattleEntityManagerComponent manager) { mRowPosition = rowPosition; mBattleEntityManager = manager; }
public MoveEvent(PCBattleEntity srcEntity, PCCharacter.RowPosition srcRow, PCCharacter.RowPosition destRow) { this.mSrcEntity = srcEntity; this.mSrcRow = srcRow; this.mDestRow = destRow; }
// setup variables public PCBattleEntity(PCCharacter character, BattleEntity.BattleEntityDelegate listener) : base(character, listener) { }
public PCMoveOperation(PCBattleEntity srcEntity, PCCharacter.RowPosition destRow) { this.mSrcEntity = srcEntity; this.mSrcRow = srcEntity.pcCharacter.rowPosition; this.mDestRow = destRow; }