示例#1
0
    public void NextFloor()//called when player hits action on downstairs
    {
        float startTime = Time.realtimeSinceStartup;

        PlayerInstance.SetActive(false);
        toPrevFloor = false;
        DungeonFloor++;
        ClearEnemies();
        ClearItems();

        if (DungeonFloor >= dungeon.length())//if the player hasn't been here before, generate a new floor
        {
            TileMapData generated = genTMD();
            MoveMap(generated);
            dungeon.add(generated);
            EnemySpawningDifficulty(generated, numEnemies);
        }
        else
        {
            MoveMap(dungeon.getTMD(DungeonFloor));    //if the player has been here, load it from the list
            Spawning.RespawnEnemies(DungeonFloor);
        }
        PlayerInstance.SetActive(true);
        float endTime = Time.realtimeSinceStartup;

        Debug.Log(endTime - startTime + "seconds loadtime");
        Debug.Log("DungeonFloor: " + DungeonFloor);
    }
示例#2
0
 public void PreviousFloor()//called when player hits action on upstairs
 {
     if (DungeonFloor > 0)
     {
         float startTime = Time.realtimeSinceStartup;
         PlayerInstance.SetActive(false);
         toPrevFloor = true;
         DungeonFloor--;
         ClearEnemies();
         ClearItems();
         MoveMap(dungeon.getTMD(DungeonFloor));
         PlayerInstance.SetActive(true);
         float endTime = Time.realtimeSinceStartup;
         Debug.Log(endTime - startTime + "seconds loadtime");
         Spawning.RespawnEnemies(DungeonFloor);
     }
     else
     {
         Debug.Log("You are on the top floor");
     }
 }