static public int AddController(Controller controller) { int playerNumber = 1; int playerIndex = playerNumber - 1; ReInput.players.Players[playerIndex].controllers.ClearAllControllers(); ReInput.players.Players[playerIndex].isPlaying = true; ReInput.players.Players[playerIndex].controllers.AddController(controller, true); if (controller.type == ControllerType.Keyboard) { ReInput.players.Players[playerIndex].controllers.hasKeyboard = true; int targetLayout = ReInput.mapping.GetLayoutId(ControllerType.Keyboard, "Player 1"); int targetCategory; for (int i = 1; i < ReInput.mapping.MapCategories.Count; i++) { targetCategory = ReInput.mapping.MapCategories[i].id; ReInput.players.Players[playerNumber - 1].controllers.maps.LoadMap(ControllerType.Keyboard, controller.id, targetCategory, targetLayout, true); } } //GameData.players[playerIndex].input = ReInput.players.Players[playerIndex]; RumbleManager.SetRumble(playerNumber, 1, .5f, .2f); return(playerNumber); }
void Awake() { instance = this; waitTimes = new WaitForSeconds[15]; FillDictionary(); FillWaitTimes(); }
private void Start() { m_gameController = GameController.Instance; m_collisionTag = string.Empty; m_ourParent = transform.parent.gameObject; m_ourGrandparentLogic = transform.parent.parent.gameObject; m_rumbleManager = GameController.Instance.rumbleManager; }
public IEnumerator UnitySetup() { var asyncOperation = SceneManager.LoadSceneAsync("RumbleManagerTests", LoadSceneMode.Single); yield return(new WaitUntil(() => asyncOperation.isDone)); var rumbleManagerGameObject = new GameObject("RumbleManager"); rumbleManager = rumbleManagerGameObject.AddComponent <RumbleManager>(); }
void Awake() { if (instance != null) { Destroy(this.gameObject); } else { instance = this; } }
public override sealed void Fire() { if (!loaded) { return; } if (_wait != 0) { return; } if (ammo <= 0 && _wait == 0f) { DoAmmoClick(); _wait = _fireWait; return; } if (duck != null) { RumbleManager.AddRumbleEvent(base.duck.profile, new RumbleEvent(_fireRumble, RumbleDuration.Pulse, RumbleFalloff.None)); } if (isServerForObject) { DoFireThingBullets(); } _smokeWait = 3f; loaded = false; _flareAlpha = 1.5f; if (!_manualLoad) { Reload(true); } firing = true; _wait = _fireWait; if (owner == null) { Vec2 fly = barrelVector * Rando.Float(1f, 3f); fly.y += Rando.Float(2f); hSpeed -= fly.x; vSpeed -= fly.y; } _accuracyLost += loseAccuracy; if (_accuracyLost > maxAccuracyLost) { _accuracyLost = maxAccuracyLost; } if (!isServerForObject) { return; } PlayFireSound(); ApplyKick(); }
private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(this); } }
void Start() { // register for damage callback (rumble and shake) _playerHealth.RegisterHealthCallback(TargetDamageCallback); _camShake = Camera.main.gameObject.GetComponent <CameraShake>(); _rumbler = Camera.main.gameObject.GetComponent <RumbleManager>(); _forwardVect = new Vector3(); _lookTarget = (Instantiate(lookTarget, transform.position, Quaternion.identity) as GameObject).GetComponent <Transform>(); _crosshairs = _lookTarget.GetComponent <PlayerCrosshairs>(); }
void Start() { // register for damage callback (rumble and shake) _playerHealth.RegisterHealthCallback( TargetDamageCallback ); _camShake = Camera.main.gameObject.GetComponent<CameraShake>(); _rumbler = Camera.main.gameObject.GetComponent<RumbleManager>(); _forwardVect = new Vector3(); _lookTarget = (Instantiate( lookTarget, transform.position, Quaternion.identity ) as GameObject).GetComponent<Transform>(); _crosshairs = _lookTarget.GetComponent<PlayerCrosshairs>(); }
public override void Explode() { if (base.isServerForObject) { Push(); SFX.Play("spring", 0.2f, -0.1f + Rando.Float(0.2f)); RumbleManager.AddRumbleEvent(position, new RumbleEvent(RumbleIntensity.Heavy, RumbleDuration.Short, RumbleFalloff.Medium)); Level.Remove(this); base.Explode(); } }
public override void OnReceiveRemote() { var controller = QSBWorldSync.GetUnityObjects <GalaxyMapController>().First(); controller.enabled = true; Locator.GetPlayerController().SetColliderActivation(false); controller._endlessObservatoryVolume.SetActivation(false); controller._forestOfGalaxiesVolume.SetTriggerActivation(false); ReticleController.Hide(); controller._zoomSpeed = 50f; Locator.GetPlayerBody().AddVelocityChange(-Locator.GetPlayerCamera().transform.forward *controller._zoomSpeed); controller._origEyePos = controller._eyeTransform.localPosition; controller._audioSource.Play(); RumbleManager.PlayGalaxyZoom(); Locator.GetEyeStateManager().SetState(EyeState.ZoomOut); }
public override void Fire() { if (_wait != 0 || !isServerForObject) { return; } _wait = _fireWait; var barrelAngleRad = this.barrelAngle; TheSpiritOfDarkness_ThingBullet b1 = new(GetBarrelPosition(new Vec2(27, 11)), duck, true, barrelAngleRad); TheSpiritOfDarkness_ThingBullet b2 = new(GetBarrelPosition(new Vec2(27, 11)), duck, false, barrelAngleRad); Level.Add(b1); Level.Add(b2); SFX.PlaySynchronized("laserRifle", 1, -0.5f); ApplyKick(); if (duck?.profile != null) { RumbleManager.AddRumbleEvent(duck.profile, new RumbleEvent(RumbleIntensity.Kick, RumbleDuration.Pulse, RumbleFalloff.None)); } }
/// <summary> /// Determines what number the device is by removing all text in device name but number /// Adds numbered device to numbered player /// </summary> /// <param name="device"></param> public static void EvaluateDevice(InputDevice device) { string deviceSplit = device.name.Substring(device.GetType().Name.Count()); int playerNumber = 1; if (!string.IsNullOrWhiteSpace(deviceSplit)) { playerNumber += int.Parse(deviceSplit); } //Debug.Log($" {device.name} - {device.displayName} => {deviceSplit} => {playerNumber} "); if (!playerIdToDevices.ContainsKey(playerNumber)) { SetUpPlayerNumber(numberOfPlayers); } if (device is Keyboard) { foreach (var item in playerIdToDevices) { item.Value.Add(device); } } if (!playerIdToDevices[playerNumber].Contains(device)) { playerIdToDevices[playerNumber].Add(device); if (device is Gamepad gamepad) { RumbleManager.AddGamepadToPlayer(playerNumber, gamepad); } if (playerIdUpdateActionMap.ContainsKey(playerNumber)) { //Debug.Log($"Update ActionMap for: {playerNumber} "); playerIdUpdateActionMap[playerNumber]?.Invoke(); } } }
private void Awake() { if (INSTANCE) { Destroy(gameObject); } else { INSTANCE = this; RumbleManager.Initialize(); ServiceLocator.Initialize(); AudioManager.Initialize(); InputManager.Initialize(); Restarter.Initialize(); Screenshaker.Initialize(); EventWriter.Initialize(); // remove me MoveToNextLevel.Initialize(); DontDestroyOnLoad(gameObject); } //Time.timeScale = 0.5f; //Time.fixedDeltaTime = Time.timeScale * 0.02f; }
private void InitStaticObjects() { if (!objectsInitialized) { DontDestroyOnLoad(gameObject); //Double check for every static variable if (debugMng == null) { //Debug.Log("Storing Debug Manager"); debugMng = debugManager; } if (eventMng == null) { //Debug.Log("Storing Event Manager"); eventMng = eventManager; } if (inputMng == null) { //Debug.Log("Storing Input Manager"); inputMng = inputManager; } if (tutorialMng == null) { //Debug.Log("Storing Tutorial Manager"); tutorialMng = tutorialManager; } if (audioMng == null) { //Debug.Log("Storing Audio Manager"); audioMng = audioManager; } if (enemyMng == null) { //Debug.Log("Storing Enemy Manager"); enemyMng = enemyManager; } if (poolMng == null) { //Debug.Log("Storing Pool Manager"); poolMng = poolManager; } if (colorMng == null) { //Debug.Log("Storing Color Manager"); colorMng = colorManager; } if (coloredObjectsMng == null) { //Debug.Log("Storing Colored Objects Manager"); coloredObjectsMng = coloredObjectsManager; } if (rumbleMng == null) { //Debug.Log("Storing Rumble Manager"); rumbleMng = rumbleManager; } if (gameMng == null) { //Debug.Log("Storing Game Manager"); gameMng = gameManager; } if (voxelizationMng == null) { //Debug.Log("Storing Voxelization Manager"); voxelizationMng = voxelizationManager; } if (statsMng == null) { //Debug.Log("Storing Stats Manager"); statsMng = statsManager; } if (coroutineHlp == null) { //Debug.Log("Storing Coroutine Helper"); coroutineHlp = coroutineHelper; } if (gameInfo == null) { gameInfo = new GameInfo(); gameInfo.player1 = GameObject.Instantiate <GameObject>(player1prefab); gameInfo.player1.name = "Player1"; DontDestroyOnLoad(gameInfo.player1); gameInfo.player1Controller = gameInfo.player1.GetComponent <PlayerController>(); gameInfo.player2 = GameObject.Instantiate <GameObject>(player2prefab); gameInfo.player2.name = "Player2"; DontDestroyOnLoad(gameInfo.player2); gameInfo.player2Controller = gameInfo.player2.GetComponent <PlayerController>(); gameInfo.gameCameraOffset = gameCameraOffset; gameInfo.gameCameraRotation = gameCameraRotation.rotation; } objectsInitialized = true; } else { DestroyImmediate(gameObject); } }
void Start() { MonitorCheck(); PupulateInputs(); Rumble = new RumbleManager(); }
public virtual void FireRumbleEvent() { RumbleManager.AddRumbleEvent(duck.profile, new RumbleEvent(_fireRumble, RumbleDuration.Pulse, RumbleFalloff.None)); }
private void OnApplicationQuit() { RumbleManager.PauseAllControllers(); }
private void Start() { //If there are more spawn points, choose the first one. if (spawnPosition == null && GameObject.FindGameObjectsWithTag("PlayerSpawn").Length > 0) { spawnPosition = GameObject.FindGameObjectsWithTag("PlayerSpawn")[0].transform; } playerSlot = new bool[4]; rumbleManager = RumbleManager.Instance; if (rumbleManager == null) { Debug.LogError("Rumblemanager is null"); } GameObject g = GameObject.FindGameObjectWithTag("GlobalScripts"); if (g != null) { playerSelectionInformation = g.GetComponent <PlayerSelectionContainer>(); if (playerSelectionInformation != null) { //Assign the used slots if (playerSelectionInformation != null) { for (int i = 0; i < playerSlot.Length; i++) { GameObject prefab; if (playerSelectionInformation.playerActive[i]) { playerSlot[i] = true; prefab = Instantiate(playerSelectionInformation.playerPrefabs[playerSelectionInformation.playerPrefabIndices[i]]) as GameObject; prefab.GetComponent <NavMeshAgent>().enabled = false; prefab.transform.position = spawnPosition.position; prefab.GetComponent <BasePlayer>().InputDevice = playerSelectionInformation.playerInputDevices[i]; prefab.GetComponent <BasePlayer>().RumbleManager = rumbleManager; prefab.GetComponent <NavMeshAgent>().enabled = true; OnPlayerJoined(); } else { playerSlot[i] = false; } } } } else { Debug.LogError("No Player Selection Container found!"); } } else { Debug.Log("No Global Scripts GameObject found"); } playTime = new TimeUtil(); startTime = 0f; measureTime = true; // start session DataCollector.instance.startSession(); TrackControllerTypes(); }