//BLOCK FOR CLASS MEMBERS //END OF BLOCK public MyMedina622Mission() { ID = MyMissionID.TRADE_STATION_ARABS; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("Medina 622 mission"); // Name of mission Name = Localization.MyTextsWrapperEnum.MEDINA_622; Description = Localization.MyTextsWrapperEnum.MEDINA_622_Description; // Description of mission - do not forget to \n at the end of each line //Flags = MyMissionFlags.Story; MyMwcVector3Int baseSector = new MyMwcVector3Int(4027778, 0, 861110); // Story sector of the script - i.e. (-2465,0,6541) Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point - must by typecasted to uint and referenced from EntityID enum RequiredMissions = new MyMissionID[] { /*MyMissionID.ALIEN_GATE*/ }; // IDs of missions required to make this mission available RequiredActors = new MyActorEnum[] { MyActorEnum.MARCUS, MyActorEnum.MADELYN }; m_objectives = new List<MyObjective>(); // Creating of list of submissions //// START OF REACH OBJECTIVE SUBMISSION DEFINITION //var flyInside = new MyObjective( // One member of that list - its type defines the type of submission - MySubmission means fly to the dummypoint to success. Here it is var so you cannot call methods on it // new StringBuilder("Fly over there"), // Name of the submission // MyMissionID.TRADE_STATION_ARABS_FLY_TARGET, // ID of the submission - must be added to MyMissions.cs // new StringBuilder(""), // Description of the submission // null, // this, // new MyMissionID[] { }, // ID of submissions required to make this submission available - it is clear so this submission is the starting submission // new MyMissionLocation(baseSector, (uint)EntityID.FlyTarget) // ID of dummy point of checkpoint //) { SaveOnSuccess = false }; // False means do not save game in that checkpoint //m_objectives.Add(flyInside); // Adding this submission to the list of submissions of current mission //// END OF REACH OBJECTIVE SUBMISSION DEFINITION }
public bool IsSectorInArea(MyMwcVector3Int sectorPosition) { Vector3 sectorPos = MySolarSystemUtils.SectorsToKm(sectorPosition); Vector3 fromSectorToCenter = sectorPos - Position; float fromSectorToCenterDist = fromSectorToCenter.Length(); return fromSectorToCenterDist <= Radius; }
// This method does same thing as GetCell(), but doesn't do it now or immediately. // Instead it adds data cells that are needed to be precalculated to the queue so later they can be calculated on multiple cores. public static MyVoxelCacheCellData GetCellLater(MyVoxelMap voxelMap, ref MyMwcVector3Int cellCoord) { lock (Locker) { MyVoxelCacheCellData cachedDataCell = GetCellFromCache(voxelMap.VoxelMapId, ref cellCoord); // If cell isn't in the cache yet if (cachedDataCell == null) { // If cell and its neighborhood is completely full or completely empty, result of precalc will be zero-triangles, so we can skip precalc. // It can speedup precalc because then we don't have to check every voxel if (voxelMap.IsDataCellCompletelyFullOrCompletelyEmpty(ref cellCoord) == false) { // Cell may have triangles, so add it to cache and run precalc cachedDataCell = AddCell(voxelMap.VoxelMapId, ref cellCoord); MyVoxelPrecalc.AddToQueue(MyLodTypeEnum.LOD0, voxelMap, cachedDataCell, cellCoord.X * MyVoxelConstants.VOXEL_DATA_CELL_SIZE_IN_VOXELS, cellCoord.Y * MyVoxelConstants.VOXEL_DATA_CELL_SIZE_IN_VOXELS, cellCoord.Z * MyVoxelConstants.VOXEL_DATA_CELL_SIZE_IN_VOXELS); } } // I commented out this condition "(cachedDataCell != null)" because now I think we want to move-up in priority list // all data cells, independently of whether they contain or don't contain triangles if (cachedDataCell != null) { UpdateCell(voxelMap.VoxelMapId, ref cellCoord); } return(cachedDataCell); } }
// Add cell into cache and returns reference to it. Cache item with lowest priority is choosen. // Call this method when you want allocate new item in the cache. static MyVoxelCacheCellRender AddCell(int voxelMapId, ref MyMwcVector3Int cellCoord, MyLodTypeEnum cellHashType) { Int64 key = MyVoxelMaps.GetCellHashCode(voxelMapId, ref cellCoord, cellHashType); // Cache item with lowest priority is choosen. LinkedListNode <MyVoxelCacheCellRender> first = m_priority.First; lock (m_priorityLocker) { m_priority.RemoveFirst(); m_priority.AddLast(first); } // If this object already contained some vertex buffers (and of course some render cell), we need to dispose its vertex buffers and // remove from hash table, so that render cell will no longer be in the render cell cache if (first.Value.Contains == true) { System.Diagnostics.Debug.Assert(false, "Cache is full - increase it atm"); Int64 keyForRemoving = MyVoxelMaps.GetCellHashCode(first.Value.VoxelMap.VoxelMapId, ref first.Value.CellCoord, first.Value.CellHashType); m_cellsByCoordinate.Remove(keyForRemoving); first.Value.Reset(); } // Remember where is render cell cache for this render cell m_cellsByCoordinate.Add(key, first); // You have reached the capacity of RENDER cells cache. Consider increasing it. MyCommonDebugUtils.AssertDebug(m_cellsByCoordinate.Count <= m_capacity); return(first.Value); }
private void UpdateOffsetsInSector(MyMwcVector3Int sector) { for (int i = 0; i < m_navigationMarks[sector].Count; i++) { m_navigationMarks[sector][i].UpdateOffsetIndex(i); } }
public MyStealthPlayground() { ID = MyMissionID.STEALTH_PLAYGROUND; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("Stealth playground"); Name = Localization.MyTextsWrapperEnum.EmptyDescription; Description = Localization.MyTextsWrapperEnum.EmptyDescription; MyMwcVector3Int baseSector = new MyMwcVector3Int(-2, 0, 0); Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); RequiredMissions = new MyMissionID[] { MyMissionID.STEALTH_PLAYGROUND }; RequiredActors = new MyActorEnum[] { MyActorEnum.MARCUS, MyActorEnum.MADELYN }; m_objectives = new List<MyObjective>(); //var playgroundSubmission = new MySubmission( // new StringBuilder("Move like a ninja!"), // MyMissionID.PLAYGROUND_SUBMISSION_01, // new StringBuilder(""), // null, // this, // new MyMissionID[] { }, // new MyMissionLocation(baseSector, 831) //); //playgroundSubmission.OnMissionSuccess += PlaygroundSubmissionSubmissionSuccess; //m_submissions.Add(playgroundSubmission); }
public MyVoxelPrecalcTaskItem(MyLodTypeEnum type, MyVoxelMap voxelMap, MyVoxelCacheCellData cache, MyMwcVector3Int voxelStart) { Type = type; VoxelMap = voxelMap; Cache = cache; VoxelStart = voxelStart; }
private void ClearAsteroid(MyGuiScreenMessageBoxCallbackEnum callbackReturn) { if (callbackReturn == MyGuiScreenMessageBoxCallbackEnum.YES) { var voxelMap = m_entity as MyVoxelMap; MyMwcVector3Int voxelCoordMin = new MyMwcVector3Int(0, 0, 0); MyMwcVector3Int voxelCoordMax = voxelMap.Size; // Fix min and max cell coordinates so they don't overlap the voxelmap voxelMap.FixVoxelCoord(ref voxelCoordMin); voxelMap.FixVoxelCoord(ref voxelCoordMax); MyMwcVector3Int voxelCoord; for (voxelCoord.X = voxelCoordMin.X; voxelCoord.X <= voxelCoordMax.X; voxelCoord.X++) { for (voxelCoord.Y = voxelCoordMin.Y; voxelCoord.Y <= voxelCoordMax.Y; voxelCoord.Y++) { for (voxelCoord.Z = voxelCoordMin.Z; voxelCoord.Z <= voxelCoordMax.Z; voxelCoord.Z++) { voxelMap.SetVoxelContent(0, ref voxelCoord); } } } voxelMap.InvalidateCache(voxelCoordMin, voxelCoordMax); OnOkClick(null); } }
public MySolarSystemMapSectorData(MyMwcVector3Int sectorPosition, float fromEntitySize) { SectorPosition = sectorPosition; Entities = new List <MySolarSystemMapEntity>(); //AreaData = new MySolarSystemAreaData(); MinimalEntitySize = fromEntitySize; }
private bool GetSectorDescription(MyMwcVector3Int sectorPosition, out MyTextsWrapperEnum sectorName, out MyTextsWrapperEnum sectorDescription, out MyTexture2D sectorTexture) { if (m_currentSectorDescription.Item1 != sectorPosition) { Tuple <MyTextsWrapperEnum, MyTextsWrapperEnum, MyTexture2D> description = null; Tuple <MyTextsWrapperEnum, MyTextsWrapperEnum, string> result; if (m_sectorDescriptions.TryGetValue(sectorPosition, out result)) { string textureName = "Textures\\GUI\\LoadingScreen\\" + result.Item3; var texture = MyTextureManager.GetTexture <MyTexture2D>(textureName, flags: TextureFlags.IgnoreQuality); description = Tuple.Create(result.Item1, result.Item2, texture); } m_currentSectorDescription = Tuple.Create(sectorPosition, description); } if (m_currentSectorDescription.Item2 != null) { sectorName = m_currentSectorDescription.Item2.Item1; sectorDescription = m_currentSectorDescription.Item2.Item2; sectorTexture = m_currentSectorDescription.Item2.Item3; return(true); } else { sectorName = MyTextsWrapperEnum.Null; sectorDescription = MyTextsWrapperEnum.Null; sectorTexture = null; return(false); } }
// Add decal and all surounding triangles for voxel intersection static void AddDecalVoxel(MyDecalTexturesEnum decalTexture, float decalSize, float decalScale, Vector4 color, bool alphaBlendByAngle, ref MyIntersectionResultLineTriangleEx intersection, ref MyPlane rightPlane, ref MyPlane upPlane, float lightSize, float emissivity, float decalNormalOffset) { MyVoxelMap voxelMap = (MyVoxelMap)intersection.Entity; MyMwcVector3Int renderCellCoord = voxelMap.GetVoxelRenderCellCoordinateFromMeters(ref intersection.IntersectionPointInWorldSpace); BoundingSphere decalBoundingSphere = new BoundingSphere(intersection.IntersectionPointInWorldSpace, decalSize); // If whole decal can't fit inside of render cell, we won't add any of its triangles. This is because // when hiding/removing triangles after explosion, it is easier to check only one render cell. BoundingBox renderCellBoundingBox; voxelMap.GetRenderCellBoundingBox(ref renderCellCoord, out renderCellBoundingBox); // TODO simon - commented as an experiment. If there are bugs with decals on voxels, remove the comment below //if (renderCellBoundingBox.Contains(decalBoundingSphere) != ContainmentType.Contains) return; // If we get null, buffer is full so no new decals can't be placed MyDecalsForVoxelsTriangleBuffer decalsBuffer = m_decalsForVoxels.GetTrianglesBuffer(voxelMap, ref renderCellCoord, decalTexture, ref renderCellBoundingBox); if (decalsBuffer == null) { return; } // We need to create decals on neighborhood triangles too, so we check all triangles if they fall in decal's sphere and if yes, we place decal on them. // We check triangles from same voxelmap or model only. m_neighbourTriangles.Clear(); //intersection.VoxelMap.GetTrianglesIntersectingSphere(ref decalBoundingSphere, intersection.TriangleHelperIndex, m_neighbourTriangles, decalsBuffer.MaxNeighbourTriangles); voxelMap.GetTrianglesIntersectingSphere(ref decalBoundingSphere, m_neighbourTriangles, decalsBuffer.MaxNeighbourTriangles, false); int trianglesToAdd = m_neighbourTriangles.Count;// +1; if (trianglesToAdd == 0) { return; } if (decalsBuffer.CanAddTriangles(trianglesToAdd) == true) { var normalSum = CalculateDominantNormal(m_neighbourTriangles); normalSum *= decalNormalOffset; // Create decal for every neighbour triangleVertexes for (int i = 0; i < m_neighbourTriangles.Count; i++) { trianglesToAdd--; var triangle = m_neighbourTriangles[i]; triangle.Vertexes.Vertex0 += normalSum; triangle.Vertexes.Vertex1 += normalSum; triangle.Vertexes.Vertex2 += normalSum; m_neighbourTriangles[i] = triangle; decalsBuffer.Add(m_neighbourTriangles[i], intersection.NormalInWorldSpace, ref rightPlane, ref upPlane, decalScale, trianglesToAdd, color, alphaBlendByAngle, lightSize, intersection.IntersectionPointInWorldSpace, emissivity); } } }
// Liang-Barsky line clipping. Return true if the line isn't completely clipped. static bool ClipLine(ref Vector3 start, ref Vector3 end, MyMwcVector3Int min, MyMwcVector3Int max) { Vector3 dir = end - start; if (MyMwcUtils.IsZero(dir)) { return(IsPointInside(start, min, max)); } float tE = 0, tL = 1; if (IntersectionT(min.X - start.X, dir.X, ref tE, ref tL) && IntersectionT(start.X - max.X - 1, -dir.X, ref tE, ref tL) && IntersectionT(min.Y - start.Y, dir.Y, ref tE, ref tL) && IntersectionT(start.Y - max.Y - 1, -dir.Y, ref tE, ref tL) && IntersectionT(min.Z - start.Z, dir.Z, ref tE, ref tL) && IntersectionT(start.Z - max.Z - 1, -dir.Z, ref tE, ref tL)) { if (tL < 1) { end = start + tL * dir; } if (tE > 0) { start += tE * dir; } return(true); } return(false); }
public MySmallPirateBase2Mission() { ID = MyMissionID.SMALL_PIRATE_BASE_2; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("Small pirate base 2"); // Nazev mise Name = MyTextsWrapperEnum.SMALL_PIRATE_BASE_2; Description = MyTextsWrapperEnum.SMALL_PIRATE_BASE_2_Description; MyMwcVector3Int baseSector = new MyMwcVector3Int(9708260,0,-2101810); // Story sector of the script Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point RequiredMissions = new MyMissionID[] { }; // mise ktere musi byt splneny pred prijetim teto mise RequiredMissionsForSuccess = new MyMissionID[] { MyMissionID.SMALL_PIRATE_BASE_2_KILL_GENERAL }; RequiredActors = new MyActorEnum[] { MyActorEnum.MARCUS, MyActorEnum.MADELYN, MyActorEnum.TARJA, MyActorEnum.VALENTIN }; m_objectives = new List<MyObjective>(); // Creating of list of submissions // START DEFINICE SUBMISE /* DestroyEnemies = new MyObjectiveDestroy( // Var is used to call functions on that member new StringBuilder("Destroy the mothership"), MyMissionID.SMALL_PIRATE_BASE_2_DESTROY_MOTHERSHIP, new StringBuilder(""), null, this, new MyMissionID[] { }, new List<uint> { (uint)EntityID.Mothership }, new List<uint> { }, false ) { SaveOnSuccess = false }; m_objectives.Add(DestroyEnemies); // pridani do seznamu submisi*/ DestroyGenerator = new MyObjectiveDestroy( // Var is used to call functions on that member new StringBuilder("Destroy the generators"), MyMissionID.SMALL_PIRATE_BASE_2_DESTROY_GENERATOR, new StringBuilder(""), null, this, new MyMissionID[] { }, generators, false ) { SaveOnSuccess = false, HudName = MyTextsWrapperEnum.HudGenerator }; m_objectives.Add(DestroyGenerator); // pridani do seznamu submisi /*DestroyGenerator.MissionEntityIDs.Add((uint)EntityID.Generator_3); DestroyGenerator.MissionEntityIDs.Add((uint)EntityID.Generator_2); DestroyGenerator.MissionEntityIDs.Add((uint)EntityID.Generator);*/ var ReturnToMothership = new MyObjective( // One member of that list - je to MySubmission takze cilem je doletet do checkpointu new StringBuilder("Return to your mothership"), // nazev submise MyMissionID.SMALL_PIRATE_BASE_2_KILL_GENERAL, // id submise new StringBuilder(""), // popis submise null, this, new MyMissionID[] { MyMissionID.SMALL_PIRATE_BASE_2_DESTROY_GENERATOR, }, // ID submisi ktere musi byt splneny - je to prazdne takze je to prvni submise new MyMissionLocation(baseSector, MyMissionLocation.MADELYN_HANGAR), // ID of dummy point of checkpoint radiusOverride: MyMissionLocation.MADELYN_HANGAR_RADIUS ) { SaveOnSuccess = false, HudName = MyTextsWrapperEnum.HudMadelynsSapho }; // nastaveni save na checkpointu nebo ne m_objectives.Add(ReturnToMothership); // pridani do seznamu submisi }
public MyMwcVector3Int? RenderCellCoord; //Render cell coordinate if voxel public MyRenderObject(MyEntity entity, MyMwcVector3Int? renderCellCoord) { Entity = entity; Flags = MyElementFlag.EF_AABB_DIRTY; m_renderFlags = RenderFlags.SkipIfTooSmall | RenderFlags.NeedsResolveCastShadow; RenderCellCoord = renderCellCoord; }
public string SectorName; // Name of sector public MyMwcSectorIdentifier(MyMwcSectorTypeEnum sectorType, int?userId, MyMwcVector3Int position, string sectorName) { SectorType = sectorType; UserId = userId; Position = position; SectorName = sectorName == null ? string.Empty : sectorName; }
public void AddTemplateGroups(MySolarSystemMapData data) { return; // Template groups in solar map are disabled if (SolarMapData.TemplateGroups == null) { return; } Random rnd = new Random(0); foreach (var g in SolarMapData.TemplateGroups) { for (int i = 0; i < g.Count; i++) { var pos = GetRandomPosition(rnd); Vector3 offset; MyMwcVector3Int sector = MySolarSystemUtils.KmToSectors(pos, out offset); var mark = new MySolarSystemMapNavigationMark(sector, "", null, Color.White, TransparentGeometry.MyTransparentMaterialEnum.SolarMapOutpost); mark.Importance = g.Importance; mark.DrawVerticalLine = false; data.NavigationMarks.Add(mark); data.ImportantObjects.Add(new MyImportantSolarObject() { NavigationMark = mark, TemplateGroup = g.TemplateGroup }); //entities.Add(new MySolarSystemMapEntity(sector, offset, 0, "", MySolarSystemEntityEnum.OutpostIcon)); } } }
private void TravelSectorLoaded(MyMwcTravelTypeEnum travelType, MyMwcVector3Int targetSector, byte[] sectorDataResponse, MyMwcObjectBuilder_Sector cachedSector) { var checkpoint = GetCheckpointBuilder(false); checkpoint.SectorObjectBuilder = cachedSector; // Overwrite current sector checkpoint.CurrentSector.Position = targetSector; UpdatePlayerPosition(travelType, ref checkpoint.PlayerObjectBuilder.ShipObjectBuilder.PositionAndOrientation.Position); if (sectorDataResponse != null) { checkpoint.SectorObjectBuilder = MyMwcObjectBuilder_Base.FromBytes <MyMwcObjectBuilder_Sector>(sectorDataResponse); MyLocalCache.Save(null, checkpoint.SectorObjectBuilder, checkpoint.CurrentSector); } // Change NEW_STORY to LOAD_CHECKPOINT, because it's necessary, travel is never new story MyMwcStartSessionRequestTypeEnum?sessionStart = null; if (MyGuiScreenGamePlay.Static != null) { sessionStart = MyGuiScreenGamePlay.Static.GetSessionType(); if (sessionStart.HasValue && sessionStart.Value == MyMwcStartSessionRequestTypeEnum.NEW_STORY) { sessionStart = MyMwcStartSessionRequestTypeEnum.LOAD_CHECKPOINT; } } MyGuiScreenGamePlay.ReloadGameplayScreen(checkpoint, sessionStart, null, null, travelType); }
//BLOCK FOR CLASS MEMBERS //END OF BLOCK public MyMedina622Mission() { ID = MyMissionID.TRADE_STATION_ARABS; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("Medina 622 mission"); // Name of mission Name = Localization.MyTextsWrapperEnum.MEDINA_622; Description = Localization.MyTextsWrapperEnum.MEDINA_622_Description; // Description of mission - do not forget to \n at the end of each line //Flags = MyMissionFlags.Story; MyMwcVector3Int baseSector = new MyMwcVector3Int(4027778, 0, 861110); // Story sector of the script - i.e. (-2465,0,6541) Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point - must by typecasted to uint and referenced from EntityID enum RequiredMissions = new MyMissionID[] { /*MyMissionID.ALIEN_GATE*/ }; // IDs of missions required to make this mission available RequiredActors = new MyActorEnum[] { MyActorEnum.MARCUS, MyActorEnum.MADELYN }; m_objectives = new List <MyObjective>(); // Creating of list of submissions //// START OF REACH OBJECTIVE SUBMISSION DEFINITION //var flyInside = new MyObjective( // One member of that list - its type defines the type of submission - MySubmission means fly to the dummypoint to success. Here it is var so you cannot call methods on it // new StringBuilder("Fly over there"), // Name of the submission // MyMissionID.TRADE_STATION_ARABS_FLY_TARGET, // ID of the submission - must be added to MyMissions.cs // new StringBuilder(""), // Description of the submission // null, // this, // new MyMissionID[] { }, // ID of submissions required to make this submission available - it is clear so this submission is the starting submission // new MyMissionLocation(baseSector, (uint)EntityID.FlyTarget) // ID of dummy point of checkpoint //) { SaveOnSuccess = false }; // False means do not save game in that checkpoint //m_objectives.Add(flyInside); // Adding this submission to the list of submissions of current mission //// END OF REACH OBJECTIVE SUBMISSION DEFINITION }
public MyStealthPlayground() { ID = MyMissionID.STEALTH_PLAYGROUND; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("Stealth playground"); Name = Localization.MyTextsWrapperEnum.EmptyDescription; Description = Localization.MyTextsWrapperEnum.EmptyDescription; MyMwcVector3Int baseSector = new MyMwcVector3Int(-2, 0, 0); Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); RequiredMissions = new MyMissionID[] { MyMissionID.STEALTH_PLAYGROUND }; RequiredActors = new MyActorEnum[] { MyActorEnum.MARCUS, MyActorEnum.MADELYN }; m_objectives = new List <MyObjective>(); //var playgroundSubmission = new MySubmission( // new StringBuilder("Move like a ninja!"), // MyMissionID.PLAYGROUND_SUBMISSION_01, // new StringBuilder(""), // null, // this, // new MyMissionID[] { }, // new MyMissionLocation(baseSector, 831) //); //playgroundSubmission.OnMissionSuccess += PlaygroundSubmissionSubmissionSuccess; //m_submissions.Add(playgroundSubmission); }
public void Begin(MyVoxelMap voxelMap, ref MyMwcVector3Int cellCoord) { VoxelMap = voxelMap; CellCoord = cellCoord; Center = voxelMap.GetRenderCellCenterPositionAbsolute(ref cellCoord); Contains = true; MyVoxelCacheCellRenderHelper.Begin(); }
private static void LoadCellInBackground( MyVoxelMap voxelMap, ref MyMwcVector3Int renderCellCoord, MyLodTypeEnum cellHashType) { System.Diagnostics.Debug.Assert(false, "Not implemented"); MyCommonDebugUtils.AssertDebug(voxelMap != null); //m_queue.Enqueue(new RenderCellLoadJob(voxelMap, ref renderCellCoord, cellHashType)); //m_event.Set(); }
public bool IsSectorInArea(MyMwcVector3Int sectorPosition) { Vector3 sectorPos = MySolarSystemUtils.SectorsToKm(sectorPosition); Vector3 fromSectorToCenter = sectorPos - Position; float fromSectorToCenterDist = fromSectorToCenter.Length(); return(fromSectorToCenterDist <= Radius); }
// Blends-out triangles affected by explosion (radius + some safe delta). Triangles there have zero alpha are flaged to not-draw at all. public static void HideTrianglesAfterExplosion(MyVoxelMap voxelMap, ref BoundingSphere explosionSphere) { MyRender.GetRenderProfiler().StartProfilingBlock("MyDecals::HideTrianglesAfterExplosion"); MyMwcVector3Int renderCellCoord = voxelMap.GetVoxelRenderCellCoordinateFromMeters(ref explosionSphere.Center); m_decalsForVoxels.HideTrianglesAfterExplosion(voxelMap.VoxelMapId, ref renderCellCoord, ref explosionSphere); MyRender.GetRenderProfiler().EndProfilingBlock(); }
private void RecalculatePositions() { ClearPositionsAndMaxContent(); int sizeInVoxels = MyVoxelConstants.VOXEL_DATA_CELL_SIZE_IN_VOXELS * MyVoxelConstants.VOXEL_MAP_ORE_DEPOSIT_CELL_IN_DATA_CELLS; MyMwcVector3Int voxelStartCoord = new MyMwcVector3Int(sizeInVoxels * m_coord.X, sizeInVoxels * m_coord.Y, sizeInVoxels * m_coord.Z); MyMwcVector3Int voxelEndCoord = new MyMwcVector3Int(voxelStartCoord.X + sizeInVoxels - 1, voxelStartCoord.Y + sizeInVoxels - 1, voxelStartCoord.Z + sizeInVoxels - 1); MyMwcVector3Int voxelCoord; for (voxelCoord.X = voxelStartCoord.X; voxelCoord.X <= voxelEndCoord.X; voxelCoord.X++) { for (voxelCoord.Y = voxelStartCoord.Y; voxelCoord.Y <= voxelEndCoord.Y; voxelCoord.Y++) { for (voxelCoord.Z = voxelStartCoord.Z; voxelCoord.Z <= voxelEndCoord.Z; voxelCoord.Z++) { byte content = m_voxelMap.GetVoxelContent(ref voxelCoord); if (content >= MyVoxelConstants.VOXEL_ISO_LEVEL) { MyMwcVoxelMaterialsEnum material = m_voxelMap.GetVoxelMaterial(ref voxelCoord); byte maxContent; m_helpersMaxContentForMaterial.TryGetValue((int)material, out maxContent); if (!m_allMaterialsPositions.ContainsKey((int)material) || content > maxContent) { if (!m_allMaterialsPositions.ContainsKey((int)material)) { m_allMaterialsPositions.Add((int)material, m_voxelMap.GetVoxelCenterPositionAbsolute(ref voxelCoord)); } else { m_allMaterialsPositions[(int)material] = m_voxelMap.GetVoxelCenterPositionAbsolute(ref voxelCoord); } if (!m_helpersMaxContentForMaterial.ContainsKey((int)material)) { m_helpersMaxContentForMaterial.Add((int)material, content); } else { m_helpersMaxContentForMaterial[(int)material] = content; } } } } } } //if (m_oreWithContent.Count > 0) //{ // SortByContent(); // m_position = m_allMaterialsPositions[(int)m_oreWithContent[0]].Value; //} //else //{ // m_position = WorldAABB.GetCenter(); //} }
// I am using method for calculating voxel cell hash code instead of struct for storing key. // I am trying to generate hash code scaled in larger space. Minimal difference between too closest cells is MAX_VOXEL_CELLS_COUNT. // Resons: // - Int is faster than struct storing four ints // - Struct was for some unknown reasons making garbage. Every call to TryGetValue() // was allocating something. Probably because of boxing when calculating GetHashCode(0 // or doing Equals(), but I am not sure. public static Int64 GetCellHashCode(int voxelMapId, ref MyMwcVector3Int cellCoord, MyLodTypeEnum cellHashType) { return (voxelMapId * MAX_VOXEL_CELLS_COUNT * MAX_VOXEL_CELLS_COUNT * MAX_VOXEL_CELLS_COUNT * MAX_VOXEL_CELLS_COUNT * MAX_VOXEL_CELLS_COUNT + cellCoord.X * MAX_VOXEL_CELLS_COUNT * MAX_VOXEL_CELLS_COUNT * MAX_VOXEL_CELLS_COUNT * MAX_VOXEL_CELLS_COUNT + cellCoord.Y * MAX_VOXEL_CELLS_COUNT * MAX_VOXEL_CELLS_COUNT * MAX_VOXEL_CELLS_COUNT + cellCoord.Z * MAX_VOXEL_CELLS_COUNT * MAX_VOXEL_CELLS_COUNT + (int)cellHashType * MAX_VOXEL_CELLS_COUNT); }
public bool IsNotInSameSector() { Debug.Assert(Exist); MyMwcVector3Int currentSector = MyGuiScreenGamePlay.Static.GetSectorIdentifier().Position; return(SectorPosition.Value.X != currentSector.X || SectorPosition.Value.Y != currentSector.Y || SectorPosition.Value.Z != currentSector.Z); }
private bool CheckVoxelCoord(ref MyMwcVector3Int cellCoord) { return((uint)(cellCoord.X | cellCoord.Y | cellCoord.Z) < (uint)MyVoxelConstants.VOXEL_DATA_CELL_SIZE_IN_VOXELS); // VOXEL_DATA_CELL_SIZE_IN_VOXELS must be a power of 2 /* * return (cellCoord.X >= 0 && cellCoord.Y >= 0 && cellCoord.Z >= 0) && * (cellCoord.X < MyVoxelConstants.VOXEL_DATA_CELL_SIZE_IN_VOXELS && cellCoord.Y < MyVoxelConstants.VOXEL_DATA_CELL_SIZE_IN_VOXELS && cellCoord.Z < MyVoxelConstants.VOXEL_DATA_CELL_SIZE_IN_VOXELS); */ }
public MyGuiScreenEnterSectorProgress(MyMwcTravelTypeEnum travelType, MyMwcVector3Int targetSectorPosition, Vector3 currentShipPosition, System.Action<MyMwcObjectBuilder_Sector, Vector3> enterSectorSuccessfulAction) : base(MyTextsWrapperEnum.EnterSectorInProgressPleaseWait, false) { m_backgroundFadeColor = MyGuiConstants.SCREEN_BACKGROUND_FADE_BLANK_DARK_PROGRESS_SCREEN; m_travelType = travelType; m_targetSectorPosition = targetSectorPosition; m_currentShipPosition = currentShipPosition; m_enterSectorSuccessfulAction = enterSectorSuccessfulAction; }
public MyGuiScreenEnterSectorProgress(MyMwcTravelTypeEnum travelType, MyMwcVector3Int targetSectorPosition, Vector3 currentShipPosition, System.Action <MyMwcObjectBuilder_Sector, Vector3> enterSectorSuccessfulAction) : base(MyTextsWrapperEnum.EnterSectorInProgressPleaseWait, false) { m_backgroundFadeColor = MyGuiConstants.SCREEN_BACKGROUND_FADE_BLANK_DARK_PROGRESS_SCREEN; m_travelType = travelType; m_targetSectorPosition = targetSectorPosition; m_currentShipPosition = currentShipPosition; m_enterSectorSuccessfulAction = enterSectorSuccessfulAction; }
public MySolarfactoryEACMission() { m_ValidateIDlists = new List <List <uint> >(); m_ValidateIDlists.Add(m_greenLights); m_ValidateIDlists.Add(m_redLights); ID = MyMissionID.SOLAR_PLANT_EAC; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("Solar factory - EAC"); // Nazev mise Name = MyTextsWrapperEnum.SOLAR_PLANT_EAC; Description = MyTextsWrapperEnum.EmptyDescription; MyMwcVector3Int baseSector = new MyMwcVector3Int(2700837, 0, -1774663); // Story sector of the script Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Startmy point RequiredMissions = new MyMissionID[] { }; // mise ktere musi byt splneny pred prijetim teto mise RequiredMissionsForSuccess = new MyMissionID[] { MyMissionID.SOLAR_PLANT_EAC_RETURN }; RequiredActors = new MyActorEnum[] { MyActorEnum.MARCUS, MyActorEnum.MADELYN, MyActorEnum.TARJA, MyActorEnum.VALENTIN }; m_objectives = new List <MyObjective>(); // Creating of list of submissions // START DEFINICE SUBMISE var DestroyTransformator = new MyObjectiveDestroy( // Var is used to call functions on that member new StringBuilder("Destroy the transformer"), MyMissionID.SOLAR_PLANT_EAC_DESTROY, new StringBuilder(""), null, this, new MyMissionID[] { }, Transformators, false ) { SaveOnSuccess = false, HudName = MyTextsWrapperEnum.HudTransformer }; DestroyTransformator.OnMissionSuccess += new Missions.MissionHandler(DestroyedTransformator); m_objectives.Add(DestroyTransformator); // pridani do seznamu submisi var ReturnToMothership = new MyObjective( // One member of that list - je to MyObjective takze cilem je doletet do checkpointu new StringBuilder("Return to your mothership"), // nazev submise MyMissionID.SOLAR_PLANT_EAC_RETURN, // id submise new StringBuilder(""), // popis submise null, this, new MyMissionID[] { MyMissionID.SOLAR_PLANT_EAC_DESTROY, }, // ID submisi ktere musi byt splneny - je to prazdne takze je to prvni submise new MyMissionLocation(baseSector, MyMissionLocation.MADELYN_HANGAR), // ID of dummy point of checkpoin //StartDialogId: MyDialogueEnum.SLAVERBASE_0900_NUKE_HACKED, radiusOverride: MyMissionLocation.MADELYN_HANGAR_RADIUS) { SaveOnSuccess = false, HudName = MyTextsWrapperEnum.HudMadelynsSapho }; // nastaveni save na checkpointu nebo ne m_objectives.Add(ReturnToMothership); // }
private void AddEntity(MySolarSystemMapData data, Vector3 posMillKm, float radiusMillKm, string name, MySolarSystemEntityEnum entityType, Color color, object entityData = null) { float radius = radiusMillKm * MyBgrCubeConsts.MILLION_KM; Vector3 offset; MyMwcVector3Int sector = MySolarSystemUtils.MillionKmToSectors(posMillKm, out offset); var entity = new MySolarSystemMapEntity(sector, offset, radius, name, entityType, color); entity.EntityData = entityData; data.Entities.Add(entity); }
public MyFortValiantMissionBase() { Flags = MyMissionFlags.Story; baseSector = new MyMwcVector3Int(-588410, 0, -3425542); // Story sector of the script - i.e. (-2465,0,6541) Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point - must by typecasted to uint and referenced from EntityID enum RequiredMissions = new MyMissionID[] { MyMissionID.JUNKYARD_RETURN }; // IDs of missions required to make this mission available RequiredMissionsForSuccess = new MyMissionID[] { MyMissionID.FORT_VALIANT_RETURN_BACK_TO_MADELYN_2 }; }
public MySmallPirateBase2() { ID = MyMissionID.SMALL_PIRATE_BASE_2; /* ID must be added to MyMissions.cs */ Name = new StringBuilder("Small pirate base 2"); // Nazev mise Description = new StringBuilder( // popis mise "Destroy the station\n" ); MyMwcVector3Int baseSector = new MyMwcVector3Int(9708260,0,-2101810); // Story sector of the script Location = new MyMissionLocation(baseSector, 1749); // Starting dummy point RequiredMissions = new MyMissionID[] { }; // mise ktere musi byt splneny pred prijetim teto mise m_submissions = new List<MyObjective>(); // Creating of list of submissions // START DEFINICE SUBMISE DestroyEnemies = new MyObjectiveDestroy( // Var is used to call functions on that member new StringBuilder("Destroy the mothership"), MyMissionID.SMALL_PIRATE_BASE_2_DESTROY_ENEMIES, new StringBuilder(""), null, this, new MyMissionID[] { }, new List<uint> { 5293 }, new List<uint> { }, false ) { SaveOnSuccess = false }; m_submissions.Add(DestroyEnemies); // pridani do seznamu submisi DestroyGenerator = new MyObjectiveDestroy( // Var is used to call functions on that member new StringBuilder("Destroy the generator"), MyMissionID.SMALL_PIRATE_BASE_2_DESTROY_GENERATOR, new StringBuilder(""), null, this, new MyMissionID[] { }, new List<uint> { 812 }, new List<uint> { }, false ) { SaveOnSuccess = false }; m_submissions.Add(DestroyGenerator); // pridani do seznamu submisi var escape = new MyObjective( // One member of that list - je to MySubmission takze cilem je doletet do checkpointu new StringBuilder("Return to the mothership"), // nazev submise MyMissionID.PIRATE_BASE_1_ESCAPE, // id submise new StringBuilder(""), // popis submise null, this, new MyMissionID[] { MyMissionID.PIRATE_BASE_1_DESTROY_GENERATOR, }, // ID submisi ktere musi byt splneny - je to prazdne takze je to prvni submise new MyMissionLocation(baseSector, 2475) // ID of dummy point of checkpoint ) { SaveOnSuccess = false }; // nastaveni save na checkpointu nebo ne m_submissions.Add(escape); // pridani do seznamu submisi }
public MyHippieOutpostMission() { ID = MyMissionID.HIPPIE_OUTPOST; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("Hippie Outpost"); // Name of mission Name = MyTextsWrapperEnum.HIPPIE_OUTPOST; Description = MyTextsWrapperEnum.HIPPIE_OUTPOST_Description; MyMwcVector3Int baseSector = new MyMwcVector3Int(238307, 0, -2545498); // Story sector of the script - i.e. (-2465,0,6541) RequiredMissions = new MyMissionID[] { }; Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point - must by typecasted to uint and referenced from EntityID enum RequiredActors = new MyActorEnum[] { MyActorEnum.MADELYN }; m_objectives = new List <MyObjective>(); // Creating of list of submissions var reach_outpost = new MyObjective( // One member of that list - its type defines the type of submission - MySubmission means fly to the dummypoint to success. Here it is var so you cannot call methods on it new StringBuilder("See what's wrong!"), // Name of the submission MyMissionID.REACH_OUTPOST, // ID of the submission - must be added to MyMissions.cs new StringBuilder("\n"), // Description of the submission null, this, new MyMissionID[] { }, // ID of submissions required to make this submission available - it is clear so this submission is the starting submission new MyMissionLocation(baseSector, (uint)EntityID.reach) // ID of dummy point of checkpoint ) { SaveOnSuccess = false, HudName = MyTextsWrapperEnum.Nothing }; // False means do not save game in that checkpoint m_objectives.Add(reach_outpost); // START OF DESTROY SUBMISSION DEFINITION var KillKharmaSpoilers = new MyObjectiveDestroy( // MySubmissionDestroy means mission with objective to destroy something - here it is class member so you can call methods on it new StringBuilder("Place the karma spoilers"), //Name of the submission MyMissionID.KILL_ALL, // ID of the submission new StringBuilder("Don't let them spread negative energy!\n"), // Description of the submission null, this, new MyMissionID[] { MyMissionID.REACH_OUTPOST }, // ID of submissions required to make this submission available - these declares the sequence of submissions null, new List <uint> { (uint)EntityID.Spawn1, (uint)EntityID.Spawn2, (uint)EntityID.Spawn3, (uint)EntityID.Spawn4, (uint)EntityID.Spawn5, (uint)EntityID.Spawn6, (uint)EntityID.Spawn7 }, // ID of objects to be destroyed as a mission objective true ) { SaveOnSuccess = true, HudName = MyTextsWrapperEnum.Nothing }; m_objectives.Add(KillKharmaSpoilers); // END OF DESTROY SUBMISSION DEFINITION }
public MySolarSystemMapEntity(MyMwcVector3Int sector, Vector3 positionInSector, float radius, string name, MySolarSystemEntityEnum entityType, Color color) { //System.Diagnostics.Debug.Assert(Math.Abs(positionInSector.X) <= MyBgrCubeConsts.SECTOR_SIZE / 2 && Math.Abs(positionInSector.Y) <= MyBgrCubeConsts.SECTOR_SIZE / 2 && Math.Abs(positionInSector.Z) <= MyBgrCubeConsts.SECTOR_SIZE / 2, "Position is out of sector!"); MinerWars.AppCode.Game.Utils.MyUtils.AssertIsValid(positionInSector); Sector = sector; PositionInSector = positionInSector; Radius = radius; Name = name; Color = color; EntityType = entityType; }
public MySolarSystemMapNavigationMark(MyMwcVector3Int sector, string name, MyMissionID?missionID, Color color, MyTransparentMaterialEnum texture) { Sector = sector; Name = name; Color = color; Texture = texture; Importance = 1; DrawVerticalLine = true; MissionID = missionID; Font = MyGuiManager.GetFontMinerWarsWhite(); }
public MyGuiScreenLoadCheckpointProgress(MyMwcSectorTypeEnum sessionType, MyMwcSessionStateEnum sessionStartType, int? userId, MyMwcVector3Int? position, string checkpointName, System.Action<MyMwcObjectBuilder_Checkpoint> enterSectorSuccessfulAction) : base(MyTextsWrapperEnum.EnterSectorInProgressPleaseWait, false, TimeSpan.FromSeconds(360)) // Some missions loads very long (Roch's junkyard) { m_backgroundFadeColor = MyGuiConstants.SCREEN_BACKGROUND_FADE_BLANK_DARK_PROGRESS_SCREEN; m_sessionType = sessionType; m_sessionStartType = sessionStartType; m_userId = userId; m_sectorPosition = position; m_checkpointName = checkpointName; m_loadCheckpointSuccessfulAction = enterSectorSuccessfulAction; }
// Same as GetMaterial() - but this is for indestructible content public byte GetIndestructibleContent(ref MyMwcVector3Int voxelCoordInCell) { if (m_singleMaterialForWholeCell == true) { return m_singleIndestructibleContent; } else { return m_indestructibleContent[voxelCoordInCell.X * xStep + voxelCoordInCell.Y * yStep + voxelCoordInCell.Z * zStep]; } }
// Change material for specified voxel // If this material is single material for whole cell, we do nothing. Otherwise we allocate 3D arrays and start using them. public void SetMaterialAndIndestructibleContent(MyMwcVoxelMaterialsEnum material, byte indestructibleContent, ref MyMwcVector3Int voxelCoordInCell) { CheckInitArrays(material); if (m_singleMaterialForWholeCell == false) { int xyz = voxelCoordInCell.X * xStep + voxelCoordInCell.Y * yStep + voxelCoordInCell.Z * zStep; m_materials[xyz] = material; m_indestructibleContent[xyz] = indestructibleContent; } }
// Blends-out triangles affected by explosion (radius + some safe delta). Triangles there have zero alpha are flaged to not-draw at all. public void HideTrianglesAfterExplosion(int voxelMapId, ref MyMwcVector3Int renderCellCoord, ref BoundingSphere explosionSphere) { // Search for all buffers storing this voxelmap and render cell foreach (MyDecalsForVoxelsTriangleBuffer buffer in m_usedTriangleBuffers) { if ((buffer.VoxelMap.VoxelMapId == voxelMapId) && (buffer.RenderCellCoord.Equals(renderCellCoord))) { buffer.HideTrianglesAfterExplosion(ref explosionSphere); } } }
//BLOCK FOR CLASS MEMBERS //END OF BLOCK public MyChineseSolarArrayAttackMission() { ID = MyMissionID.SOLAR_PLANT_CHINA; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("Destroy the Chinese solar plant"); // Name of mission Name = MyTextsWrapperEnum.SOLAR_PLANT_CHINA; Description = MyTextsWrapperEnum.SOLAR_PLANT_CHINA_Description; //Flags = MyMissionFlags.Story; MyMwcVector3Int baseSector = new MyMwcVector3Int(-1185103, 0, 3822834); // Story sector of the script - i.e. (-2465,0,6541) Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point - must by typecasted to uint and referenced from EntityID enum RequiredMissions = new MyMissionID[] { /*MyMissionID.ALIEN_GATE*/ }; // IDs of missions required to make this mission available RequiredMissionsForSuccess = new MyMissionID[] { MyMissionID.SOLAR_PLANT_CHINA_FLY_TARGET }; RequiredActors = new MyActorEnum[] { MyActorEnum.MARCUS, MyActorEnum.MADELYN }; m_objectives = new List<MyObjective>(); // Creating of list of submissions //var destroy1 = new MyObjectiveDestroy( // new StringBuilder("Destroy the comm station"), // MyMissionID.SOLAR_PLANT_CHINA_DESTROY_TARGET_1, // new StringBuilder("Destroy the satellite communication station to prevent the Chinese from calling reinforcements.\n"), // null, // this, // new MyMissionID[] { }, // new List<uint>() { (uint)EntityID.DestroyPrefab1Id } //) { SaveOnSuccess = false }; //m_objectives.Add(destroy1); //var destroy2 = new MyObjectiveDestroy( // new StringBuilder("Destroy the accumulators"), // MyMissionID.SOLAR_PLANT_CHINA_DESTROY_TARGET_2, // new StringBuilder("Destroying three accumulators will seriously disrupt the energy supply of the Chinese.\n"), // null, // this, // new MyMissionID[] { MyMissionID.SOLAR_PLANT_CHINA_DESTROY_TARGET_1 }, // new List<uint>() { (uint)EntityID.DestroyPrefab2Id, (uint)EntityID.DestroyPrefab3Id, (uint)EntityID.DestroyPrefab4Id } //) { SaveOnSuccess = false }; //m_objectives.Add(destroy2); //// START OF REACH OBJECTIVE SUBMISSION DEFINITION //var flyInside = new MyObjective( // One member of that list - its type defines the type of submission - MySubmission means fly to the dummypoint to success. Here it is var so you cannot call methods on it // new StringBuilder("Return to Madelyn"), // Name of the submission // MyMissionID.SOLAR_PLANT_CHINA_FLY_TARGET, // ID of the submission - must be added to MyMissions.cs // new StringBuilder("Fly to your mothership to get away.\n"), // Description of the submission // null, // this, // new MyMissionID[] { MyMissionID.SOLAR_PLANT_CHINA_DESTROY_TARGET_2 }, // ID of submissions required to make this submission available - it is clear so this submission is the starting submission // new MyMissionLocation(baseSector, (uint)EntityID.FlyTarget) // ID of dummy point of checkpoint //) { SaveOnSuccess = false }; // False means do not save game in that checkpoint //m_objectives.Add(flyInside); // Adding this submission to the list of submissions of current mission //// END OF REACH OBJECTIVE SUBMISSION DEFINITION }
public MyArabianBorderMission() { ID = MyMissionID.ARABIAN_BORDER; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("Arabian border"); // Name of mission Name = MyTextsWrapperEnum.ARABIAN_BORDER; Description = MyTextsWrapperEnum.ARABIAN_BORDER_Description; MyMwcVector3Int baseSector = new MyMwcVector3Int(6477920, 0, -2331108); // Story sector of the script - i.e. (-2465,0,6541) RequiredMissions = new MyMissionID[] { }; Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point - must by typecasted to uint and referenced from EntityID enum RequiredActors = new MyActorEnum[] { MyActorEnum.MADELYN }; m_objectives = new List<MyObjective>(); // Creating of list of submissions }
public MyNewNanjingMission() { ID = MyMissionID.NEW_NANJING; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("New Nanjing"); // Name of mission Name = MyTextsWrapperEnum.NEW_NANJING; Description = MyTextsWrapperEnum.NEW_NANJING_Description; MyMwcVector3Int baseSector = new MyMwcVector3Int(719329, 0, 3942993); // Story sector of the script - i.e. (-2465,0,6541) RequiredMissions = new MyMissionID[] { }; Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point - must by typecasted to uint and referenced from EntityID enum RequiredActors = new MyActorEnum[] { MyActorEnum.MADELYN }; m_objectives = new List<MyObjective>(); // Creating of list of submissions }
// Return material for specified voxel. If whole cell contain one single material, this one is returned. Otherwise material from 3D array is returned. public MyMwcVoxelMaterialsEnum GetMaterial(ref MyMwcVector3Int voxelCoordInCell) { if (MyFakes.SINGLE_VOXEL_MATERIAL != null) return MyFakes.SINGLE_VOXEL_MATERIAL.Value; if (m_singleMaterialForWholeCell == true) { return m_singleMaterial; } else { return m_materials[voxelCoordInCell.X * xStep + voxelCoordInCell.Y * yStep + voxelCoordInCell.Z * zStep]; } }
public override float GetSectorInterpolator(MyMwcVector3Int sectorPosition) { Vector3 sectorPos = MySolarSystemUtils.SectorsToKm(sectorPosition); Vector3 fromSectorToCenter = sectorPos - Position; float fromSectorToCenterDist = fromSectorToCenter.Length(); if (fromSectorToCenterDist > Radius) { // Out of circle zone return 0; } float cubicInterpolator = MathHelper.SmoothStep(0, 1, fromSectorToCenterDist / Radius); return cubicInterpolator; }
public MySmallPirateBaseMission() { ID = MyMissionID.PIRATE_BASE_1; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("Small pirate base"); // Nazev mise Name = MyTextsWrapperEnum.PIRATE_BASE_1; Description = MyTextsWrapperEnum.PIRATE_BASE_1_Description; MyMwcVector3Int baseSector = new MyMwcVector3Int(14393995,0,2939339); // Story sector of the script Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point RequiredMissions = new MyMissionID[] { }; // mise ktere musi byt splneny pred prijetim teto mise RequiredMissionsForSuccess = new MyMissionID[] { MyMissionID.PIRATE_BASE_1_ESCAPE }; RequiredActors = new MyActorEnum[] { MyActorEnum.MARCUS, MyActorEnum.MADELYN, MyActorEnum.TARJA, MyActorEnum.VALENTIN }; m_objectives = new List<MyObjective>(); // Creating of list of submissions // START DEFINICE SUBMISE DestroyGenerator = new MyObjectiveDestroy( // Var is used to call functions on that member new StringBuilder("Destroy the generator"), MyMissionID.PIRATE_BASE_1_DESTROY_GENERATOR, new StringBuilder(""), null, this, new MyMissionID[] { }, generators, false ) { SaveOnSuccess = false, HudName = MyTextsWrapperEnum.HudGenerator }; m_objectives.Add(DestroyGenerator); // pridani do seznamu submisi DestroyGenerator.OnMissionSuccess += new Missions.MissionHandler(DestroyMSSuccess); var escape = new MyObjective( // One member of that list - je to MySubmission takze cilem je doletet do checkpointu new StringBuilder("Escape"), // nazev submise MyMissionID.PIRATE_BASE_1_ESCAPE, // id submise new StringBuilder(""), // popis submise null, this, new MyMissionID[] { MyMissionID.PIRATE_BASE_1_DESTROY_GENERATOR, }, // ID submisi ktere musi byt splneny - je to prazdne takze je to prvni submise new MyMissionLocation(baseSector, MyMissionLocation.MADELYN_HANGAR), // ID of dummy point of checkpoint radiusOverride: MyMissionLocation.MADELYN_HANGAR_RADIUS ) { SaveOnSuccess = false, HudName = MyTextsWrapperEnum.HudMadelynsSapho }; // nastaveni save na checkpointu nebo ne m_objectives.Add(escape); // pridani do seznamu submisi }
public MyMilitaryOutpostMission() { ID = MyMissionID.MILITARY_OUTPOST; /* ID must be added to MyMissions.cs */ Name = new StringBuilder("Military outpost"); // Name of mission Description = new StringBuilder("Conquer the outposts.\n "); MyMwcVector3Int baseSector = new MyMwcVector3Int(-3210402, 0, 2812826); // Story sector of the script - i.e. (-2465,0,6541) RequiredMissions = new MyMissionID[] { }; Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point - must by typecasted to uint and referenced from EntityID enum RequiredActors = new MyActorEnum[] { MyActorEnum.Madelyn }; m_objectives = new List<MyObjective>(); // Creating of list of submissions }
public MyGuiScreenEnterSectorMap(MyGuiScreenBase closeAfterSuccessfulEnter, MyMwcStartSessionRequestTypeEnum startSessionType, MyTextsWrapperEnum startSessionProgressText, MyMwcVector3Int? lastSandboxSector) : base(new Vector2(0.5f, 0.5f), MyGuiConstants.SCREEN_BACKGROUND_COLOR, new Vector2(700f / 1600f, 700 / 1200f)) { m_closeAfterSuccessfulEnter = closeAfterSuccessfulEnter; m_startSessionType = startSessionType; m_startSessionProgressText = startSessionProgressText; m_enableBackgroundFade = true; m_sectors = new List<MyMwcSectorIdentifier>(); m_backgroundTexture = MyTextureManager.GetTexture<MyTexture2D>("Textures\\GUI\\BackgroundScreen\\ConfigWheelBackground", flags: TextureFlags.IgnoreQuality); m_lastSandboxSector = lastSandboxSector; RecreateControls(); CreateSectorPositionsToTexturesTable(); }
public MyConvoyMission() { ID = MyMissionID.CONVOY; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("Convoy"); // Name of mission Name = MyTextsWrapperEnum.CONVOY; Description = MyTextsWrapperEnum.CONVOY_Description; MyMwcVector3Int baseSector = new MyMwcVector3Int(-1179792, 0, -5253184); // Story sector of the script - i.e. (-2465,0,6541) RequiredMissions = new MyMissionID[] { }; Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point - must by typecasted to uint and referenced from EntityID enum RequiredActors = new MyActorEnum[] { MyActorEnum.MADELYN }; m_objectives = new List<MyObjective>(); // Creating of list of submissions }
// Liang-Barsky line clipping. Return true if the line isn't completely clipped. static bool ClipLine(ref Vector3 start, ref Vector3 end, MyMwcVector3Int min, MyMwcVector3Int max) { Vector3 dir = end - start; if (MyMwcUtils.IsZero(dir)) return IsPointInside(start, min, max); float tE = 0, tL = 1; if (IntersectionT(min.X - start.X, dir.X, ref tE, ref tL) && IntersectionT(start.X - max.X - 1, -dir.X, ref tE, ref tL) && IntersectionT(min.Y - start.Y, dir.Y, ref tE, ref tL) && IntersectionT(start.Y - max.Y - 1, -dir.Y, ref tE, ref tL) && IntersectionT(min.Z - start.Z, dir.Z, ref tE, ref tL) && IntersectionT(start.Z - max.Z - 1, -dir.Z, ref tE, ref tL)) { if (tL < 1) end = start + tL * dir; if (tE > 0) start += tE * dir; return true; } return false; }
public MyAsteroidComplexMission() { ID = MyMissionID.ASTEROID_COMPLEX; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("Asteroid complex"); // Name of mission Name = MyTextsWrapperEnum.ASTEROID_COMPLEX; Description = MyTextsWrapperEnum.ASTEROID_COMPLEX_Description; MyMwcVector3Int baseSector = new MyMwcVector3Int(2066666, 0, -7666666); // Story sector of the script - i.e. (-2465,0,6541) RequiredMissions = new MyMissionID[] { }; Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point - must by typecasted to uint and referenced from EntityID enum RequiredActors = new MyActorEnum[] { MyActorEnum.MADELYN }; m_objectives = new List<MyObjective>(); // Creating of list of submissions }
public MyGatesOfHellMission() { ID = MyMissionID.GATES_OF_HELL; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("Gates of Hell"); // Name of mission Name = MyTextsWrapperEnum.GATES_OF_HELL; Description = MyTextsWrapperEnum.GATES_OF_HELL_Description; MyMwcVector3Int baseSector = new MyMwcVector3Int(-3852627, 0, -2074149); // Story sector of the script - i.e. (-2465,0,6541) RequiredMissions = new MyMissionID[] { }; Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point - must by typecasted to uint and referenced from EntityID enum RequiredActors = new MyActorEnum[] { MyActorEnum.MADELYN }; m_objectives = new List<MyObjective>(); // Creating of list of submissions }
public MyMothershipCrashMission() { ID = MyMissionID.MOTHERSHIP_CRASH; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("Mothership Crash"); // Name of mission Name = MyTextsWrapperEnum.MOTHERSHIP_CRASH; Description = MyTextsWrapperEnum.MOTHERSHIP_CRASHL_Description; MyMwcVector3Int baseSector = new MyMwcVector3Int(-6450733, 0, -5060566); // Story sector of the script - i.e. (-2465,0,6541) RequiredMissions = new MyMissionID[] { }; Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point - must by typecasted to uint and referenced from EntityID enum RequiredActors = new MyActorEnum[] { MyActorEnum.MADELYN }; m_objectives = new List<MyObjective>(); // Creating of list of submissions }
public MyEACCapitalMission() { ID = MyMissionID.EAC_CAPITAL; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("New NYC - EAC Capital"); // Name of mission Name = MyTextsWrapperEnum.EAC_CAPITAL; Description = MyTextsWrapperEnum.EAC_CAPITAL_Description; MyMwcVector3Int baseSector = new MyMwcVector3Int(6494595, 0, -4998184); // Story sector of the script - i.e. (-2465,0,6541) RequiredMissions = new MyMissionID[] { }; Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point - must by typecasted to uint and referenced from EntityID enum RequiredActors = new MyActorEnum[] { MyActorEnum.MADELYN }; m_objectives = new List<MyObjective>(); // Creating of list of submissions }
public MyFactoryAmbushMission() { ID = MyMissionID.FACTORY_AMBUSH; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("Factory Ambush"); // Name of mission Name = MyTextsWrapperEnum.FACTORY_AMBUSH; Description = MyTextsWrapperEnum.FACTORY_AMBUSH_Description; MyMwcVector3Int baseSector = new MyMwcVector3Int(-1120106, 0, -11892620); // Story sector of the script - i.e. (-2465,0,6541) RequiredMissions = new MyMissionID[] { }; Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point - must by typecasted to uint and referenced from EntityID enum RequiredActors = new MyActorEnum[] { MyActorEnum.MADELYN }; m_objectives = new List<MyObjective>(); // Creating of list of submissions }
public MyZombieLevelMission() { ID = MyMissionID.ZOMBIE_LEVEL; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("Zombie Level"); // Name of mission Name = MyTextsWrapperEnum.ZOMBIE_LEVEL; Description = MyTextsWrapperEnum.ZOMBIE_LEVEL_Description; MyMwcVector3Int baseSector = new MyMwcVector3Int(-5758996, 0, -8078063); // Story sector of the script - i.e. (-2465,0,6541) RequiredMissions = new MyMissionID[] { }; Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point - must by typecasted to uint and referenced from EntityID enum RequiredActors = new MyActorEnum[] { MyActorEnum.MADELYN }; m_objectives = new List<MyObjective>(); // Creating of list of submissions }
public MyForgottenFacilityMission() { ID = MyMissionID.FORGOTTEN_FACILITY; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("Forgotten Facility"); // Name of mission Name = MyTextsWrapperEnum.FORGOTTEN_FACILITY; Description = MyTextsWrapperEnum.FORGOTTEN_FACILITY_Description; MyMwcVector3Int baseSector = new MyMwcVector3Int(18474168, 0, 62799965); // Story sector of the script - i.e. (-2465,0,6541) RequiredMissions = new MyMissionID[] { }; Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point - must by typecasted to uint and referenced from EntityID enum RequiredActors = new MyActorEnum[] { MyActorEnum.MADELYN }; m_objectives = new List<MyObjective>(); // Creating of list of submissions }
public MyIndustrialSectorMission() { ID = MyMissionID.INDUSTRIAL_SECTOR; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("Industrial Sector"); // Name of mission Name = MyTextsWrapperEnum.INDUSTRIAL_SECTOR; Description = MyTextsWrapperEnum.INDUSTRIAL_SECTOR_Description; MyMwcVector3Int baseSector = new MyMwcVector3Int(-7944309, 0, -14218145); // Story sector of the script - i.e. (-2465,0,6541) RequiredMissions = new MyMissionID[] { }; Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point - must by typecasted to uint and referenced from EntityID enum RequiredActors = new MyActorEnum[] { MyActorEnum.MADELYN }; m_objectives = new List<MyObjective>(); // Creating of list of submissions }
public IntergalacticHighway() { ID = MyMissionID.INTERGALACTIC_HIGHWAY; /* ID must be added to MyMissions.cs */ DebugName = new StringBuilder("Intergalatic highway"); // Name of mission Name = MyTextsWrapperEnum.INTERGALACTIC_HIGHWAY; Description = MyTextsWrapperEnum.INTERGALACTIC_HIGHWAY_Description; MyMwcVector3Int baseSector = new MyMwcVector3Int(4546561, 0, -6059286); // Story sector of the script - i.e. (-2465,0,6541) RequiredMissions = new MyMissionID[] { }; Location = new MyMissionLocation(baseSector, (uint)EntityID.StartLocation); // Starting dummy point - must by typecasted to uint and referenced from EntityID enum RequiredActors = new MyActorEnum[] { MyActorEnum.MADELYN }; m_objectives = new List<MyObjective>(); // Creating of list of submissions }