public override void Draw() { Recalculate(); var x0 = HoveredChestPosition.X; var y0 = HoveredChestPosition.Y + TileSize; Draw(x0, y0); var colorCell = GetCell(MouseX - x0, MouseY - y0) as ColorCell; if (colorCell != null) { var newColor = colorCell.Color; if (HoveredChest.tint != newColor) { HoveredChest.tint = newColor; var position = Game1.currentLocation.Objects.First(kv => kv.Value == HoveredChest).Key; Log.Info($"Set chest (x={position.X}, y={position.Y}) color=#{newColor.R:X2}{newColor.G:X2}{newColor.B:X2}"); } } if (LastBounds.Contains(MouseX, MouseY)) { RedrawCursor(); } }
IEnumerator UpdateControllerHoverNotif() { bool leftIsIn = false; bool rightIsIn = false; while (!creator.isCreating) { // Trigger a haptic pulse when the hand gets in or out of the selection box. if (LastBounds.Contains(PlayerToolsManager.instance.LeftHand.transform.position) != leftIsIn) { leftIsIn = !leftIsIn; PlayerToolsManager.instance.LeftHand.TriggerHapticPulse(500); } if (LastBounds.Contains(PlayerToolsManager.instance.RightHand.transform.position) != rightIsIn) { rightIsIn = !rightIsIn; PlayerToolsManager.instance.RightHand.TriggerHapticPulse(500); } yield return(null); } }
void OnCreationStarting() { Destroy(creator.newGameObject); if (LastBounds != null && LastBounds.Contains(HandPosition)) { // Cut if the player clicks inside of the previous created GO. if (highlightSelection && meshToEdit) { meshToEdit.colors = new Color[0]; } cutter.TryCutMesh(LastBounds); creator.CancelCreation(); } else { if (highlightSelection) { StartCoroutine(UpdateDisplayedSelection()); } } }
public override bool NeedDraw() { if (!IsAltPressed()) { return(false); } if (HoveredChest != null && ToolTipManager.Instance.CurrentToolTips.Contains(this) && LastBounds.Contains(MouseX, MouseY)) { return(true); } HoveredChest = GetHoveredChest(); HoveredChestPosition = new Point(NormalizedMouseX / TileSize * TileSize - Game1.viewport.X, NormalizedMouseY / TileSize * TileSize - Game1.viewport.Y); return(HoveredChest != null); }