protected override void Update() { base.Update(); m_MovementInputValue = (m_MovementInputValue == 0) ? UNInput.GetAxis(m_PlayerNumber, _networkVerticalAxis) : m_MovementInputValue; m_TurnInputValue = (m_TurnInputValue == 0) ? UNInput.GetAxis(m_PlayerNumber, _networkHorizontalAxis) : m_TurnInputValue; if (Input.GetButtonDown(_placeAmpButton) || UNInput.GetButtonDown(m_PlayerNumber, "Action")) { Debug.LogFormat("Player {0} placed an Amp!", m_PlayerNumber); PlaceAmp(); } if (Input.GetKeyDown(KeyCode.Backspace) || UNInput.GetButtonDown(m_PlayerNumber, "Start")) { for (int i = _amps.Count - 1; i >= 0; i--) { var a = _amps[i]; DestroyAmp(a); } _amps.Clear(); } var enemyAmps = GameController.Instance.EnemyAmps(_player); AmpController target = null; var minDist = float.MaxValue; foreach (var a in enemyAmps) { Vector3 point; var dist = a.PowLine.SqrDistanceFromPoint(_transform.position, out point); if (dist < MaxCutSqrDistance && dist < minDist) { minDist = dist; Debug.DrawLine(point, point + Vector3.up * 100f, Color.yellow); target = a; } } if (target != null && Input.GetButton(_cutButton) || UNInput.GetButton(m_PlayerNumber, "Back")) { target.Owner.DestroyAmp(target); } }
void Buttons(int id, Gamepad game) { //Back if (UNInput.GetButton(id, ButtonCode.Back)) { game._select.color = game.select; } else { game._select.color = Color.white; } //Start if (UNInput.GetButton(id, ButtonCode.Start)) { game._start.color = game.start; } else { game._start.color = Color.white; } //A if (UNInput.GetButton(id, ButtonCode.A)) { game._ex.color = game.ex; } else { game._ex.color = Color.white; } //B if (UNInput.GetButton(id, ButtonCode.B)) { game._circle.color = game.circle; } else { game._circle.color = Color.white; } //X if (UNInput.GetButton(id, ButtonCode.X)) { game._quad.color = game.quad; } else { game._quad.color = Color.white; } //Y if (UNInput.GetButton(id, ButtonCode.Y)) { game._triangle.color = game.triangle; } else { game._triangle.color = Color.white; } //Left Stick Click if (UNInput.GetButton(id, ButtonCode.LS)) { game._l3.color = game.l3; } else { game._l3.color = Color.white; } //Right Stick Click if (UNInput.GetButton(id, ButtonCode.RS)) { game._r3.color = game.r3; } else { game._r3.color = Color.white; } //Left Bumper if (UNInput.GetButton(id, ButtonCode.LB)) { game._l1.color = game.l1; } else { game._l1.color = Color.white; } //Right Bumper if (UNInput.GetButton(id, ButtonCode.RB)) { game._r1.color = game.r1; } else { game._r1.color = Color.white; } //DPad Right if (UNInput.GetButton(id, ButtonCode.DPadRight)) { game._dpadRight.color = game.dpadRight; } else { game._dpadRight.color = Color.white; } //DPad Left if (UNInput.GetButton(id, ButtonCode.DPadLeft)) { game._dpadLeft.color = game.dpadLeft; } else { game._dpadLeft.color = Color.white; } //DPad Up if (UNInput.GetButton(id, ButtonCode.DPadUp)) { game._dpadUp.color = game.dpadUp; } else { game._dpadUp.color = Color.white; } //DPad Down if (UNInput.GetButton(id, ButtonCode.DPadDown)) { game._dpadDown.color = game.dpadDown; } else { game._dpadDown.color = Color.white; } }