示例#1
0
    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.");
            }
        }
    }
示例#2
0
 public BattleState Initialized(PartyArea partyArea, EnemyArea enemyArea)
 {
     this.QueuedEffects = new List <Effect>();
     this.partyArea     = partyArea;
     this.enemies       = enemyArea;
     return(Init());
 }
示例#3
0
 // Setup
 public BattleState Initialized(PartyArea partyArea, EnemyArea enemyArea)
 {
     _queuedEffects = new Queue <Effect>();
     this.partyArea = partyArea;
     enemies        = enemyArea;
     return(FinishSetup());
 }
示例#4
0
 // Battle Wrapup
 public void Wrapup()
 {
     RecordPartyAdventureHp();
     GrantRewardCredits();
     GrantRewardCards();
     EnemyArea.Clear();
 }
示例#5
0
 public void Remove(EnemyArea enemy)
 {
     m_enemies.Remove(enemy);
     if (m_enemies.Count == 0)
     {
         m_camMov.NextArea();
     }
 }
示例#6
0
    public void CleanupIfNeeded()
    {
        if (!NeedsCleanup)
        {
            return;
        }

        EnemyArea.Clear();
        needsCleanup = false;
        BattleLog.Write("Finished Battle State Cleanup");
    }
示例#7
0
    // 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>();
    }
示例#8
0
 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);
 }
示例#9
0
 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);
             }
         }
     }
 }
示例#10
0
 //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);
         }
     }
 }
示例#11
0
 void Start()
 {
     enemyArea = enemyArea.Initialized(encounterBuilder.Generate());
     onEncounterGenerated.Publish();
 }
示例#12
0
 public void SetupEnemyEncounter()
 {
     EnemyArea.Initialized(nextEnemies);
     nextEnemies = new Enemy[0];
 }
示例#13
0
 private void Awake()
 {
     Instance = this;
 }