public static void SetHighlightForProjection(string projectorName, bool enabled = true, int thickness = 5, int pulseTimeInFrames = 120, Color color = default(Color), long playerId = -1) { var entity = GetEntityByName(projectorName); if (entity != null && entity is MyProjectorBase) { var projector = (MyProjectorBase)entity; if (color == default(Color)) color = Color.Blue; if (color == default(Color)) color = Color.Blue; if (playerId == -1) playerId = MySession.Static.LocalPlayerId; // highlight for single entity var highlightData = new MyHighlightSystem.MyHighlightData { OutlineColor = color, PulseTimeInFrames = (ulong)pulseTimeInFrames, Thickness = enabled ? thickness : -1, PlayerId = playerId, IgnoreUseObjectData = true }; foreach (var cubeGrid in projector.Clipboard.PreviewGrids) { foreach (var block in cubeGrid.GetFatBlocks()) { highlightData.EntityId = block.EntityId; SetHighlight(highlightData, highlightData.PlayerId); } } } }
private static void DrawSelectedObjectHighlightOutline(MyHudSelectedObject selection) { Color color = MySector.EnvironmentDefinition.ContourHighlightColor; float thickness = MySector.EnvironmentDefinition.ContourHighlightThickness; ulong pulseTimeInFrames = (ulong)Math.Round(MySector.EnvironmentDefinition.HighlightPulseInSeconds * MyEngineConstants.UPDATE_STEPS_PER_SECOND); var data = new MyHighlightSystem.MyHighlightData( entityId: selection.InteractiveObject.Owner.EntityId, outlineColor: color, thickness: (int)thickness, pulseTimeInFrames: pulseTimeInFrames ); MySession.Static.GetComponent<MyHighlightSystem>().RequestHighlightChange(data); }
public static void SetHighlight(string entityName, bool enabled = true, int thickness = 1, int pulseTimeInFrames = 120, Color color = default(Color), long playerId = -1) { MyEntity entity; if (MyEntities.TryGetEntityByName(entityName, out entity)) { if (color == default(Color)) { color = DEFAULT_HIGHLIGHT_COLOR; } if(playerId == -1) playerId = GetLocalPlayerId(); // highlight for single entity var highlightData = new MyHighlightSystem.MyHighlightData { EntityId = entity.EntityId, OutlineColor = color, PulseTimeInFrames = (ulong)pulseTimeInFrames, Thickness = enabled ? thickness : -1, PlayerId = playerId, IgnoreUseObjectData = true }; SetHighlight(highlightData, playerId); } }
private static void RemoveObjectHighlightInternal(ref MyHudSelectedObjectStatus status, bool reset) { switch (status.Style) { case MyHudObjectHighlightStyle.OutlineHighlight: { var data = new MyHighlightSystem.MyHighlightData(status.Instance.Owner.EntityId); //MyRenderProxy.UpdateModelHighlight((uint)status.Instance.RenderObjectID, null, status.SubpartIndices, null, -1, 0, status.Instance.InstanceID); MySession.Static.GetComponent<MyHighlightSystem>().RequestHighlightChange(data); break; } } if (reset) status.Reset(); }