mixedcards/Assets/Battle/ParticipantActivity.cs
2020-10-13 23:19:09 -04:00

33 lines
No EOL
1.1 KiB
C#

using System.Collections.Generic;
using System.Linq;
public class ParticipantActivity {
private Dictionary<BattleParticipant, List<BaseCard>> mCardsUsedThisRound = new Dictionary<BattleParticipant, List<BaseCard>>();
public ParticipantActivity(BattleClock clock) {
clock.OnTimeChanged += this.NotifyTimeChanged;
}
private void NotifyTimeChanged(BattleTime now) {
if (now.RoundStep == RoundStep.StartOfRound) {
mCardsUsedThisRound.Clear();
}
}
public void NotifyParticipantUsedCard(BattleParticipant participant, BaseCard card) {
if (mCardsUsedThisRound.ContainsKey(participant)) {
mCardsUsedThisRound[participant].Add(card);
} else {
mCardsUsedThisRound[participant] = new List<BaseCard>() {card};
}
}
public int GetNonEmotionCardsUsedThisRound(BattleParticipant participant) {
if (mCardsUsedThisRound.ContainsKey(participant)) {
return mCardsUsedThisRound[participant].Count(card => card.Type != CardType.Emotion);
} else {
return 0;
}
}
}