private void CreateNewDrop(GameObject drop, Vector3 pos, int index)
    {
        GameObject instance  = Instantiate(drop, new Vector3(pos.x, pos.y + 1, pos.z), Quaternion.identity);
        EnemyDrop  enemyDrop = instance.GetComponent <EnemyDrop>();

        enemyDrop.pool = dropPool[index];
    }
示例#2
0
    void SpawnEnemyDrop(EnemyDrop enemyDrop)
    {
        Vector3 position = enemyDrop.transform.position;

        switch (enemyDrop.enemyType)
        {
        case EnemyTypes.Tank:
            this.SpawnTank(position);
            break;

        case EnemyTypes.Bot:
            this.SpawnBot(position);
            break;
        }

        enemyDrop.OnDrop -= SpawnEnemyDrop;
    }
示例#3
0
        public void SpawnEnemies(Transform partent, List <Attacker> AttackerList)
        {
            Debug.Log("Spawnig enemy in " + gameObject.name);
            EnemyDrop enemyList          = DungeonTracker.instance.getFloorEnemyList();
            int       enemyPositionIndex = Random.Range(0, enemyPositions.Count);

            foreach (GameObject enemy in enemyList.Enemies)
            {
                GameObject obj = Instantiate(enemy, partent);
                if (enemyPositionIndex >= enemyPositions.Count)
                {
                    Debug.LogError("one of the room does not have enemy spawn points");
                }
                obj.transform.position = enemyPositions[enemyPositionIndex].position;

                enemyPositionIndex++;
                if (enemyPositionIndex >= enemyPositions.Count)
                {
                    enemyPositionIndex = 0;
                }
            }
        }
示例#4
0
    public virtual void DropItem()
    {
        for (int i = 0; i < _maxHPDrop; i++)
        {
            EnemyDrop drop = Instantiate(_dropPrefab, transform.position, Quaternion.identity);
            drop.SetType(DropType.MaxHealth);
        }

        for (int i = 0; i < _healDrop; i++)
        {
            EnemyDrop drop = Instantiate(_dropPrefab, transform.position, Quaternion.identity);
            drop.SetType(DropType.Heal);
        }

        int scoreSoulCount = Mathf.Min(_scoreValue / 500, 5);

        for (int i = 0; i < scoreSoulCount; i++)
        {
            EnemyDrop drop = Instantiate(_dropPrefab, transform.position, Quaternion.identity);
            drop.SetType(DropType.Score, _scoreValue / scoreSoulCount);
        }
    }
示例#5
0
    public EnemyDrop getRandomEnemySpawn(int currentLevel)
    {
        List <EnemyLevelGrouping> masterGroup = new List <EnemyLevelGrouping>();

        for (int i = 0; i < CoreList.Count; i++)
        {
            if (currentLevel >= CoreList[i].MinMaxLevel.x && currentLevel < CoreList[i].MinMaxLevel.y)
            {
                masterGroup.Add(CoreList[i]);
            }
        }


        //find enemy group
        int random      = Random.Range(0, masterGroup.Count);
        int randomEnemy = Random.Range(0, masterGroup[random].DropList.Count);


        EnemyDrop enemy = masterGroup[random].DropList[randomEnemy];

        masterGroup.Clear();

        return(enemy);
    }