public RoomEditorEntity( IKernel kernel, IMeshCollider meshCollider, I3DRenderUtilities threeRenderUtilities, IAssetManagerProvider assetManagerProvider, Room room) { this.m_Kernel = kernel; this.m_MeshCollider = meshCollider; this.m_3DRenderUtilities = threeRenderUtilities; this.m_Room = room; this.m_ShipTextureAsset = assetManagerProvider.GetAssetManager().Get<TextureAsset>("ship"); this.m_RoomEditorMode = RoomEditorMode.Hovering; }
public void ReleaseCurrentSelection() { this.m_RoomEditorMode = RoomEditorMode.Hovering; this.m_SelectedRoomObject = null; this.m_SelectedRoomObjectFace = -1; this.m_SelectedRoomObjectVerticalEdge = -1; this.m_SelectedMouseStartPosition = Vector3.Zero; this.m_SelectedRoomObjectDistanceToPlayer = -1; this.m_SelectedMouseStartPositionRelative = Vector3.Zero; }
public void SelectCurrentHover(IGameContext gameContext, bool secondaryAlt) { var world = (RoomEditorWorld)gameContext.World; if (world.ActiveRoomTool is ExitRoomTool) { gameContext.SwitchWorld(world.PreviousWorld); return; } if (this.m_HoveredRoomObject == null && !(world.ActiveRoomTool is NewRoomTool)) { return; } if (this.m_HoveredRoomObject != null && this.m_HoveredRoomObject.SizeLocked && world.ActiveRoomTool is SizeRoomTool) { // Can't select this object. return; } if (world.ActiveRoomTool is WireNewRoomTool) { if (this.m_WireSourceRoomObject == null) { if (this.m_HoveredRoomObject is IConnectable) { this.m_WireSourceRoomObject = this.m_HoveredRoomObject; } return; } if (this.m_HoveredRoomObject != this.m_WireSourceRoomObject) { if (this.m_HoveredRoomObject is IConnectable) { this.HandleNewWire(this.m_WireSourceRoomObject, this.m_HoveredRoomObject); this.m_WireSourceRoomObject = null; } return; } } this.m_IsAlternateMode = this.UseAlternative; this.m_IsSecondaryAlternateMode = secondaryAlt; this.m_RoomEditorMode = RoomEditorMode.Selected; this.m_SelectedRoomObject = this.m_HoveredRoomObject; this.m_SelectedRoomObjectFace = this.m_HoveredRoomObjectFace; this.m_SelectedRoomObjectVerticalEdge = this.m_HoveredRoomObjectVerticalEdge; this.m_SelectedMouseStartPosition = this.m_HoveredMouseStartPosition; this.m_SelectedRoomObjectDistanceToPlayer = -1; if (this.m_HoveredRoomObject != null && this.m_SelectedRoomObject != null) { this.m_SelectedMouseStartPositionRelative = this.m_HoveredMouseStartPosition - new Vector3( this.m_HoveredRoomObject.X, this.m_HoveredRoomObject.Y, this.m_HoveredRoomObject.Z); switch (this.m_SelectedRoomObjectFace) { case 0: this.m_SelectedRoomObjectStartValue1 = this.m_SelectedRoomObject.X; this.m_SelectedRoomObjectStartValue2 = this.m_SelectedRoomObject.Width; break; case 1: this.m_SelectedRoomObjectStartValue1 = this.m_SelectedRoomObject.Width; break; case 2: this.m_SelectedRoomObjectStartValue1 = this.m_SelectedRoomObject.Z; this.m_SelectedRoomObjectStartValue2 = this.m_SelectedRoomObject.Depth; break; case 3: this.m_SelectedRoomObjectStartValue1 = this.m_SelectedRoomObject.Depth; break; case 4: this.m_SelectedRoomObjectStartValue1 = this.m_SelectedRoomObject.Y; this.m_SelectedRoomObjectStartValue2 = this.m_SelectedRoomObject.Height; break; case 5: this.m_SelectedRoomObjectStartValue1 = this.m_SelectedRoomObject.Height; break; } } }