public void UpdatePosition(HandleVector <int> .Handle handle, int x, int y) { if (handle.IsValid()) { ScenePartitionerEntry data = scenePartitionerEntries.GetData(handle); data.UpdatePosition(x, y); } }
public void UpdateFirstParameter(HandleVector <int> .Handle handle, HashedString parameter, float value) { Sound data = sounds.GetData(handle); data.firstParameterValue = value; data.firstParameter = parameter; if (data.IsPlaying) { data.ev.setParameterValueByIndex(GetSoundDescription(data.path).GetParameterIdx(parameter), value); } sounds.SetData(handle, data); }
/// <summary> /// Gets the cavity for the specified grid cell. /// </summary> /// <param name="cell">The grid cell to look up.</param> /// <returns>The cavity for that cell, or null if there is no matching cavity.</returns> public CavityInfo GetCavityForCell(int cell) { CavityInfo cavity = null; if (Grid.IsValidCell(cell)) { lock (cavityInfos) { var id = cavityForCell[cell]; if (id.IsValid()) { cavity = cavityInfos.GetData(id); } } } return(cavity); }
public override void Remove(HandleVector <int> .Handle handle) { pendingRemovals.Add(handle); Entry data = entries.GetData(handle); data.updater = null; entries.SetData(handle, data); }
public void UpdateStorage(HandleVector <int> .Handle fetchable_handle, Storage storage) { Fetchable data = fetchables.GetData(fetchable_handle); byte masterPriority = 0; Prioritizable prioritizable = null; Pickupable pickupable = data.pickupable; if ((Object)pickupable.storage != (Object)null) { prioritizable = pickupable.storage.prioritizable; if ((Object)prioritizable != (Object)null) { PrioritySetting masterPriority2 = prioritizable.GetMasterPriority(); masterPriority = (byte)masterPriority2.priority_value; } } data.masterPriority = masterPriority; fetchables.SetData(fetchable_handle, data); }
public static void Prefix(ICollection <int> visited_cells, KCompactedVector <CavityInfo> ___cavityInfos, HandleVector <int> .Handle[] ___CellCavityID) { int maxRoomSize = TuningData <RoomProber.Tuning> .Get().maxRoomSize; foreach (int current in visited_cells) { HandleVector <int> .Handle handle = ___CellCavityID [current]; if (handle.IsValid()) { CavityInfo data = ___cavityInfos.GetData(handle); if (0 < data.numCells && data.numCells <= maxRoomSize) { GameObject gameObject = Grid.Objects [current, (int)ObjectLayer.Plants]; if (gameObject != null) { KPrefabID component = gameObject.GetComponent <KPrefabID> (); bool flag2 = false; foreach (KPrefabID current2 in data.buildings) { if (component.InstanceID == current2.InstanceID) { flag2 = true; break; } } foreach (KPrefabID current3 in data.plants) { if (component.InstanceID == current3.InstanceID) { flag2 = true; break; } } if (!flag2) { if (component.GetComponent <Deconstructable> ()) { data.AddBuilding(component); } else { if (component.HasTag(GameTags.Plant) && !component.HasTag("ForestTreeBranch".ToTag())) { data.AddPlants(component); } } } } } } } }
private unsafe void ProcessSolidChanges() { int *ptr = stackalloc int[5]; *ptr = 0; ptr[1] = -Grid.WidthInCells; ptr[2] = -1; ptr[3] = 1; ptr[4] = Grid.WidthInCells; foreach (int solidChange in solidChanges) { for (int i = 0; i < 5; i++) { int num = solidChange + ptr[i]; if (Grid.IsValidCell(num)) { floodFillSet.Add(num); HandleVector <int> .Handle item = CellCavityID[num]; if (item.IsValid()) { CellCavityID[num] = HandleVector <int> .InvalidHandle; releasedIDs.Add(item); } } } } CavityInfo cavityInfo = CreateNewCavity(); foreach (int item2 in floodFillSet) { if (!visitedCells.Contains(item2)) { HandleVector <int> .Handle handle = CellCavityID[item2]; if (!handle.IsValid()) { CavityInfo cavityInfo2 = cavityInfo; floodFiller.Reset(cavityInfo2.handle); GameUtil.FloodFillConditional(item2, floodFiller.ShouldContinue, visitedCells, null); if (floodFiller.NumCells > 0) { cavityInfo2.numCells = floodFiller.NumCells; cavityInfo2.minX = floodFiller.MinX; cavityInfo2.minY = floodFiller.MinY; cavityInfo2.maxX = floodFiller.MaxX; cavityInfo2.maxY = floodFiller.MaxY; cavityInfo = CreateNewCavity(); } } } } if (cavityInfo.numCells == 0) { releasedIDs.Add(cavityInfo.handle); } foreach (HandleVector <int> .Handle releasedID in releasedIDs) { CavityInfo data = cavityInfos.GetData(releasedID); if (data.room != null) { ClearRoom(data.room); } cavityInfos.Free(releasedID); } RebuildDirtyCavities(visitedCells); releasedIDs.Clear(); visitedCells.Clear(); solidChanges.Clear(); floodFillSet.Clear(); }