Exemplo n.º 1
0
        private RotationOption GetRotationOptionFromDirection(Vector3 direction)
        {
            /*
             * direction coordinates are [-1, 1]
             * offsetAngleX: [0, 360]
             * offsetY: [-0.5, 0.5]
             */
            float angleRadians    = (float)Math.Atan2(direction.z, direction.x);
            float angleDegrees    = (float)(angleRadians * 180 / Math.PI);
            float cameraYRotation = m_player.FPSCamera.Rotation.eulerAngles.y;
            float offsetAngleX    = NormalizeOrientation(angleDegrees + cameraYRotation + 90f);
            float offsetY         = BhapticsUtils.Clamp(0.5f - (direction.y * 2), -0.5f, 0.5f);

            return(new RotationOption(offsetAngleX, offsetY));
        }
        public void Setup(PlayerAgent player, HapticPlayer hapticPlayer)
        {
            m_player       = player;
            m_hapticPlayer = hapticPlayer;

            m_lastPlayerPosition = m_player.transform.position;
            m_elevatorState      = ElevatorState.None;
            m_nextHapticPatternTimes.Clear();
            m_elevatorPosition = Vector3.zero;

            BhapticsUtils.RegisterVestTactKey(hapticPlayer, VEST_ELEVATOR_RIDE_NOISE_KEY);
            BhapticsUtils.RegisterVestTactKey(hapticPlayer, VEST_ELEVATOR_RIDE_WAVE_KEY);
            BhapticsUtils.RegisterVestTactKey(hapticPlayer, VEST_ELEVATOR_DEPLOYING_KEY);
            BhapticsUtils.RegisterVestTactKey(hapticPlayer, VEST_ELEVATOR_DOOR_OPENING_KEY);

            BhapticsUtils.RegisterArmsTactKey(hapticPlayer, ARMS_ELEVATOR_RIDE_WAVE_KEY);
            BhapticsUtils.RegisterArmsTactKey(hapticPlayer, ARMS_ELEVATOR_DEPLOYING_KEY);

            ElevatorEvents.OnElevatorPositionChanged   += OnElevatorPositionChanged;
            ElevatorEvents.OnPreReleaseSequenceStarted += OnPreReleaseSequenceStarted;
            ElevatorEvents.OnPreReleaseSequenceSkipped += OnPreReleaseSequenceSkipped;
        }
Exemplo n.º 3
0
        public void Setup(PlayerAgent player)
        {
            m_player = player;
            m_lastFlashlightEnabledState = player.Inventory.FlashlightEnabled;
            m_lastLocState = player.Locomotion.m_currentStateEnum;

            m_hapticPlayer = new HapticPlayer();
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_DAMAGE_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_TENTACLE_ATTACK_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_FIRE_R_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_FIRE_L_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_RELOAD_R_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_RELOAD_L_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_HAMMER_CHARGING_R_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_HAMMER_CHARGING_L_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_HAMMER_FULLY_CHARGED_R_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_HAMMER_FULLY_CHARGED_L_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_HAMMER_SMACK_R_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_HAMMER_SMACK_L_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_LANDING_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_LANDING_SMALL_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_GAIN_HEALTH_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_GAIN_AMMO_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_GAIN_TOOL_AMMO_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_GAIN_DISINFECTION_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_NEED_HEALTH_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_DEATH_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_CROUCH_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_STAND_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_BODY_SCAN_KEY);
            BhapticsUtils.RegisterVestTactKey(m_hapticPlayer, VEST_EXPLOSION_KEY);

            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_FIRE_R_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_FIRE_L_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_RELOAD_R_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_RELOAD_L_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_HAMMER_CHARGING_R_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_HAMMER_CHARGING_L_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_HAMMER_FULLY_CHARGED_R_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_HAMMER_FULLY_CHARGED_L_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_HAMMER_SMACK_R_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_HAMMER_SMACK_L_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_INTERACT_ITEM_R_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_INTERACT_ITEM_L_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_FLASHLIGHT_TOGGLE_R_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_FLASHLIGHT_TOGGLE_L_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_CHANGE_ITEM_R_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_CHANGE_ITEM_L_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_OUT_OF_AMMO_R_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_OUT_OF_AMMO_L_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_LANDING_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_GAIN_AMMO_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_GAIN_TOOL_AMMO_KEY);
            BhapticsUtils.RegisterArmsTactKey(m_hapticPlayer, ARMS_EXPLOSION_KEY);

            PlayerReceivedDamageEvents.OnPlayerTakeDamage     += PlayReceiveDamageHaptics;
            PlayerReceivedDamageEvents.OnMineExplosion        += MineExplosionHaptics;
            TentacleAttackEvents.OnTentacleAttack             += TentacleAttackHaptics;
            PlayerFireWeaponEvents.OnPlayerFireWeapon         += PlayWeaponFireHaptics;
            PlayerReloadEvents.OnPlayerReloaded               += PlayWeaponReloadedHaptics;
            PlayerTriggerReloadEvents.OnTriggerWeaponReloaded += PlayTriggerWeaponReloadHaptics;
            HeldItemEvents.OnItemCharging              += HammerChargingHaptics;
            HammerEvents.OnHammerSmack                 += HammerSmackHaptics;
            HammerEvents.OnHammerFullyCharged          += HammerFullyChargedHaptics;
            FocusStateEvents.OnFocusStateChange        += FocusStateChangedHaptics;
            PlayerInteractionEvents.OnPlayerInteracted += PlayerInteractedHaptics;
            PlayerInteractionEvents.OnBioscanSetState  += PlayerBioscanSetStateHaptics;
            ItemEquippableEvents.OnPlayerWieldItem     += PlayerChangedItemHaptics;
            ResourceUpdatedEvents.OnAmmoGained         += AmmoGainedHaptics;
            ResourceUpdatedEvents.OnInfectionUpdated   += InfectionUpdatedHaptics;
            ResourceUpdatedEvents.OnHealthUpdated      += OnHealthUpdated;
            InventoryAmmoEvents.OnInventoryAmmoUpdate  += OnAmmoUpdate;
            PlayerLocomotionEvents.OnStateChange       += OnPlayerLocomotionStateChanged;

            var elevatorSequence = gameObject.AddComponent <BhapticsElevatorSequence>();

            elevatorSequence.Setup(m_player, m_hapticPlayer);
        }