Implement OilOfSharpness
This commit is contained in:
parent
2190070fee
commit
31cb8fe4c0
45 changed files with 604 additions and 21 deletions
42
Assets/Battle/DefaultsManager.cs
Normal file
42
Assets/Battle/DefaultsManager.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DefaultsManager
|
||||
{
|
||||
public delegate IEnumerator UseDefaultAction(DefaultHeroCard card);
|
||||
|
||||
private Dictionary<BattleHero, DefaultHeroCard> mHeroDefaults = new Dictionary<BattleHero, DefaultHeroCard>();
|
||||
|
||||
public DefaultsManager() {
|
||||
}
|
||||
|
||||
public DefaultHeroCard Setup(DefaultEffect effect) {
|
||||
DefaultHeroCard newCard = effect.Card;
|
||||
DefaultHeroCard previousCard = null;
|
||||
BattleHero heroOwner = (BattleHero) newCard.Owner;
|
||||
mHeroDefaults.TryGetValue(heroOwner, out previousCard);
|
||||
|
||||
mHeroDefaults[heroOwner] = newCard;
|
||||
|
||||
return previousCard;
|
||||
}
|
||||
|
||||
public IEnumerator UseHeroDefaults(
|
||||
BattleHero[] heroes, ParticipantActivity activity,
|
||||
UseDefaultAction usedDefaultAction) {
|
||||
foreach (BattleHero hero in heroes) {
|
||||
if (hero == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (activity.GetNonEmotionCardsUsedThisRound(hero) == 0) {
|
||||
DefaultHeroCard defaultCard;
|
||||
mHeroDefaults.TryGetValue(hero, out defaultCard);
|
||||
if (defaultCard != null) {
|
||||
yield return usedDefaultAction(defaultCard);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue