Exemplo n.º 1
0
        /// <summary>Unforcefully toggles a door state if found at the position or near it.</summary>
        /// <param name="locationName">The location to toggle the door in.</param>
        /// <param name="mouseTile">The position to look for a door at.</param>
        public void MouseToggleDoor(string locationName, Point mouseTile)
        {
            if (!this.doors.TryGetValue(locationName, out IDictionary <Point, Door> doorsInLocation))
            {
                return;
            }

            if (DoorManager.TryGetDoorFromMouse(mouseTile, doorsInLocation, out Door door))
            {
                foreach (Door toggleDoor in this.TryToggleDoor(door, doorsInLocation, false))
                {
                    this.onToggledDoor(toggleDoor);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>Gets the mouse cursor to display if a door is found.</summary>
        /// <param name="locationName">The location to check in.</param>
        /// <param name="playerTile">The position the player is at.</param>
        /// <param name="mouseTile">The position of the mouse.</param>
        /// <param name="cursor">The resulting cursor index, if any.</param>
        /// <param name="transparency">The resulting transparency value, if any.</param>
        /// <returns>Whether a door was found.</returns>
        public bool TryGetMouseCursorForDoor(string locationName, Point playerTile, Point mouseTile, out int cursor, out float transparency)
        {
            cursor       = 0;
            transparency = 0;

            if (!this.doors.TryGetValue(locationName, out IDictionary <Point, Door> doorsInLocation) || !DoorManager.TryGetDoorFromMouse(mouseTile, doorsInLocation, out Door _))
            {
                return(false);
            }

            cursor       = 2;
            transparency = Utils.GetTaxiCabDistance(playerTile, mouseTile) <= this.config.DoorToggleRadius ? 1f : 0.5f;
            return(true);
        }