public void GoToRoom(GameObject destination) { // Set and activate the destination room roomTarget = destination; roomTarget.SetActive(true); player.transform.position = roomTarget.transform.position; RoomData targetRoomData = roomTarget.GetComponent <RoomData>(); if (targetRoomData.playerCanTurn) { player.GetComponent <PlayerMovement>().turnAngle = targetRoomData.allowedTurnAngle; triggerTurnLeft.SetActive(true); triggerTurnRight.SetActive(true); } else { player.GetComponent <PlayerMovement>().canTurn = false; triggerTurnLeft.SetActive(false); triggerTurnRight.SetActive(false); } // Deactivate the previous room the player was in and set the destination as the new current room if (roomCurrent != null) { roomCurrent.SetActive(false); roomCurrent = roomTarget; } roomTarget = null; // Return cursor to default image after clicking door Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto); print("Entered " + roomCurrent.name); }
protected virtual void UpdateCursor(CursorDefinition cursor) { lock (this) { _cursor?.Dispose(); _cursor = cursor.Create().SubscribeWithState(cursor.Hotspot, (image, pos) => { //TODO Can't use CursorMode.Auto, because it doesn't work on Linux yet. //(See: https://forum.unity3d.com/threads/cursor-setcursor-does-not-work-in-editor.476617/) UECursor.SetCursor(image, pos, CursorMode.ForceSoftware); }); } }
private void Start() { InvokeRepeating("RefreshScreenSize", 0f, 2f); if (myMouseConfinementMode == MouseConfinementMode.ConfineToScreen) { Cursor.lockState = CursorLockMode.Confined; } else if (myMouseConfinementMode == MouseConfinementMode.NotConfined) { Cursor.lockState = CursorLockMode.None; } if (forceSoftwareCursor) { var cursorHotspot = new Vector2(myCursorTexture.width / 2, myCursorTexture.height / 2); Cursor.SetCursor(myCursorTexture, cursorHotspot, CursorMode.ForceSoftware); } }
public void SetCursor(Texture2D texture) { Cursor.SetCursor(texture, Vector2.zero, CursorMode.Auto); }