private void SetupEnemyEncounter() { BattleLog.Write("Setting Up Enemies"); if (state.HasCustomEnemyEncounter) { BattleLog.Write("Setting Up Custom Encounter"); state.SetupEnemyEncounter(); } if (enemyArea.Enemies.Length == 0) { BattleLog.Write("Setting Up Fallback Random Encounter"); enemyArea = enemyArea.Initialized(encounterBuilder.Generate(3)); } foreach (var enemy in enemyArea.Enemies) { if (!enemy.IsReadyForPlay) { throw new Exception($"{enemy.Name}'s is not ready for play."); } if (enemy.Deck.Cards.All(c => c.Cost.Amount > 0)) { throw new Exception($"{enemy.Name}'s Deck does not contain a 0-Cost Card."); } } }
public BattleState Initialized(PartyArea partyArea, EnemyArea enemyArea) { this.QueuedEffects = new List <Effect>(); this.partyArea = partyArea; this.enemies = enemyArea; return(Init()); }
// Setup public BattleState Initialized(PartyArea partyArea, EnemyArea enemyArea) { _queuedEffects = new Queue <Effect>(); this.partyArea = partyArea; enemies = enemyArea; return(FinishSetup()); }
// Battle Wrapup public void Wrapup() { RecordPartyAdventureHp(); GrantRewardCredits(); GrantRewardCards(); EnemyArea.Clear(); }
public void Remove(EnemyArea enemy) { m_enemies.Remove(enemy); if (m_enemies.Count == 0) { m_camMov.NextArea(); } }
public void CleanupIfNeeded() { if (!NeedsCleanup) { return; } EnemyArea.Clear(); needsCleanup = false; BattleLog.Write("Finished Battle State Cleanup"); }
// Use this for initialization void Start() { maxHP = 100; currentHP = 100; this.SetTimeBetweenAttacks(defaultTimeBetweenAttacks); timeSinceLastAttack = 0f; health = transform.GetChild(0).GetChild(0).gameObject.GetComponent <BarScript>(); attackTimer = transform.GetChild(0).GetChild(1).gameObject.GetComponent <BarScript>(); enemyArea = GameObject.Find("EnemySpace").GetComponent <EnemyArea>(); allyArea = GameObject.Find("AllySpace").GetComponent <AllyArea>(); }
void Start() { targets = new List <Character>(); enemyArea = GameObject.Find("EnemySpace").GetComponent <EnemyArea>(); allyArea = GameObject.Find("AllySpace").GetComponent <AllyArea>(); targets = enemyArea.GetEnemies(); if (targets == null) { Debug.Log("targets in Ally instance is null"); } SetTarget(targets[0]); this.GetEventManager().AddNewListener(this); }
private void HandleAreaVisibility() { //if at least one enemy is in player visibility radius, increase visibility range foreach (GameObject area in enemyAreas) { if (area.active) { EnemyArea areaScr = area.GetComponent <EnemyArea>(); if (areaScr.isAreaActive) { float newOpacity = areaScr.ChangeAreaOpacity(-3f); } } } }
//ENEMY LOADING private void HandleEnemyLoading() { foreach (GameObject area in enemyAreas) { EnemyArea areaScr = area.GetComponent <EnemyArea>(); bool atLeast1EnemyAroundPlayer = false; foreach (AEnemy enemy in areaScr.enemies) { if (Vector2.Distance(enemy.transform.position, player.transform.position) < grassAppearRadius) { atLeast1EnemyAroundPlayer = true; } } if (atLeast1EnemyAroundPlayer) { area.SetActive(true); } } }
void Start() { enemyArea = enemyArea.Initialized(encounterBuilder.Generate()); onEncounterGenerated.Publish(); }
public void SetupEnemyEncounter() { EnemyArea.Initialized(nextEnemies); nextEnemies = new Enemy[0]; }
private void Awake() { Instance = this; }