void Awake() { //This is ugly. //This is in awake so it won't lose to the start in LevelSetup. //Rethink! dFactory = new DungeonFactory(); }
public Encounter GetEncounter(int ownerIndex) { var valid = new List <DungeonEncounter>(); int priority = 0; foreach (var dungeonMonster in dungeon.monsters) { if (dungeonMonster.min <= dungeon.currentLevel && dungeonMonster.max >= dungeon.currentLevel && dungeonMonster.priority >= priority) { if (dungeonMonster.priority > priority) { priority = dungeonMonster.priority; valid.Clear(); } valid.Add(dungeonMonster); } } var choosen = valid.Random(); var encounter = DungeonFactory.CreateEncounter(choosen.monsters, ownerIndex); return(encounter); }
public static DungeonRoom GetRoomForPosition(Vector3 position) { //position += WorldInfo.Instance.WorldOffset; int x = (int)(position.x / TILES_WIDE_WITH_HALLS); int z = (int)(position.z / TILES_LONG_WITH_HALLS); DungeonFactory df = CommonObjects.CurrentDungeonFactory; return(df.GetRoomAtGridPosition(x, z)); }
void InstantiateInvisibleBlock() { GameObject block = Instantiate(CommonObjects.Instance.invisibleBlockStatuePrefab) as GameObject; DungeonFactory df = CommonObjects.CurrentDungeonFactory; if (df != null) { block.transform.SetParent(df.blocksContainer); } Vector3 pos = transform.position; pos.y = transform.localScale.y * 0.5f; block.transform.position = pos; }
void Awake() { if (!_dDrawer || !_dFactory) { _dDrawer = GetComponent<DungeonDrawer>(); _dFactory = GetComponent<DungeonFactory>(); } _dFactory.onGenerationEnd.AddListener((dungeon) => { GameManager.Instance.ClearedDungeons++; _currentDungeon = dungeon; dungeon.OnGoalCleared.AddListener(() => { if (dungeon.RemainingGoals <= 0) { Exit e = FindObjectOfType<Exit>(); e.Unlock(); } }); }); }
public void StartNewDungeon(string id) { dungeon = DungeonFactory.CreateDungeon(id); }
public DungeonFactoryTest() { _dungeonFactory = new DungeonFactory(new RoomFactory(), new HallwayFactory(new MonsterFactory())); }