public override void OnPuzzleCreate(Puzzle puzzle) { var place = puzzle.GetPlace("Place"); var monsterChests = UniqueRnd(3, 1, 2, 3, 4, 5, 6, 7, 8, 9); for (int i = 1; i <= 9; ++i) { var monsterChest = monsterChests.Contains(i); var chest = new LockedChest(puzzle, "Chest" + i, "lock1"); AddChestDrops(chest, i, monsterChest); place.AddProp(chest, Placement.Center9); puzzle.Set("Chest" + i + "Open", false); puzzle.Set("Chest" + i + "Monster", monsterChest); } }
void Update() { if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.D)) { playerManager.StepsTaken++; Vector3 OldPos = transform.position; MovePos(); if (OldPos != transform.position) { if (StandingTile.ToggleType) { PressurePlate pressurePlate = StandingTile.GetComponent <PressurePlate>(); pressurePlate.ToggleState(); } else if (StandingTile.SpikeType) { SpikeTile spike = StandingTile.GetComponent <SpikeTile>(); if (spike.State) { playerManager.GetHurt(); } } else if (StandingTile.KeyType) { KeyTile key = StandingTile.GetComponent <KeyTile>(); TotalKeys = key.ToggleState(TotalKeys); } else if (StandingTile.ChestType) { LockedChest chest = StandingTile.GetComponent <LockedChest>(); TotalKeys = chest.ToggleState(TotalKeys); } else if (StandingTile.EndType) { EndTile Finish = StandingTile.GetComponent <EndTile>(); Finish.ToggleState(); MyFiredArrows?.Invoke(); } } } }
public override void OnPuzzleCreate(Puzzle puzzle) { var place = puzzle.GetPlace("Place"); // Get 4 random numbers between 1 and 9 var specialChests = UniqueRnd(4, 1, 2, 3, 4, 5, 6, 7, 8, 9); // Spawn 9 chests, with monsters in 3, and an enchant in one of them for (int i = 1; i <= 9; ++i) { // First 3 special chests are monsters, last is enchant var isMonsterChest = specialChests.Take(3).Contains(i); var isEnchantChest = specialChests[3] == i; var chest = new LockedChest(puzzle, "Chest" + i, "lock1"); AddChestDrops(chest, i, isMonsterChest, isEnchantChest); place.AddProp(chest, Placement.Center9); puzzle.Set("Chest" + i + "Open", false); puzzle.Set("Chest" + i + "Monster", isMonsterChest); } }