예제 #1
0
    public EnemyGroupManager(List <SpawnZone> spawnZones)
    {
        this.spawnZones = spawnZones;
        enemies         = new List <EnemyToSpawn>();

        mapGenerator = GameObject.FindGameObjectWithTag("Map").GetComponent <MapGenerator>();
        MapConfiguration config = GameObject.FindGameObjectWithTag("Map").GetComponent <MapConfiguration>();

        rng = config.GetRNG();

        // Sort based on spawn zone size
        QuickSortSpawnZones(spawnZones, 0, spawnZones.Count - 1);
    }
    // Initializes map data
    public void Init(MapManager mapManager)
    {
        MapConfiguration config = GameObject.FindGameObjectWithTag("Map").GetComponent <MapConfiguration>();

        mapGenerator     = GameObject.FindGameObjectWithTag("Map").GetComponent <MapGenerator>();
        width            = config.width;
        height           = config.height;
        regionSize       = new Vector2(width, height);
        cell_size        = config.cell_size;
        radius           = cell_size * Mathf.Sqrt(2);
        this.mapManager  = mapManager;
        mapConfiguration = config;
        rng = config.GetRNG();

        spawnZones = new List <SpawnZone>();
        SpawnEnemies();
    }
    public void init(int characterRace, int characterClass, int characterWeapon)
    {
        // Get required components.
        character = GetComponent <GameAgent>();
        animator  = GetComponent <Animator>();

        MapConfiguration config = GameObject.FindGameObjectWithTag("Map").GetComponent <MapConfiguration>();

        rng = config.GetRNG();

        // Hide all weapon objects.
        hideAllWeapons();

        if (characterClass > 0)
        {
            SetCharacterClass(characterRace, characterClass, characterWeapon);
        }
    }
    // Variance is based on a percentage from 0 to 1 (1 = 100%)
    // The stat can be potentially rasied to any percetage, but cannot fall below 50% the original stat
    public EnemyGroupDescription(GameAgentStats stats, int quantityOfEnemyInGroup,
                                 float attackVariance          = 0f, float healthVariance = 0f,
                                 float rangeVariance           = 0f, float speedVariance  = 0f,
                                 bool randomNumberOfEnemies    = false,
                                 int minNumberOfEnemiesInGroup = -1, int maxNumberOfEnemiesInGroup = -1, int levelVariance = 0)
    {
        this.stats                     = stats;
        this.attackVariance            = attackVariance;
        this.healthVariance            = healthVariance;
        this.rangeVariance             = rangeVariance;
        this.speedVariance             = speedVariance;
        this.quantityOfEnemyInGroup    = quantityOfEnemyInGroup;
        this.randomNumberOfEnemies     = randomNumberOfEnemies;
        this.minNumberOfEnemiesInGroup = minNumberOfEnemiesInGroup;
        this.maxNumberOfEnemiesInGroup = maxNumberOfEnemiesInGroup;
        this.levelVariance             = levelVariance;

        MapConfiguration config = GameObject.FindGameObjectWithTag("Map").GetComponent <MapConfiguration>();

        rng = config.GetRNG();

        CalculatePowerLevel();
    }