public override void DoMagicAttack(Attack baseAttack) { var player = baseAttack.GetCharacter() as Player; bool origPlaceCost = false; if (player == null) { Debug.LogError("Character with home rune not a player"); return; } try { TerrainModifier.SetTriggerOnPlaced(trigger: true); switch (_Quality) { case RuneQuality.Common: CommonEffect(player); break; case RuneQuality.Ancient: AncientEffect(player); break; case RuneQuality.Dark: DarkEffect(player); break; } SnapToGround.SnappAll(); TerrainModifier.SetTriggerOnPlaced(trigger: false); } catch (Exception e) { Debug.LogError("Home rune effect failed:\n" + e.ToString()); player.PickupPrefab(RuneDB.Instance.GetRune("$HomeRune").prefab); } finally { typeof(Player).GetMethod("SetPlaceMode", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy).Invoke(player, new object[] { null }); typeof(Player).GetField("m_noPlacementCost", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(player, origPlaceCost); } }
// Token: 0x06001085 RID: 4229 RVA: 0x00074EA8 File Offset: 0x000730A8 public void Generate(int seed, ZoneSystem.SpawnMode mode) { DateTime now = DateTime.Now; this.Clear(); this.SetupColliders(); this.SetupAvailableRooms(); if (ZoneSystem.instance) { Vector2i zone = ZoneSystem.instance.GetZone(base.transform.position); this.m_zoneCenter = ZoneSystem.instance.GetZonePos(zone); this.m_zoneCenter.y = base.transform.position.y; } ZLog.Log("Available rooms:" + DungeonGenerator.m_availableRooms.Count); ZLog.Log("To place:" + this.m_maxRooms); DungeonGenerator.m_placedRooms.Clear(); DungeonGenerator.m_openConnections.Clear(); DungeonGenerator.m_doorConnections.Clear(); UnityEngine.Random.State state = UnityEngine.Random.state; UnityEngine.Random.InitState(seed); this.GenerateRooms(mode); this.Save(); ZLog.Log("Placed " + DungeonGenerator.m_placedRooms.Count + " rooms"); UnityEngine.Random.state = state; SnapToGround.SnappAll(); if (mode == ZoneSystem.SpawnMode.Ghost) { foreach (Room room in DungeonGenerator.m_placedRooms) { UnityEngine.Object.DestroyImmediate(room.gameObject); } } DungeonGenerator.m_placedRooms.Clear(); DungeonGenerator.m_openConnections.Clear(); DungeonGenerator.m_doorConnections.Clear(); UnityEngine.Object.DestroyImmediate(this.m_colliderA); UnityEngine.Object.DestroyImmediate(this.m_colliderB); DateTime.Now - now; }