public override void BeginEat(Voxel voxel, long tick) { if (m_emptyIndices.Count == 0) { Debug.LogError("UnitIndex " + VoxelData.UnitOrAssetIndex + " Has Empty Indices " + m_emptyIndices.Count + " Health " + Health); Debug.DebugBreak(); } voxel.Freeze(); voxel.BeginAssimilate(0); VoxelDigestingBehavior digestingBehaviour = voxel.GetComponent <VoxelDigestingBehavior>(); int emptyIndex = GetNextIndex(); //m_cells[emptyIndex].Type = -1; //write type of eaten voxel? m_emptyIndices.Remove(emptyIndex); InsertSorted(emptyIndex, m_usedIndices); IntVec position = ToIntVec(emptyIndex); digestingBehaviour.Completed += OnDigestingCompleted; digestingBehaviour.Digest(this, Stomic, GetPositionLocal(position)); }
private void OnDigestingCompleted(VoxelDigestingBehavior digesting) { digesting.Completed -= OnDigestingCompleted; if (IsAcquired) { IntVec position = GetIntPositionLocal(digesting.TargetPosition); SetTexturePixel(position, true, true); UpdateUI(true); } }