public void BeginBattle() { deadParticipant = null; combatIsHappening = true; turnIndicator = 0; currentParticipant = participants[turnIndicator]; Notify(BattleState.BattleBegins); PauseMenu.PauseGame(true); }
private void IncrementTurn() { turnIndicator++; if (turnIndicator >= (participants.Count)) { turnIndicator = 0; } currentParticipant = participants[turnIndicator]; }
public override void PickUp(ICollector iCollector) { if (iCollector != null && iCollector is PlayerInventory) { PlayerInventory inventory = (PlayerInventory)iCollector; User = inventory.gameObject.GetComponent <Player>(); } base.PickUp(iCollector); }
protected virtual void BeingAttacked(CombatParticipant attackedBy) { if (CurrentCombatState == CombatState.Blocking) { Block(attackedBy); } else if (CurrentCombatState == CombatState.Dodging) { Dodge(); } }
void OnTriggerEnter2D(Collider2D collider) { CombatParticipant participant = collider.GetComponent <CombatParticipant>(); if (participant != null && participant.combatState != CombatParticipant.CombatState.Dead && !collider.isTrigger) { this.gameObject.GetComponent <CombatParticipant>().SetTarget(participant); participant.SetTarget(this.gameObject.GetComponent <CombatParticipant>()); BeginCombat(this.gameObject); } }
private void CheckForBattleEnding() { if (deadParticipant != null) { enemyCanPerformTurn = false; CommandCreator.God.ExecuteWin(this.gameObject); } else { enemyCanPerformTurn = true; deadParticipant = participants.Find(item => item.Health <= 0); } }
public virtual void Block(CombatParticipant attackedBy) { //check sturdiness if (blockHitTimes > blockSturdiness) { //break block - no damage recovery } else { blockHitTimes++; //normal blocking - maybe cut damage health += attackedBy.attackDamage - (attackedBy.attackDamage / 4); } }
public void SetTarget(CombatParticipant newTarget) { if (newTarget != target) { if (target != null) { target.targetsAttackingThis.Remove(this); } if (newTarget != null) { target = newTarget; newTarget.targetsAttackingThis.Add(this); } } }
void OnTriggerEnter2D(Collider2D collider) { CombatParticipant participant = collider.GetComponent <CombatParticipant>(); if (participant != null && participant != this.gameObject.GetComponent <CombatParticipant>() && !collider.isTrigger) { if (inventory.transform.GetChild(0).GetComponent <Potion>() != null) { this.gameObject.GetComponent <CombatParticipant>().SetTarget(participant); participant.SetTarget(this.gameObject.GetComponent <CombatParticipant>()); BeginCombat(this.gameObject); combatTut.BeginCombatTutorial(); } else { tutorial.SetTutorialText("You need a potion first! It's always best to have items before entering battle! Curing sadness isn't an easy task, you know!", 4f); } } }
public override void OnPerformedTurn(CombatParticipant currentParticipant) { if (currentParticipant == this) { manager.playerCanMove = true; if (injectionInProgress) { turnsPassedAfterInjection++; if (turnsPassedAfterInjection >= injectionTurns) { turnsPassedAfterInjection = 0; injectionInProgress = false; } else { Poison(); } } } base.OnPerformedTurn(currentParticipant); }
public void SetTarget(CombatParticipant newTarget) { target = newTarget; }
public virtual void OnPerformedTurn(CombatParticipant currentParticipant) { }
public override void Block(CombatParticipant attackedBy) { battleAudio.PlayBlockSound(); base.Block(attackedBy); }