void Start() { gameController = GameController.instance; boardSelection = GetComponent <BoardSelection>(); cursorInput = GetComponent <CursorInput>(); pathInput = GetComponent <PathInput>(); }
private void CheckCursorInput() { if (previousCursorPosition != cameraController.GetMousePosition()) { previousCursorPosition = cameraController.GetMousePosition(); CursorInput.Invoke(previousCursorPosition); } }
private void Awake() { instance = this; roundController = GetComponent <RoundController>(); actionController = GetComponent <ActionController>(); cursor = GetComponent <CursorInput>(); for (int i = 0; i < 4; i++) { players.Add(new Player()); } }
// Use this for initialization void Awake() { reachedMaxStats = false; // selectedSlot = characterSelect.GetSelectedCharacter(); handler = GameObject.Find("StatusBoxHandler"); characterMenuPrefabHandler = handler.GetComponent <CharacterMenuPrefabHandler>(); animator = gameObject.GetComponent <Animator>(); cursorInput = gameObject.GetComponent <CursorInput>(); cm = gameObject.GetComponent <CursorMover>(); animator.enabled = false; statSelected = false; statCounter = int.Parse(statsLeft.GetComponent <Text>().text); totalStatsAllowed = (ushort)(statCounter + 5); }
void Awake() { // OneShotRevolution // com.Pointcube.OneShotRevolution /*#if (UNITY_IPHONE || UNITY_ANDROID) && !UNITY_EDITOR m_input = TouchInput.GetInstance(); #else m_input = MouseInput.GetInstance(); #endif*/ //test windows 8 //m_input = WinTouchInput.GetInstance(); m_input = WinTouchInput.GetInstance(); m_click = true; m_dclick = false; m_drags = false; m_rotate = false; m_zoom = false; m_scrollH = false; m_scrollHV = false; m_zoomd = false; m_zoomr = false; m_zoomrds = false; m_zoomrdsdragV = false; m_texScale = 1f; m_texRotate = 0f; m_leftRect = new Rect(50f, 20f, 200f, 260f); m_t1Rect = new Rect(50f, 0f, 200f, 20f); m_t2Rect = new Rect(50f, 20f, 200f, 20f); m_t3Rect = new Rect(50f, 40f, 200f, 20f); m_t4Rect = new Rect(50f, 60f, 200f, 20f); m_t5Rect = new Rect(50f, 80f, 200f, 20f); m_t6Rect = new Rect(50f, 100f, 200f, 20f); m_t7Rect = new Rect(50f, 120f, 200f, 20f); m_t8Rect = new Rect(50f, 140f, 200f, 20f); m_t9Rect = new Rect(50f, 160f, 200f, 20f); m_t10Rect = new Rect(50f, 180f, 200f, 20f); m_t11Rect = new Rect(50f, 200f, 200f, 20f); m_t12Rect = new Rect(50f, 220f, 200f, 20f); m_t13Rect = new Rect(50f, 240f, 200f, 20f); m_l1Rect = new Rect(Screen.width - (150f), 20f, 100f, 20f); m_texRect = new Rect((Screen.width-100)/2, (Screen.height-100)/2, 100, 100); m_uiRects = new Rect[2]; m_uiRects[0] = m_leftRect; m_uiRects[1] = m_l1Rect; }
private AnalogEventHandler CursorEventHandler(CursorInput input, Mouse mouse) { return((stateX, stateY, previousStateX, previousStateY) => { var speedX = mouse.GetCursorSpeed(stateX, Gamepad.MinAnalogLimit, Gamepad.MinAnalogDeadzone, Gamepad.MaxAnalogLimit, Gamepad.MaxAnalogDeadzone); var speedY = mouse.GetCursorSpeed(stateY, Gamepad.MinAnalogLimit, Gamepad.MinAnalogDeadzone, Gamepad.MaxAnalogLimit, Gamepad.MaxAnalogDeadzone); speedX = input.InvertX ? -speedX : speedX; speedY = input.InvertY ? speedY : -speedY; if (speedX != 0 || speedY != 0) { mouse.Move(speedX, speedY); } }); }
// Start is called before the first frame update void Start() { if (!hasAuthority) { Destroy(gameObject.GetComponent <PlayerInput>()); } else { playerInput = gameObject.GetComponent <PlayerInput>(); print("PlayerInput: " + playerInput); playerInput.neverAutoSwitchControlSchemes = true; clientHandler = GameObject.FindObjectOfType <NeonHeightsDataHandler>().GetLocalClient(); if (keyboardControlled) { device = Keyboard.current; } else { device = Gamepad.current; } if (initialized) { clientHandler.AddCursor(this); } } cursorInput = new CursorInput(); canvas = GameObject.FindObjectOfType <Canvas>(); canvasRectTransform = canvas.GetComponent <RectTransform>(); transform.SetParent(canvas.transform); transform.position = new Vector2(canvas.pixelRect.width / 2, canvas.pixelRect.height / 2); gameObject.transform.localScale = new Vector3(1, 1, 1); playerNumberText.text = "P" + (playerIndex + 1); playerNumberTextShadow.text = "P" + (playerIndex + 1); cursorImage.color = cursorColors[playerIndex]; usernameText.text = "gamepad " + gamepadDeviceId; }
private void SetPropertyValueAnalogInput(String propertyValue, Object configuration, PropertyInfo configurationProperty) { if (propertyValue == "Cursor") { var cursor = new CursorInput(); configurationProperty.SetValue(configuration, cursor); } else if (propertyValue == "Scroll") { var scroll = new ScrollInput(); configurationProperty.SetValue(configuration, scroll); } else if (propertyValue == "WASD") { var wasdKeys = new DirectionalKeysInput(KeyboardKeyCode.W, KeyboardKeyCode.S, KeyboardKeyCode.A, KeyboardKeyCode.D); configurationProperty.SetValue(configuration, wasdKeys); } else if (propertyValue == "ArrowKeys") { var arrowKeys = new DirectionalKeysInput(KeyboardKeyCode.UpArrow, KeyboardKeyCode.DownArrow, KeyboardKeyCode.LeftArrow, KeyboardKeyCode.RightArrow); configurationProperty.SetValue(configuration, arrowKeys); } }
/// <summary> /// Gets the current mouse cursor's position /// </summary> /// <returns></returns> public static CursorCoordinates GetMouseCursorPos() { return(CursorInput.GetCursorPos()); }
/// <summary> /// Sets the cursor's current position /// </summary> /// <param name="coordinates">The coordinates to set the cursor's position to</param> public static void SetMouseCursorPos(CursorCoordinates coordinates) { CursorInput.SetCursorPos(coordinates.X, coordinates.Y); }
/// <summary> /// Sets the cursor's current position /// </summary> /// <param name="x">X coordinate (0 is top left)</param> /// <param name="y">Y coordinate (0 is top left)</param> public static void SetMouseCursorPos(int x, int y) { CursorInput.SetCursorPos(x, y); }