public override void UpdateBrain() { base.UpdateBrain(); if (!((Object)Game.Instance == (Object)null)) { if (!Game.Instance.savedInfo.discoveredSurface) { int cell = Grid.PosToCell(base.gameObject); SubWorld.ZoneType subWorldZoneType = World.Instance.zoneRenderData.GetSubWorldZoneType(cell); if (subWorldZoneType == SubWorld.ZoneType.Space) { Game.Instance.savedInfo.discoveredSurface = true; Vector3 position = base.gameObject.transform.GetPosition(); DiscoveredSpaceMessage message = new DiscoveredSpaceMessage(position); Messenger.Instance.QueueMessage(message); Game.Instance.Trigger(-818188514, base.gameObject); } } if (!Game.Instance.savedInfo.discoveredOilField) { int cell2 = Grid.PosToCell(base.gameObject); SubWorld.ZoneType subWorldZoneType2 = World.Instance.zoneRenderData.GetSubWorldZoneType(cell2); if (subWorldZoneType2 == SubWorld.ZoneType.OilField) { Game.Instance.savedInfo.discoveredOilField = true; } } } }
protected override void OnPrefabInit() { base.OnPrefabInit(); ShaderReloader.Register(OnShadersReloaded); OnShadersReloaded(); masks.Initialize(); SubWorld.ZoneType[] array = (SubWorld.ZoneType[])Enum.GetValues(typeof(SubWorld.ZoneType)); biomeMasks = new GroundMasks.BiomeMaskData[array.Length]; for (int i = 0; i < array.Length; i++) { SubWorld.ZoneType zone_type = array[i]; biomeMasks[i] = GetBiomeMask(zone_type); } }
public static SubWorld GetSubWorldFromType(SubWorld.ZoneType type) { if (World.Zones == null) { return(null); } foreach (var sub in World.Zones) { if (sub.Value.zoneType.Equals(type)) { return(sub.Value); } } return(null); }
private GroundMasks.BiomeMaskData GetBiomeMask(SubWorld.ZoneType zone_type) { GroundMasks.BiomeMaskData result = null; string a = zone_type.ToString().ToLower(); foreach (KeyValuePair <string, GroundMasks.BiomeMaskData> biomeMask in masks.biomeMasks) { string key = biomeMask.Key; if (a == key) { return(biomeMask.Value); } } return(result); }
protected override void OnCleanUp() { base.OnCleanUp(); int cell1 = Grid.PosToCell((KMonoBehaviour)this); for (int x = 0; x < this.width; ++x) { for (int y = 0; y < this.height; ++y) { int cell2 = Grid.OffsetCell(cell1, x, y); SubWorld.ZoneType subWorldZoneType = World.Instance.zoneRenderData.GetSubWorldZoneType(cell2); byte zone_id = subWorldZoneType != SubWorld.ZoneType.Space ? (byte)subWorldZoneType : byte.MaxValue; SimMessages.ModifyCellWorldZone(cell2, zone_id); } } }
public bool CanTunnel() { int num = Grid.PosToCell(this); SubWorld.ZoneType subWorldZoneType = World.Instance.zoneRenderData.GetSubWorldZoneType(num); if (subWorldZoneType == SubWorld.ZoneType.Space) { int num2 = num; while (Grid.IsValidCell(num2) && !Grid.Solid[num2]) { num2 = Grid.CellAbove(num2); } if (!Grid.IsValidCell(num2)) { return(FoundValidDigCell()); } } return(false); }
public OverworldCell(SubWorld.ZoneType zoneType, TerrainCell tc) { poly = tc.poly; tags = tc.node.tags; this.zoneType = zoneType; }