// gets offset for camera and starts camera in static view void Start() { initPos = transform.position; // stores static camera position // camera axis button created CameraButton = new AxisButton(CameraAxis, 0.5f); }
/// <summary> /// Create a new Axis using AxisButtons. /// </summary> /// <param name="up">The AxisButton for Up.</param> /// <param name="right">The AxisButton for Right.</param> /// <param name="down">The AxisButton for Down.</param> /// <param name="left">The AxisButton for Left.</param> /// <param name="joystick">The joystick id to use.</param> public Axis(AxisButton up, AxisButton right, AxisButton down, AxisButton left, params int[] joystick) : this() { AddButton(up, Direction.Up, joystick); AddButton(right, Direction.Right, joystick); AddButton(down, Direction.Down, joystick); AddButton(left, Direction.Left, joystick); }
/// <summary> /// Add a joystick axis button. /// </summary> /// <param name="button">The joystick axis button.</param> /// <param name="direction">The direction this axis button should effect.</param> /// <param name="joystick">The joystick id.</param> /// <returns>The Axis.</returns> public Axis AddButton(AxisButton button, Direction direction, params int[] joystick) { foreach (var j in joystick) { AddButton((int)button, direction, j); } return(this); }
void Start() { // Set axis strings based on the user's controller selection from the menu screen if (GameControl.ControllerMode) { FireAxis = FireAxis_Controller; ClimbDescendAxis = ClimbDescendAxis_Controller; } else { FireAxis = FireAxis_Mouse; ClimbDescendAxis = ClimbDescendAxis_Mouse; } // set up the fire button axis FireButton = new AxisButton(FireAxis); }
/// <summary> /// Creates the rebind buttons /// </summary> private void CreateAxisButtons() { foreach (AxisBase a in Axes) { GameObject p = Instantiate(AxisRebindButton); p.transform.SetParent(AxesGrid, false); AxisButton pB = p.GetComponent <AxisButton>(); pB.Init(a.AxisName, a.PkeyDescription, a.Pkey.ToString()); a.PUIButton = pB; if (a.Nkey != KeyCode.None) { GameObject n = Instantiate(AxisRebindButton); n.transform.SetParent(AxesGrid, false); AxisButton nB = n.GetComponent <AxisButton>(); nB.Init(a.AxisName, a.NkeyDescription, a.Nkey.ToString(), true); a.NUIButton = nB; } } }
private void CollisionEnded(object sender, PointerEventArgs e) { if (e.target.GetComponent <Point>() != null) { inPointCollision = false; } else if (e.target.GetComponent <ScaleButton>() != null) { scaleButton = null; } else if (e.target.GetComponent <AxisButton>() != null) { axisButton = null; } else if (e.target.GetComponent <InvertAxisButton>() != null) { invertAxisButton = null; } }
// Use this for initialization void Start() { // Set based on player's control selection on the menu screen ControllerMode = GameControl.ControllerMode; // Set all the axis strings to use _P2 versions, enabling controller use if (ControllerMode) { AimHorizontalAxis = AimHorizontalAxis_Controller; AimVerticalAxis = AimVerticalAxis_Controller; StrafeAxis = StrafeAxis_Controller; JumpAxis = JumpAxis_Controller; } else { AimHorizontalAxis = AimHorizontalAxis_Mouse; AimVerticalAxis = AimVerticalAxis_Mouse; StrafeAxis = StrafeAxis_Mouse; JumpAxis = JumpAxis_Mouse; } PlayerRigidBody = GetComponent <Rigidbody2D>(); // default to being on the ground onGround = true; // set up the jump button axis JumpButton = new AxisButton(JumpAxis, 0.5f); // and the fire button axis // FireButton = new AxisButton(FireAxis); // Initialize the player position playerPos = transform.position; // Initialize the joystick position Vector3 joystickPosition = new Vector3(0, 0, 0); }
private void Collision(object sender, PointerEventArgs e) { if (e.target.GetComponent <Point>() != null) { inPointCollision = true; selectedPoint = e.target.GetComponent <Point>(); } else if (e.target.GetComponent <ScaleButton>() != null) { scaleButton = e.target.GetComponent <ScaleButton>(); } else if (e.target.GetComponent <AxisButton>() != null) { axisButton = e.target.GetComponent <AxisButton>(); } else if (e.target.GetComponent <InvertAxisButton>() != null) { invertAxisButton = e.target.GetComponent <InvertAxisButton>(); } }
/// <summary> /// Add a joystick AxisButton to the Button. /// </summary> /// <param name="button">The AxisButton to add.</param> /// <param name="joystick">The joystick id of the button to add.</param> /// <returns>The Button.</returns> public Button AddAxisButton(AxisButton button, int joystick = 0) { AddJoyButton((int)button, joystick); return(this); }
/// <summary> /// Add a joystick AxisButton to the Button. /// </summary> /// <param name="button">The AxisButton to add.</param> /// <param name="joystick">The joystick id of the button to add.</param> /// <returns>The Button.</returns> public Button AddAxisButton(AxisButton button, int joystick = 0) { AddJoyButton((int)button, joystick); return this; }
public static bool GetButton( AxisButton button, Index controlIndex ) { var pair = m_axisButton[ (int)controlIndex ]; return pair[ button ].m_trigger; }
/// <summary> /// Check if the joystick button is up. /// </summary> /// <param name="button">The AxisButton to check.</param> /// <param name="joystick">The joystick to check.</param> /// <returns>True if the AxisButton is up.</returns> public bool ButtonUp(AxisButton button, int joystick = 0) { return(ButtonUp((int)button, joystick)); }
/// <summary> /// Check if the joystick AxisButton is released. /// </summary> /// <param name="button">The AxisButton to check.</param> /// <param name="joystick">The joystick to check.</param> /// <returns>True if the AxisButton is released.</returns> public bool ButtonReleased(AxisButton button, int joystick = 0) { return ButtonReleased((int)button, joystick); }
/// <summary> /// Add a joystick axis button. /// </summary> /// <param name="button">The joystick axis button.</param> /// <param name="direction">The direction this axis button should effect.</param> /// <param name="joystick">The joystick id.</param> /// <returns>The Axis.</returns> public Axis AddButton(AxisButton button, Direction direction, params int[] joystick) { foreach (var j in joystick) { AddButton((int)button, direction, j); } return this; }
public static void BindButtonInput(GameButtonID id, string axisName) { buttons[id] = new AxisButton(axisName); PlayerPrefs.SetString(savePref + id, axisName); }
/// <summary> /// Check if the joystick AxisButton is released. /// </summary> /// <param name="button">The AxisButton to check.</param> /// <param name="joystick">The joystick to check.</param> /// <returns>True if the AxisButton is released.</returns> public bool ButtonReleased(AxisButton button, int joystick = 0) { return(ButtonReleased((int)button, joystick)); }
/// <summary> /// Check if the joystick button is up. /// </summary> /// <param name="button">The AxisButton to check.</param> /// <param name="joystick">The joystick to check.</param> /// <returns>True if the AxisButton is up.</returns> public bool ButtonUp(AxisButton button, int joystick = 0) { return ButtonUp((int)button, joystick); }
/// <summary> /// Add a joystick axis button. /// </summary> /// <param name="button">The joystick axis button.</param> /// <param name="direction">The direction this axis button should effect.</param> /// <param name="joystick">The joystick id.</param> /// <returns>The Axis.</returns> public Axis AddButton(AxisButton button, Direction direction, int joystick = 0) { AddButton((int)button, direction, joystick); return this; }