Add hit animation

This commit is contained in:
henriquenakashima 2020-09-25 20:45:12 -04:00
parent 4d817ea88a
commit c31747bc19
11 changed files with 592 additions and 5 deletions

View file

@ -11,6 +11,8 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
public BattlePlayerControls battlePlayerControls;
public EnergyUI heroEnergyUI;
public EnergyUI monsterEnergyUI;
public Material hitEffectMaterial;
public RuntimeAnimatorController runtimeAnimatorController;
// Private
private HeroCardDatabase heroCardDatabase;
@ -98,7 +100,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
this.monsterCardDatabase = new MonsterCardDatabase();
this.state = new BattleState();
this.heroEnergy = new EnergyPool();
this.heroEnergyUI.Init(this.heroEnergy);
this.heroEnergy.OnEnergyChanged += this.heroEnergyUI.NotifyEnergyChanged;
@ -123,8 +125,9 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
sprite.name = "Hero" + i + "_Sprite";
PositionSprite(TeamChoice.Heroes, sprite, i);
BattleParticipantSprite bps = sprite.AddComponent<BattleParticipantSprite>();
bps.Init(battlePlayerControls, hero);
bps.Init(battlePlayerControls, hero, this.hitEffectMaterial, this.runtimeAnimatorController);
bps.OnSpriteClicked += battlePlayerControls.NotifyParticipantSpriteClicked;
hero.OnHit += bps.NotifyHit;
hero.OnDeath += bps.NotifyDeath;
HeroInfoUI heroUI = (HeroInfoUI) Instantiate(this.heroUIPrefab.gameObject, this.uiCanvas.transform).GetComponent(typeof(HeroInfoUI));
@ -147,8 +150,9 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
sprite.name = "Monster" + i + "_Sprite";
PositionSprite(TeamChoice.Monsters, sprite, i);
BattleParticipantSprite bps = sprite.AddComponent<BattleParticipantSprite>();
bps.Init(battlePlayerControls, monster);
bps.Init(battlePlayerControls, monster, this.hitEffectMaterial, this.runtimeAnimatorController);
bps.OnSpriteClicked += battlePlayerControls.NotifyParticipantSpriteClicked;
monster.OnHit += bps.NotifyHit;
monster.OnDeath += bps.NotifyDeath;
HeroInfoUI monsterUI = (HeroInfoUI) Instantiate(this.heroUIPrefab.gameObject, this.uiCanvas.transform).GetComponent(typeof(HeroInfoUI));