void BattleManager_OnBattleAbleUpdate(iBattleable battleAbleObject) { if (_healthBarSliders.ContainsKey(battleAbleObject.GetUniqueID())) { _healthBarSliders[battleAbleObject.GetUniqueID()].value = battleAbleObject.GetHPPercentage(); } }
public int Attack(BattlerType t, iBattleable target) { int totalDamage = 0; if (t == BattlerType.Instigator) { totalDamage = _instigatorBattlers.Sum(x => x.GetStrength()); Audio.AudioInstance.PlaySFX(_instigatorBattlers[0].GetAttackSound()); } else { totalDamage = _oppositionBattler.GetStrength(); Audio.AudioInstance.PlaySFX(_oppositionBattler.GetAttackSound()); } target.ReduceHP(totalDamage); OnBattleAbleTakeDamage(target, totalDamage); OnBattleAbleUpdate(target); if (target.IsKO()) { Audio.AudioInstance.PlaySFX(target.GetDeathSound()); } else { Audio.AudioInstance.PlaySFX(target.GetHitSound()); } Debug.Log(t + " attacked " + target.GetType() + " for " + totalDamage + " damage."); Debug.Log(target.GetCurrentHP() + " hp left (" + target.GetHPPercentage() * 100 + "%)"); return(totalDamage); }
void BattleManager_OnBattleAbleTakeDamage(iBattleable battleAbleObject, int i) { //Animator a = if (battleAbleObject.IsKO()) { } }
void BattleManager_OnBattleAbleTakeDamage(iBattleable battleAbleObject, int val) { //check that the battlable thing taking damage is associated with this ui if (_units.Contains(battleAbleObject)) { //damage flash TakeDamage(val); } }
void BattleManager_OnBattleAbleTakeDamage(iBattleable battleAbleObject, int val) { //check that the battlable thing taking damage is associated with this ui if (_units.Contains (battleAbleObject)) { //damage flash TakeDamage(val); } }
void setOpposition(GameObject g, iBattleable monster) { _ActiveOpposition = (GameObject)Instantiate(g, _MarkerActiveOpposition.transform.position, _MarkerActiveOpposition.transform.rotation); //battle unit ui GameObject unitUI = _UnitUIPool.GetPooledObject(); awakenUnitUI(unitUI, _MarkerActiveOpposition, _ActiveOpposition); _ActiveOppositionUI = unitUI.GetComponent <BattleUnitUI>(); _ActiveOppositionUI.AddUnit(monster); }
IEnumerator endTurn() { if (!(activePlayer == BattlerType.Opposition && _BattleData._BattleType != BattleType.PvP)) { // do end turn stuff _BattleUnitPositionManager._ArmyUI.Hide(); _BattleUnitPositionManager._HandUI.Hide(); _BattleUnitPositionManager._ButtonsUI.Hide(); } yield return(new WaitForSeconds(2)); if (_instigatorBattlers.Count() == 0) { _endBattle(BattleEndState.Loss); } else if (_oppositionBattler.IsKO()) { if (_BattleData._BattleType == BattleType.LostImmortal) { if (_oppositionReserveB != null) { _BattleUnitPositionManager.RemoveOpposition(); _BattleUnitPositionManager.SetReserveBAsOpposition(); _oppositionBattler = _oppositionReserveB; _oppositionReserveB = null; switchPlayer(); } else if (_oppositionReserveC != null) { _BattleUnitPositionManager.RemoveOpposition(); _BattleUnitPositionManager.SetReserveCAsOpposition(); _oppositionBattler = _oppositionReserveC; _oppositionReserveC = null; switchPlayer(); } else { _BattleUnitPositionManager.RemoveOpposition(); _endBattle(BattleEndState.Win); } } else { _BattleUnitPositionManager.RemoveOpposition(); _endBattle(BattleEndState.Win); } } else { switchPlayer(); } }
public void SetReserveOppositionC(MonsterType t, iBattleable monster) { GameObject g = _Monsters[(int)t]; _ReserveOppositionC = (GameObject)Instantiate(g, _MarkerReserveOppositionC.transform.position, _MarkerReserveOppositionC.transform.rotation); //battle unit ui GameObject unitUI = _UnitUIPool.GetPooledObject(); awakenUnitUI(unitUI, _MarkerReserveOppositionC, _ReserveOppositionC); _ReserveOppositionCUI = unitUI.GetComponent <BattleUnitUI>(); _ReserveOppositionCUI.AddUnit(monster); }
public void AttackButton() { if (_BattleData._BattleType != BattleType.PvP && activePlayer != BattlerType.Instigator) { return; } attacking = true; iBattleable target = _oppositionBattler; if (_BattleData._BattleType == BattleType.PvP && activePlayer != BattlerType.Instigator) { target = _instigatorBattlers[0]; } Attack(activePlayer, target); StartCoroutine(endTurn()); }
public void AddUnit(iBattleable unit) { if (unit == null) return; BattleManager.OnBattleAbleUpdate += BattleManager_OnBattleAbleUpdate; BattleManager.OnBattleAbleTakeDamage+=BattleManager_OnBattleAbleTakeDamage; //init a new health bar GameObject healthBar = _healthBarPool.GetPooledObject (); healthBar.SetActive (true); healthBar.transform.SetParent (_HealthBarDisplays.transform); healthBar.transform.localScale = new Vector3(1, 1, 1); _healthBarSliders.Add(unit.GetHashCode(), healthBar.GetComponentInChildren<Slider>()); //refresh BattleManager_OnBattleAbleUpdate(unit); _units.Add (unit); }
public void AddUnit(iBattleable unit) { if (unit == null) { return; } BattleManager.OnBattleAbleUpdate += BattleManager_OnBattleAbleUpdate; BattleManager.OnBattleAbleTakeDamage += BattleManager_OnBattleAbleTakeDamage; //init a new health bar GameObject healthBar = _healthBarPool.GetPooledObject(); healthBar.SetActive(true); healthBar.transform.SetParent(_HealthBarDisplays.transform); healthBar.transform.localScale = new Vector3(1, 1, 1); _healthBarSliders.Add(unit.GetHashCode(), healthBar.GetComponentInChildren <Slider>()); //refresh BattleManager_OnBattleAbleUpdate(unit); _units.Add(unit); }
public void SetReserveOppositionC(MonsterType t, iBattleable monster) { GameObject g = _Monsters[(int)t]; _ReserveOppositionC = (GameObject)Instantiate(g, _MarkerReserveOppositionC.transform.position, _MarkerReserveOppositionC.transform.rotation); //battle unit ui GameObject unitUI = _UnitUIPool.GetPooledObject(); awakenUnitUI(unitUI, _MarkerReserveOppositionC, _ReserveOppositionC); _ReserveOppositionCUI = unitUI.GetComponent<BattleUnitUI>(); _ReserveOppositionCUI.AddUnit(monster); }
public void SetOpposition(MonsterType t, iBattleable monster) { setOpposition(_Monsters[(int)t], monster); }
void setOpposition(GameObject g, iBattleable monster) { _ActiveOpposition = (GameObject)Instantiate(g, _MarkerActiveOpposition.transform.position, _MarkerActiveOpposition.transform.rotation); //battle unit ui GameObject unitUI = _UnitUIPool.GetPooledObject(); awakenUnitUI(unitUI, _MarkerActiveOpposition, _ActiveOpposition); _ActiveOppositionUI = unitUI.GetComponent<BattleUnitUI>(); _ActiveOppositionUI.AddUnit(monster); }
public void SetOpposition(UnitType t, PlayerType p, iBattleable unit) { List<GameObject> prefabs = p == PlayerType.Battlebeard ? _BattlebeardUnits : _StormshaperUnits; setOpposition(prefabs[(int)t], unit); }
void BattleManager_OnBattleAbleUpdate(iBattleable battleAbleObject) { if(_healthBarSliders.ContainsKey(battleAbleObject.GetUniqueID())) _healthBarSliders[battleAbleObject.GetUniqueID()].value = battleAbleObject.GetHPPercentage(); }
void BattleManager_OnBattleAbleUpdate(iBattleable battleAbleObject) { }
public int Attack(BattlerType t, iBattleable target) { int totalDamage = 0; if (t == BattlerType.Instigator) { totalDamage = _instigatorBattlers.Sum(x => x.GetStrength()); Audio.AudioInstance.PlaySFX(_instigatorBattlers[0].GetAttackSound()); } else { totalDamage = _oppositionBattler.GetStrength(); Audio.AudioInstance.PlaySFX(_oppositionBattler.GetAttackSound()); } target.ReduceHP(totalDamage); OnBattleAbleTakeDamage (target, totalDamage); OnBattleAbleUpdate (target); if (target.IsKO()) { Audio.AudioInstance.PlaySFX(target.GetDeathSound()); } else { Audio.AudioInstance.PlaySFX(target.GetHitSound()); } Debug.Log(t + " attacked " + target.GetType() + " for " + totalDamage + " damage."); Debug.Log(target.GetCurrentHP() + " hp left (" + target.GetHPPercentage()*100 + "%)"); return totalDamage; }
IEnumerator endTurn() { if (!(activePlayer == BattlerType.Opposition && _BattleData._BattleType != BattleType.PvP)) { // do end turn stuff _BattleUnitPositionManager._ArmyUI.Hide(); _BattleUnitPositionManager._HandUI.Hide(); _BattleUnitPositionManager._ButtonsUI.Hide(); } yield return new WaitForSeconds(2); if (_instigatorBattlers.Count() == 0) { _endBattle(BattleEndState.Loss); } else if (_oppositionBattler.IsKO()) { if(_BattleData._BattleType == BattleType.LostImmortal) { if(_oppositionReserveB != null) { _BattleUnitPositionManager.RemoveOpposition(); _BattleUnitPositionManager.SetReserveBAsOpposition(); _oppositionBattler = _oppositionReserveB; _oppositionReserveB = null; switchPlayer(); } else if(_oppositionReserveC != null) { _BattleUnitPositionManager.RemoveOpposition(); _BattleUnitPositionManager.SetReserveCAsOpposition(); _oppositionBattler = _oppositionReserveC; _oppositionReserveC = null; switchPlayer(); } else { _BattleUnitPositionManager.RemoveOpposition(); _endBattle(BattleEndState.Win); } } else { _BattleUnitPositionManager.RemoveOpposition(); _endBattle(BattleEndState.Win); } } else { switchPlayer(); } }
void setOpposition(MonsterType t) { _oppositionBattler = _MonsterManager.NewMonster(t); Audio.AudioInstance.PlaySFX(_oppositionBattler.GetAttackSound()); _BattleUnitPositionManager.SetOpposition(t, _oppositionBattler); }
void setOppositionC(MonsterType t){ _oppositionReserveC = _MonsterManager.NewMonster(t); _BattleUnitPositionManager.SetReserveOppositionC(t, _oppositionReserveC); }
void setOpposition(Unit u) { _BattleUnitPositionManager.SetOpposition(u.Type, _GameStateHolder._InactivePlayer.Type, u); _oppositionBattler = u; }
void setOppositionC(MonsterType t) { _oppositionReserveC = _MonsterManager.NewMonster(t); _BattleUnitPositionManager.SetReserveOppositionC(t, _oppositionReserveC); }
public void SetOpposition(UnitType t, PlayerType p, iBattleable unit) { List <GameObject> prefabs = p == PlayerType.Battlebeard ? _BattlebeardUnits : _StormshaperUnits; setOpposition(prefabs[(int)t], unit); }