コード例 #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
ファイル: BattleUnitUI.cs プロジェクト: EpicPants90/ELB
 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
ファイル: BattleUnitUI.cs プロジェクト: EpicPants90/ELB
    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
ファイル: BattleUnitUI.cs プロジェクト: EpicPants90/ELB
 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
ファイル: BattleManager.cs プロジェクト: EpicPants90/ELB
	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
ファイル: BattleManager.cs プロジェクト: EpicPants90/ELB
   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
ファイル: BattleManager.cs プロジェクト: EpicPants90/ELB
    void setOppositionC(MonsterType t){
        _oppositionReserveC = _MonsterManager.NewMonster(t);
        _BattleUnitPositionManager.SetReserveOppositionC(t, _oppositionReserveC);
	}
コード例 #23
0
 void BattleManager_OnBattleAbleUpdate(iBattleable battleAbleObject)
 {
 }
コード例 #24
0
ファイル: BattleManager.cs プロジェクト: EpicPants90/ELB
	void setOpposition(Unit u) {
		_BattleUnitPositionManager.SetOpposition(u.Type, _GameStateHolder._InactivePlayer.Type, u);
		_oppositionBattler = u;
	}
コード例 #25
0
ファイル: BattleManager.cs プロジェクト: EpicPants90/ELB
	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);
 }