// Start is called before the first frame update void Start() { state = PlayerState.Neutral; rewiredPlayer = ReInput.players.GetPlayer(PlayerNumber); RacketMinScale = leftRacket.transform.localScale; swinging = false; }
/* Thoughts about method for choosing turret placement: * Create a new script to place on buttons. It holds a cost and a prefab. * Have a function that takes that script as an argument. * Put that function in the button OnClick() and drag the button gameobject itself in. * The function gets the cost and prefab that way--from the script given as an argument. * void SelectTurretToBuild (TurretInfo turretInfo) { * cost = turretInfo.cost; * turret = turretInfo.turretPrefab; * } * * public class TurretInfo : MonoBehaviour { * public int cost; * public GameObject turretPrefab; * } */ //Please use GameManager._instance.turretManager to reference this script void Start() { player = ReInput.players.GetPlayer(0); instance = this; turretBtnPressed = false; canPlace = false; }
void Awake() { // Get the Rewired Player object for this player and keep it for the duration of the character's lifetime player = ReInput.players.GetPlayer(playerId); rigidbody = GetComponent <Rigidbody2D>(); animator = GetComponent <Animator>(); }
void SetPlayerNum() { if (tag == "Player1") { playerNum = 0; infoTeam = 1; } else if (tag == "Player2") { playerNum = 1; infoTeam = 2; } else if (tag == "Player3") { playerNum = 2; infoTeam = 1; } else if (tag == "Player4") { playerNum = 3; infoTeam = 2; } player = ReInput.players.GetPlayer(playerNum); }
private void AssignJoysticksToPlayers() { IList <Joystick> joysticks = ReInput.controllers.Joysticks; //Get connected joysticks for (int i = 0; i < joysticks.Count; i++) { Joystick joystick = joysticks[i]; if (ReInput.controllers.IsControllerAssigned(joystick.type, joystick.id)) { continue; //Next iteration if joystick is already assigned to a Player } if (joystick.GetAnyButtonDown()) { Rewired.Player player = FindPlayerWithoutJoystick(); if (player == null) { return; // return on no free joysticks } //rewiredPlayer.controllers.maps.SetMapsEnabled(false, "Assignment"); player.controllers.AddController(joystick, false); } } // If all players have joysticks, enable joystick auto-assignment if (DoAllPlayersHaveJoysticks()) { ReInput.configuration.autoAssignJoysticks = true; } }
// Start is called before the first frame update void Start() { Debug.Log(playerIndex); currentPauseState = PauseState.selectionWindow; menuOrder = 1; if (playerIndex == 0) { playerNumber.gameObject.GetComponent <RectTransform>().anchoredPosition = new Vector2(-180, 259); playerNumber.sprite = player[0]; playerSelection.sprite = PlayerSelectionSprite[0]; } if (playerIndex == 1) { playerNumber.gameObject.GetComponent <RectTransform>().anchoredPosition = new Vector2(180, 259); playerNumber.sprite = player[1]; playerSelection.sprite = PlayerSelectionSprite[1]; } //set animator anim = GetComponent <Animator>(); //set controller rewiredPlayer = ReInput.players.GetPlayer(playerIndex); }
void Awake() { health = maxHealth; facing = true; player = ReInput.players.GetPlayer(0); firstClick = 0; updateCounter = UnityEngine.Random.Range(0, updateRate); buttonText = GetComponentsInChildren <Button>(); if (buttonText.Length > 0) { buttonText [0].GetComponentInChildren <Text> ().text += "\n" + upgradeOneCost.ToString(); } if (buttonText.Length > 1) { buttonText [1].GetComponentInChildren <Text> ().text += "\n" + upgradeTwoCost.ToString(); } mask = LayerMask.GetMask(new string [] { "Creatures" }); if (turretCanvas != null) { turretCanvas.enabled = false; } Initialize(); //groundIndicator.material = new Material(cookieMat); groundIndicator.orthographicSize = maxrange; groundIndicator.enabled = false; turnSpeed = 10f; CalculatePower(); }
// Start is called before the first frame update void Start() { inputManager = ReInput.players.GetPlayer(0); CanOrder = true; rightWaitingOrders = new Queue <OrderItem>(); leftWaitingOrders = new Queue <OrderItem>(); }
void TakeInput(out Vector3 stickInput) { stickInput = Vector3.zero; if (m_mainPlayer) { Rewired.Player player = ReInput.players.GetPlayer(m_mainPlayer.m_nplayerIndex - 1); stickInput = new Vector3(player.GetAxisRaw("Look Vertical"), -player.GetAxisRaw("Look Horizontal"), 0); if (player.GetButtonDown("Change Camera")) { switch (m_currentViewStyle) { case viewStyles_e.bonnet: SwitchViewStyle(viewStyles_e.driving); break; case viewStyles_e.driving: SwitchViewStyle(viewStyles_e.thirdPerson); break; case viewStyles_e.thirdPerson: SwitchViewStyle(viewStyles_e.bonnet); break; } } } }
float RoundTimer; //Round timer void Start() { //singleton if (Manager == null) { Manager = this; } else { Destroy(gameObject); } //GameManager Don't destroy from scene to scene DontDestroyOnLoad(this); //Inits the timer to to max time ResetRoundTimer(); gameObject.name = "GameManager"; //Rewired Player Setup Player1RW = ReInput.players.GetPlayer(0); Player2RW = ReInput.players.GetPlayer(1); }
public void Initialize(PlayerData playerData) { _rigidbody = this.GetComponent <Rigidbody>(); _grabPoint.OnTriggerEnterAsObservable() .Select(x => x.GetComponent <IPickableObject>()) .Subscribe(x => _currentTargetPickableObject = x) .AddTo(this); _grabPoint.OnTriggerExitAsObservable() .Select(x => x.GetComponent <IPickableObject>()) .Where(x => _currentTargetPickableObject == x) .Subscribe(x => _currentTargetPickableObject = null) .AddTo(this); _attackAreaTrigger.OnTriggerEnterAsObservable() .Do(x => Debug.Log(x.name)) .Select(x => x.GetComponent <IDestructibleObject>()) .Where(x => x != null) .Subscribe(x => _targetDestructibleObjects.Add(x)) .AddTo(this); _attackAreaTrigger.OnTriggerExitAsObservable() .Select(x => x.GetComponent <IDestructibleObject>()) .Where(x => x != null && _targetDestructibleObjects.Contains(x)) .Subscribe(x => _targetDestructibleObjects.Remove(x)) .AddTo(this); _playerData = playerData; _player = Rewired.ReInput.players.GetPlayer(playerData.ID); }
void Start() { rb = GetComponent<Rigidbody2D>(); contactDetector = transform.GetComponentInChildren<ContactDetector>(); player = ReInput.players.GetPlayer(playerId); playerSkin.sprite = playerSkins[playerId]; lives = 3; }
void Start() { _player = ReInput.players.GetPlayer(0); ResetHauntTrigger(); burningCandles.Value = 0; }
public static bool GetAnyButtonDown() { #if USE_REWIRED for (int i = 0; i < 2; ++i) { RE.Player player = RE.ReInput.players.GetPlayer(i); if (player.GetAnyButtonDown()) { return(true); } } return(false); #else // USE_REWIRED if (Input.anyKeyDown) { return(true); } for (uint i = 0; i < 2; ++i) { bool anyDown = GameInput.GetXboxButton(i, GameInput.Xbox360Button.A) || GameInput.GetXboxButtonDown(i, GameInput.Xbox360Button.B) || GameInput.GetXboxButtonDown(i, GameInput.Xbox360Button.Start) ; if (anyDown) { return(true); } } return(false); #endif // USE_REWIRED }
public InputSourceRewired(int playerId, InputActionDefs possibleActions) { if (playerId == -1) { player = RE.ReInput.players.SystemPlayer; player.controllers.hasKeyboard = true; player.controllers.hasMouse = true; } else { player = RE.ReInput.players.GetPlayer(playerId); } List <InputActionDef> defs = possibleActions.values; actions = new ActionPair[defs.Count]; actionToIndex = new Dictionary <InputActionDef, int>(); for (int i = 0; i < defs.Count; i++) { var def = defs[i]; actions[i] = new ActionPair { def = def, action = new InputAction(def.kind), }; actionToIndex[def] = i; } }
public override void Start() { base.Start(); m_sets.Add("players"); HandleSets(true); // to be replaced m_players.Add(this); m_rewiredPlayer = ReInput.players.GetPlayer(m_playerId); m_mouse = GetComponent <PlayerCursor>(); m_mouse.Init(m_playerId); m_playerController = GetComponent <PlayerController>(); m_playerController.m_player = this; m_feedbackColor = Constants.TRANSPARENT; // TODO: TEMP int hotkey = 1; foreach (Ability ability in Ability.m_abilities) { AbilityWrapper wrapper = new AbilityWrapper(); wrapper.AbilityName = ability.m_name; wrapper.Learned = true; wrapper.TrainingLevel = 1; wrapper.HotkeySlot = hotkey; m_abilities.Add(wrapper); hotkey++; } }
void Update() { Rewired.Player playerControls = ReInput.players.GetPlayer("SYSTEM"); if (playerControls.controllers.joystickCount == 0) { Joystick joystick = ReInput.controllers.GetJoystick(0); playerControls.controllers.AddController(joystick, true); } if (playerControls.GetButton(SLOW_NAME)) { SceneManager.LoadScene(GameplayScene); } // Check to see if we should quit if (playerControls.GetButton(QUIT_NAME)) { quitButtonHeldDownLength += Time.deltaTime; if (quitButtonHeldDownLength >= REQUIRED_TIME_TO_QUIT) { Application.Quit(); } } else { quitButtonHeldDownLength = 0; } }
// Use this for initialization void Start() { playerId = GetComponent <PlayerScript>().playerId; rePlayer = ReInput.players.GetPlayer(playerId); cc = GetComponent <CharacterController>(); moveDirectionOffset = Camera.main.transform.rotation.eulerAngles.y; }
private void Start() { gP = GameProperties.Instance; input = ReInput.players.GetPlayer(0); body = GetComponent <Rigidbody>(); cameraTransform = FindObjectOfType <CameraController>().transform; }
private void HandleReset() { elapsedResetTime += Time.deltaTime; // Fade out the music SongController.Music.volume -= .001f; if (!(elapsedResetTime > TimingController.DelaySecondsBeforeAllowedToRestart)) { return; } if (won) { if (SuccessText != null) { SuccessText.gameObject.SetActive(true); } if (!playedVictorySound) { SongController.PlayVictorySoundEffect(); playedVictorySound = true; } } else if (RestartText != null) { RestartText.gameObject.SetActive(true); } Rewired.Player playerControls = ReInput.players.GetPlayer("SYSTEM"); if (playerControls.GetButton(RESTART_NAME)) { SceneManager.LoadScene(SceneManager.GetActiveScene().name); } }
public PlayerInput(int ID) : base() { player = ReInput.players.GetPlayer(ID); EventManager.Subscribe <InputActionEventData>(RewiredInputProvider.EVT_INPUT_PRESS, (input) => { if (isActive) { switch (input.actionId) { case RewiredConsts.Action.MoveHorizontal: LeftStick.SetX(input.GetAxis()); LeftStick.Press(); break; case RewiredConsts.Action.MoveVertical: LeftStick.SetY(input.GetAxis()); LeftStick.Press(); break; case RewiredConsts.Action.CameraHorizontal: RightStick.SetX(input.GetAxis()); RightStick.Press(); break; case RewiredConsts.Action.CameraVertical: RightStick.SetY(input.GetAxis()); RightStick.Press(); break; } } }); }
public override void Execute() { if(string.IsNullOrEmpty(PlayerName)) { Player = ReInput.players.GetPlayer(PlayerId); } else { Player = ReInput.players.GetPlayer(PlayerName); } }
public static int GetAxis(uint index, Axis axis) { #if USE_REWIRED RE.Player player = RE.ReInput.players.GetPlayer((int)index); float value = player.GetAxis(AxisToRewiredAction(axis)); return(value <0.0f ? -1 : value> 0.0f ? 1 : 0); #else // USE_REWIRED switch (axis) { case Axis.MoveHorizontal: if (HoriDirKeyHeld(index)) { return(GetHoriKeyDir(index)); } break; case Axis.AimVertical: if (VertDirKeysHeld(index)) { return(GetVertKeyDir(index)); } break; } Xbox360Axis?axis360 = AxisTo360(axis); return(axis360 == null ? 0 : GetXboxAxis(index, axis360.Value)); #endif // USE_REWIRED }
private void Start() { var players = ReInput.players.Players; for (int i = 0; i < slots.Length; i++) { slots[i].Initialize(this); } joysticksCount = 0; for (int i = 0; i < players.Count; i++) { Rewired.Player player = players[i]; if (player.controllers.joystickCount > 0) { PlayerSelectionSlot slot = Array.Find(slots, x => x.Player == null); if (slot != null) { slot.AssignPlayer(players[i]); } } joysticksCount += player.controllers.joystickCount; } if (joysticksCount <= 0) { SelectKeyboard(slots[0]); SelectKeyboard(slots[1]); } }
/// <summary> /// Init class method. /// </summary> private void Init() { _audio = GetComponent <AudioComponent>(); _rePlayer = ReInput.players.GetPlayer(playerID); GetComponent <MeshRenderer>().enabled = false; }
private void Awake() { Players = SelectionScene.GetPlayers(); player1 = ReInput.players.GetPlayer(Players[0]); player2 = ReInput.players.GetPlayer(Players[1]); player3 = ReInput.players.GetPlayer(Players[2]); player4 = ReInput.players.GetPlayer(Players[3]); }
// Start is called before the first frame update void Start() { input.onEndEdit.AddListener(ListenToSubmit); Score.text = Game.Instance.player.Score.ToString(); player = ReInput.players.GetPlayer(RewiredConsts.Player.ONE); }
// Use this for initialization void Start () { eventSystem = FindObjectOfType<EventSystem>(); rewiredEventSystem = FindObjectOfType<RewiredStandaloneInputModule>(); controller = Rewired.ReInput.players.GetPlayer(controllerNumber); GetComponentInChildren<Text>().text = (controllerNumber+1).ToString(); }
// ======================================================== // ======================================================== protected void Awake() { _rb = GetComponent <Rigidbody>(); _itemHolder = transform.Find("ItemHolder"); PlayerInputs = ReInput.players.GetPlayer(player); // Get the MainPlayer's inputs // PlayerInputs = GameController.Instance.actionsMapsHelper.Player1Inputs; // Get the MainPlayer's inputs }
private Rewired.Player player; //the rewired player // Use this for initialization protected void Awake() { // Get the Rewired Player object for this player and keep it for the duration of the character's lifetime player = ReInput.players.GetPlayer(playerId); //initialize the snapshot snapshot = new InputSnapshot(); }
// Use this for initialization void Start() { currentSmokeTime = 0; timeSinceLastPush = 0; playerState = PlayerState.Standard; rewiredPlayer = ReInput.players.GetPlayer(0); controller = GetComponent <CharacterController>(); }
public void SetUp(ref SO_GameState _currentState) { player = ReInput.players.GetPlayer(0); currentState = _currentState; cameraController = Camera.main.GetComponent <CameraBehaviour>(); }
public void Initialize() { Debug.Log("InputManager.Initialize()"); camera = camera != null ? camera : Camera.main; player = ReInput.players.GetPlayer( playerId ); controller = player.controllers.GetControllerWithTag<CustomController>( controllerTag ); if ( controller == null ) { Debug.LogError( "No controller found with tag: " + controllerTag ); return; } ReInput.InputSourceUpdateEvent += OnInputSourceUpdate; }
private void Initialize() { // Get the Rewired Player object for this player. //Debug.Log("Initialized..."); playerRewired = ReInput.players.GetPlayer(playerId); initialized = true; }