示例#1
0
    /// <summary>
    /// Updates enemies in the zoneEnemies list
    /// Should be called when transitioning to a new zone
    /// </summary>
    /// <param name="zone">Current zone the player is in</param>
    public void GetEnemiesInCurrentZone(ZoneManager.ZoneNames zone)
    {
        Enemy e;

        //First wipe out old enemies
        zoneEnemies.Clear();
        //Loop through all enemies to determine whether or not they're in the right zone
        for (int i = 0; i < gameEnemies.Length; ++i)
        {
            //Not sure if there's a more effecient way to do this but
            //THIS ONLY WORKS IF THE FORMAT IN THE HIERARCHY IS
            //  -Zone-,-ActiveArea-,-Enemies-,-Enemy-
            //So keep it that way when making new levels please

            /*
             * if (gameEnemies[i] != null && gameEnemies[i].GetComponent<Enemy>().zone == zone)
             *  zoneEnemies.Add(gameEnemies[i]);
             */
            e = gameEnemies[i].GetComponent <Enemy>();
            if (e.zone == zone)
            {
                //Reset the enemy back to normal
                zoneEnemies.Add(gameEnemies[i]);
                gameEnemies[i].SetActive(true);
                e.Alive = true;
                e.hp    = e.MaxHP;
                e.transform.position = e.StartingPosition;
                e.EndEncounter();
                e.MoveTarget = e.StartingPosition;
            }
            ///TODO:
            ///Alternate option, try FindObjectsOfType, since it only grabs active objects. Might be more efficient, might not
        }
    }
示例#2
0
    /// <summary>
    /// Flags whether or not a brazier is lit
    /// Should be called whenever a breazier is manipulated
    /// -Connor Menard
    /// </summary>
    /// <param name="zone">Zone the brazier is in</param>
    /// <param name="lit">Whether or not it's lit</param>
    public void BrazierLit(ZoneManager.ZoneNames zone, bool lit)
    {
        switch (zone)
        {
        case ZoneManager.ZoneNames.Battlefield:
            flags[FlagNames.BattlefieldBrazierLit] = lit;
            break;

        case ZoneManager.ZoneNames.HumanTerritoryStage1:
            flags[FlagNames.HumanTerritory1BrazierLit] = lit;
            break;

        case ZoneManager.ZoneNames.ShadowTerritoryStage1:
            flags[FlagNames.ShadowTerritory1BrazierLit] = lit;
            break;
        }
    }