protected Voxel AcquireVoxel(VoxelData voxelData, MapPos mapPos, int weight) { Voxel voxel = m_voxelFactory.Acquire(voxelData.Type); voxel.transform.position = m_voxelMap.GetWorldPosition(mapPos, weight); voxel.ReadFrom(voxelData); voxel.WriteDebugInfo(); voxelData.VoxelRef = voxel; return(voxel); }
private VoxelData CreateVoxel(Vector3 position, int type, int weight, int height) { Voxel voxel = m_factory.Acquire(type); voxel.transform.position = position; VoxelData data = m_factory.InstantiateData(type); data.Type = type; data.Height = m_selectedAbilities.VariableHeight ? m_selectedAbilities.ClampHeight(height) : m_selectedAbilities.EvaluateHeight(weight); data.Altitude = Mathf.RoundToInt(position.y / GameConstants.UnitSize); data.Weight = weight; data.Owner = Owner; data.Health = m_selectedAbilities.DefaultHealth; data.VoxelRef = voxel; data.Unit = new VoxelUnitData(); data.Unit.State = VoxelDataState.Idle; voxel.ReadFrom(data); voxel.WriteDebugInfo(); return(data); }