コード例 #1
0
    private void SpawnBoss()
    {
        ElevatorDescriber bossRoomDescriber = bossRoom.GetComponent <ElevatorDescriber>();

        player.transform.position = bossRoomDescriber.spawnPoints[0].position; //set player position to spawn point 0

        //spawn boss at spawn point 1
        GameObject bossObj = Instantiate(boss, bossRoomDescriber.spawnPoints[1].position, Quaternion.identity, enemyTransform);
    }
コード例 #2
0
 private bool IsElevatorUsed(ElevatorDescriber elevator, List <ElevatorDescriber> usedElevators)
 {
     foreach (ElevatorDescriber usedElevator in usedElevators)
     {
         if (elevator == usedElevator)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #3
0
    public void SetupElevators(List <GameObject> elevatorObjs, GameObject bossRoom, GameObject boss)
    {
        elevators = new List <ElevatorDescriber>();
        foreach (GameObject elevator in elevatorObjs)
        {
            ElevatorDescriber elevatorDesc = elevator.GetComponent <ElevatorDescriber>();
            elevators.Add(elevatorDesc);
        }

        this.bossRoom = bossRoom;
        this.boss     = boss;
    }
コード例 #4
0
    private void SpawnEnemyGroup(int enemyCount)
    {
        List <ElevatorDescriber> usedElevators = new List <ElevatorDescriber>();

        for (int i = 0; i < enemyCount; i++)
        {
            ElevatorDescriber elevatorSpawn = GetElevatorSpawn(usedElevators);

            int ranSpawnPoint = Random.Range(0, elevatorSpawn.spawnPoints.Count - 1);

            Vector2 spawnPoint = elevatorSpawn.spawnPoints[ranSpawnPoint].position;

            GameObject enemySpawn = Instantiate(enemyQueue[0], enemyTransform);
            enemySpawn.transform.position = spawnPoint;
            enemyQueue.RemoveAt(0);
            enemies.Add(enemySpawn);

            usedElevators.Add(elevatorSpawn);
        }
    }