示例#1
0
 void BattleManager_OnBattleAbleUpdate(iBattleable battleAbleObject)
 {
     if (_healthBarSliders.ContainsKey(battleAbleObject.GetUniqueID()))
     {
         _healthBarSliders[battleAbleObject.GetUniqueID()].value = battleAbleObject.GetHPPercentage();
     }
 }
示例#2
0
    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);
    }
示例#3
0
 void BattleManager_OnBattleAbleTakeDamage(iBattleable battleAbleObject, int i)
 {
     //Animator a =
     if (battleAbleObject.IsKO())
     {
     }
 }
示例#4
0
 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);
     }
 }
示例#5
0
 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);
     }
 }
示例#6
0
    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);
    }
示例#7
0
    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();
        }
    }
示例#8
0
    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);
    }
示例#9
0
    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());
    }
示例#10
0
    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);
    }
示例#11
0
    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);
    }
示例#12
0
    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);
    }
示例#13
0
	public void SetOpposition(MonsterType t, iBattleable monster) {
        setOpposition(_Monsters[(int)t], monster);
	}
示例#14
0
	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);
	}
示例#15
0
	void BattleManager_OnBattleAbleTakeDamage(iBattleable battleAbleObject, int i) {
		//Animator a = 
		if (battleAbleObject.IsKO()) {
			
		}
	}
示例#16
0
	public void SetOpposition(UnitType t, PlayerType p, iBattleable unit) {
		List<GameObject> prefabs = p == PlayerType.Battlebeard ? _BattlebeardUnits : _StormshaperUnits;
        setOpposition(prefabs[(int)t], unit);
	}
示例#17
0
 void BattleManager_OnBattleAbleUpdate(iBattleable battleAbleObject)
 {
     if(_healthBarSliders.ContainsKey(battleAbleObject.GetUniqueID()))
         _healthBarSliders[battleAbleObject.GetUniqueID()].value = battleAbleObject.GetHPPercentage();
 }
示例#18
0
	void BattleManager_OnBattleAbleUpdate(iBattleable battleAbleObject) {

	}
示例#19
0
	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;
	}
示例#20
0
   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();
		}
	}
示例#21
0
 void setOpposition(MonsterType t)
 {
     _oppositionBattler = _MonsterManager.NewMonster(t);
     Audio.AudioInstance.PlaySFX(_oppositionBattler.GetAttackSound());
     _BattleUnitPositionManager.SetOpposition(t, _oppositionBattler);
 }
示例#22
0
    void setOppositionC(MonsterType t){
        _oppositionReserveC = _MonsterManager.NewMonster(t);
        _BattleUnitPositionManager.SetReserveOppositionC(t, _oppositionReserveC);
	}
示例#23
0
 void BattleManager_OnBattleAbleUpdate(iBattleable battleAbleObject)
 {
 }
示例#24
0
	void setOpposition(Unit u) {
		_BattleUnitPositionManager.SetOpposition(u.Type, _GameStateHolder._InactivePlayer.Type, u);
		_oppositionBattler = u;
	}
示例#25
0
	void setOpposition(MonsterType t) {
        _oppositionBattler = _MonsterManager.NewMonster(t);
		Audio.AudioInstance.PlaySFX(_oppositionBattler.GetAttackSound());
        _BattleUnitPositionManager.SetOpposition(t, _oppositionBattler);
		
	}
示例#26
0
 void setOppositionC(MonsterType t)
 {
     _oppositionReserveC = _MonsterManager.NewMonster(t);
     _BattleUnitPositionManager.SetReserveOppositionC(t, _oppositionReserveC);
 }
示例#27
0
    public void SetOpposition(UnitType t, PlayerType p, iBattleable unit)
    {
        List <GameObject> prefabs = p == PlayerType.Battlebeard ? _BattlebeardUnits : _StormshaperUnits;

        setOpposition(prefabs[(int)t], unit);
    }
示例#28
0
 void setOpposition(Unit u)
 {
     _BattleUnitPositionManager.SetOpposition(u.Type, _GameStateHolder._InactivePlayer.Type, u);
     _oppositionBattler = u;
 }
示例#29
0
 public void SetOpposition(MonsterType t, iBattleable monster)
 {
     setOpposition(_Monsters[(int)t], monster);
 }