add ckg
plantilla base para movimiento básico
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class camera2_5dSplineZoneOptions : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public bool camera2_5dSplineZoneEnabled = true;
|
||||
|
||||
public bool setFollowPlayerRotationDirectionPausedState;
|
||||
|
||||
public bool setFollowPlayerRotationDirectionPausedValue;
|
||||
|
||||
[Space]
|
||||
|
||||
public bool adjustLockedCameraRotationToTransform;
|
||||
|
||||
public float adjustLockedCameraRotationSpeed = 10;
|
||||
|
||||
public Transform transformToAdjustLockedCameraRotation;
|
||||
|
||||
[Space]
|
||||
[Header ("Debug")]
|
||||
[Space]
|
||||
|
||||
public bool showDebugPrint;
|
||||
|
||||
|
||||
GameObject currentPlayer;
|
||||
|
||||
playerCamera currentPlayerCamera;
|
||||
|
||||
|
||||
public void setCurrentPlayerAndActivateCameraState (GameObject newPlayer)
|
||||
{
|
||||
setCurrentPlayer (newPlayer);
|
||||
|
||||
setCameraStateOnPlayer ();
|
||||
}
|
||||
|
||||
public void setCurrentPlayer (GameObject newPlayer)
|
||||
{
|
||||
if (newPlayer == null) {
|
||||
print ("WARNING: the zone system is trying to assign an empty player, make sure the system is properly configured");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
currentPlayer = newPlayer;
|
||||
|
||||
playerComponentsManager mainPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
|
||||
|
||||
if (mainPlayerComponentsManager != null) {
|
||||
currentPlayerCamera = mainPlayerComponentsManager.getPlayerCamera ();
|
||||
}
|
||||
}
|
||||
|
||||
public void setCameraStateOnPlayer ()
|
||||
{
|
||||
if (!camera2_5dSplineZoneEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentPlayerCamera == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (setFollowPlayerRotationDirectionPausedState) {
|
||||
currentPlayerCamera.setFollowPlayerRotationDirectionEnabledOnLockedCameraPausedState (setFollowPlayerRotationDirectionPausedValue);
|
||||
}
|
||||
|
||||
if (adjustLockedCameraRotationToTransform) {
|
||||
currentPlayerCamera.setLockedMainCameraTransformRotationSmoothly (transformToAdjustLockedCameraRotation.eulerAngles, adjustLockedCameraRotationSpeed);
|
||||
}
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("player detected, setting camera state");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8fbe110e5a841d647a0c930ffacbdec0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Camera/Player Camera/camera2_5dSplineZoneOptions.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,249 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class camera2_5dZoneLimitSystem : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public bool useCameraLimit = true;
|
||||
|
||||
public bool setCameraForwardPosition;
|
||||
public float cameraForwardPosition;
|
||||
|
||||
public bool useMoveInXAxisOn2_5d;
|
||||
|
||||
[Space]
|
||||
[Header ("Limit Width Settings")]
|
||||
[Space]
|
||||
|
||||
public bool useWidthLimit = true;
|
||||
public float widthLimitRight;
|
||||
public float widthLimitLeft;
|
||||
|
||||
[Space]
|
||||
[Header ("Limit Height Settings")]
|
||||
[Space]
|
||||
|
||||
public bool useHeightLimit = true;
|
||||
public float heightLimitUpper;
|
||||
public float heightLimitLower;
|
||||
|
||||
[Space]
|
||||
[Header ("Limit Depth Settings")]
|
||||
[Space]
|
||||
|
||||
public bool useDepthLimit;
|
||||
public float depthLimitFront;
|
||||
public float depthLimitBackward;
|
||||
|
||||
[Space]
|
||||
[Header ("Set Limit At Start Settings")]
|
||||
[Space]
|
||||
|
||||
public bool startGameWithThisLimit;
|
||||
public GameObject playerForView;
|
||||
public bool useMultiplePlayers;
|
||||
public List<GameObject> playerForViewList = new List<GameObject> ();
|
||||
|
||||
[Space]
|
||||
[Header ("Gizmo Settings")]
|
||||
[Space]
|
||||
|
||||
public bool showGizmo;
|
||||
public Color gizmoColor = Color.white;
|
||||
public float gizmoRadius = 0.2f;
|
||||
public Color depthGizmoColor = Color.white;
|
||||
|
||||
Vector3 currentPosition;
|
||||
|
||||
GameObject currentPlayer;
|
||||
|
||||
Vector3 horizontalRightUpperLinePosition;
|
||||
Vector3 horizontalLeftUpperLinePosition;
|
||||
Vector3 horizontalRightLowerLinePosition;
|
||||
Vector3 horizontalLeftLowerLinePosition;
|
||||
Vector3 verticalRightUpperLinePosition;
|
||||
Vector3 verticalRightLowerLinePosition;
|
||||
Vector3 verticalLeftUpperLinePosition;
|
||||
Vector3 verticalLefttLowerLinePosition;
|
||||
|
||||
Vector3 depthFrontPosition;
|
||||
Vector3 depthBackwardPosition;
|
||||
|
||||
float totalWidth;
|
||||
float totalheight;
|
||||
|
||||
playerController playerControlerManager;
|
||||
playerCamera playerCameraManager;
|
||||
|
||||
void Start ()
|
||||
{
|
||||
if (startGameWithThisLimit) {
|
||||
if (useMultiplePlayers) {
|
||||
for (int k = 0; k < playerForViewList.Count; k++) {
|
||||
setCurrentPlayer (playerForViewList [k]);
|
||||
|
||||
setCameraLimitOnPlayer ();
|
||||
}
|
||||
} else {
|
||||
setCurrentPlayer (playerForView);
|
||||
|
||||
setCameraLimitOnPlayer ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setCameraLimitOnPlayer ()
|
||||
{
|
||||
if (currentPlayer != null) {
|
||||
playerCameraManager.setCameraLimit (useCameraLimit, useWidthLimit, widthLimitRight, widthLimitLeft, useHeightLimit, heightLimitUpper,
|
||||
heightLimitLower, transform.position, useDepthLimit, depthLimitFront, depthLimitBackward);
|
||||
|
||||
if (setCameraForwardPosition) {
|
||||
playerCameraManager.setNewCameraForwardPosition (cameraForwardPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setCameraLimitOnPlayer (GameObject newPlayer)
|
||||
{
|
||||
setCurrentPlayer (newPlayer);
|
||||
|
||||
setCameraLimitOnPlayer ();
|
||||
}
|
||||
|
||||
public void setCurrentPlayer (GameObject newPlayer)
|
||||
{
|
||||
if (newPlayer == null) {
|
||||
print ("WARNING: the zone limit system is trying to assign an empty player, make sure the system is properly configured");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
currentPlayer = newPlayer;
|
||||
|
||||
playerComponentsManager mainPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
|
||||
|
||||
if (mainPlayerComponentsManager != null) {
|
||||
playerControlerManager = mainPlayerComponentsManager.getPlayerController ();
|
||||
}
|
||||
|
||||
if (playerControlerManager != null && mainPlayerComponentsManager != null) {
|
||||
playerCameraManager = mainPlayerComponentsManager.getPlayerCamera ();
|
||||
} else {
|
||||
vehicleHUDManager currentVehicleHUDManager = applyDamage.getVehicleHUDManager (newPlayer);
|
||||
|
||||
if (currentVehicleHUDManager != null && currentVehicleHUDManager.isVehicleBeingDriven ()) {
|
||||
|
||||
currentPlayer = currentVehicleHUDManager.getCurrentDriver ();
|
||||
|
||||
mainPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
|
||||
|
||||
playerControlerManager = mainPlayerComponentsManager.getPlayerController ();
|
||||
playerCameraManager = mainPlayerComponentsManager.getPlayerCamera ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setConfigurationToPlayer ()
|
||||
{
|
||||
setCameraLimitOnPlayer ();
|
||||
}
|
||||
|
||||
void OnDrawGizmos ()
|
||||
{
|
||||
if (!showGizmo) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (GKC_Utils.isCurrentSelectionActiveGameObject (gameObject)) {
|
||||
DrawGizmos ();
|
||||
}
|
||||
}
|
||||
|
||||
void OnDrawGizmosSelected ()
|
||||
{
|
||||
DrawGizmos ();
|
||||
}
|
||||
|
||||
void DrawGizmos ()
|
||||
{
|
||||
if (showGizmo) {
|
||||
|
||||
currentPosition = transform.position;
|
||||
|
||||
horizontalRightUpperLinePosition = currentPosition + Vector3.up * heightLimitUpper;
|
||||
horizontalLeftUpperLinePosition = currentPosition + Vector3.up * heightLimitUpper;
|
||||
horizontalRightLowerLinePosition = currentPosition - Vector3.up * heightLimitLower;
|
||||
horizontalLeftLowerLinePosition = currentPosition - Vector3.up * heightLimitLower;
|
||||
verticalRightUpperLinePosition = currentPosition + Vector3.up * heightLimitUpper;
|
||||
verticalRightLowerLinePosition = currentPosition - Vector3.up * heightLimitLower;
|
||||
verticalLeftUpperLinePosition = currentPosition + Vector3.up * heightLimitUpper;
|
||||
verticalLefttLowerLinePosition = currentPosition - Vector3.up * heightLimitLower;
|
||||
|
||||
if (useMoveInXAxisOn2_5d) {
|
||||
horizontalRightUpperLinePosition += Vector3.right * widthLimitRight;
|
||||
horizontalLeftUpperLinePosition -= Vector3.right * widthLimitLeft;
|
||||
horizontalRightLowerLinePosition += Vector3.right * widthLimitRight;
|
||||
horizontalLeftLowerLinePosition -= Vector3.right * widthLimitLeft;
|
||||
verticalRightUpperLinePosition += Vector3.right * widthLimitRight;
|
||||
verticalRightLowerLinePosition += Vector3.right * widthLimitRight;
|
||||
verticalLeftUpperLinePosition -= Vector3.right * widthLimitLeft;
|
||||
verticalLefttLowerLinePosition -= Vector3.right * widthLimitLeft;
|
||||
} else {
|
||||
horizontalRightUpperLinePosition += Vector3.forward * widthLimitRight;
|
||||
horizontalLeftUpperLinePosition -= Vector3.forward * widthLimitLeft;
|
||||
horizontalRightLowerLinePosition += Vector3.forward * widthLimitRight;
|
||||
horizontalLeftLowerLinePosition -= Vector3.forward * widthLimitLeft;
|
||||
verticalRightUpperLinePosition += Vector3.forward * widthLimitRight;
|
||||
verticalRightLowerLinePosition += Vector3.forward * widthLimitRight;
|
||||
verticalLeftUpperLinePosition -= Vector3.forward * widthLimitLeft;
|
||||
verticalLefttLowerLinePosition -= Vector3.forward * widthLimitLeft;
|
||||
}
|
||||
|
||||
Gizmos.DrawCube (transform.position, Vector3.one * gizmoRadius);
|
||||
|
||||
if (useWidthLimit) {
|
||||
Gizmos.DrawLine (horizontalRightUpperLinePosition, horizontalLeftUpperLinePosition);
|
||||
Gizmos.DrawLine (horizontalRightLowerLinePosition, horizontalLeftLowerLinePosition);
|
||||
}
|
||||
|
||||
if (useHeightLimit) {
|
||||
Gizmos.DrawLine (verticalRightUpperLinePosition, verticalRightLowerLinePosition);
|
||||
Gizmos.DrawLine (verticalLeftUpperLinePosition, verticalLefttLowerLinePosition);
|
||||
}
|
||||
|
||||
if (useDepthLimit) {
|
||||
Gizmos.color = depthGizmoColor;
|
||||
|
||||
totalWidth = widthLimitRight + widthLimitLeft;
|
||||
totalheight = heightLimitUpper + heightLimitLower;
|
||||
|
||||
if (useMoveInXAxisOn2_5d) {
|
||||
depthFrontPosition = transform.position + Vector3.forward * depthLimitFront / 2 + Vector3.right * widthLimitRight / 2 - Vector3.right * widthLimitLeft / 2;
|
||||
depthFrontPosition += Vector3.up * heightLimitUpper / 2 - Vector3.up * heightLimitLower / 2;
|
||||
|
||||
Gizmos.DrawCube (depthFrontPosition, new Vector3 (totalWidth, totalheight, depthLimitFront));
|
||||
|
||||
depthBackwardPosition = transform.position - Vector3.forward * depthLimitBackward / 2 + Vector3.right * widthLimitRight / 2 - Vector3.right * widthLimitLeft / 2;
|
||||
depthBackwardPosition += Vector3.up * heightLimitUpper / 2 - Vector3.up * heightLimitLower / 2;
|
||||
|
||||
Gizmos.DrawCube (depthBackwardPosition, new Vector3 (totalWidth, totalheight, depthLimitBackward));
|
||||
} else {
|
||||
|
||||
depthFrontPosition = transform.position + Vector3.right * depthLimitFront / 2 + Vector3.forward * widthLimitRight / 2 - Vector3.forward * widthLimitLeft / 2;
|
||||
depthFrontPosition += Vector3.up * heightLimitUpper / 2 - Vector3.up * heightLimitLower / 2;
|
||||
|
||||
Gizmos.DrawCube (depthFrontPosition, new Vector3 (depthLimitFront, totalheight, totalWidth));
|
||||
|
||||
depthBackwardPosition = transform.position - Vector3.right * depthLimitBackward / 2 + Vector3.forward * widthLimitRight / 2 - Vector3.forward * widthLimitLeft / 2;
|
||||
depthBackwardPosition += Vector3.up * heightLimitUpper / 2 - Vector3.up * heightLimitLower / 2;
|
||||
|
||||
Gizmos.DrawCube (depthBackwardPosition, new Vector3 (depthLimitBackward, totalheight, totalWidth));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c63dbd328947b1745b33b0e540eee285
|
||||
timeCreated: 1541957881
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Camera/Player Camera/camera2_5dZoneLimitSystem.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,6 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class cameraAxisComponentsInfo : MonoBehaviour {
|
||||
public lockedCameraSystem.cameraAxis cameraAxisInfo;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e9fd7d9d85f3edd47ae187e1b67c2374
|
||||
timeCreated: 1508683520
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Camera/Player Camera/cameraAxisComponentsInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,182 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class cameraControllerManager : MonoBehaviour
|
||||
{
|
||||
public virtual bool isFirstPersonActive ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool isMoveInXAxisOn2_5d ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void setMoveInXAxisOn2_5dState (bool state)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual Vector3 getOriginalLockedCameraPivotPosition ()
|
||||
{
|
||||
return Vector3.zero;
|
||||
}
|
||||
|
||||
public virtual Vector3 getSplineForPlayerPosition (Vector3 playerPosition)
|
||||
{
|
||||
return Vector3.zero;
|
||||
}
|
||||
|
||||
public virtual Vector3 getSplineForwardDirection (Vector3 playerPosition)
|
||||
{
|
||||
return Vector3.zero;
|
||||
}
|
||||
|
||||
public virtual void changeCameraFov (bool state)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual Transform getPivotCameraTransform ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual Transform getLockedCameraTransform ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual void crouch (bool isCrouching)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void setMainCameraFovStartAndEnd (float startTargetValue, float endTargetValue, float speed)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual float getOriginalCameraFov ()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
public virtual bool isPlayerLookingAtTarget ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool isLookintAtTargetByInput ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void setShakeCameraState (bool state, string stateName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual float getLastTimeMoved ()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
public virtual void setDrivingState (bool state)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual bool is2_5ViewActive ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool istargetToLookLocated ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void setPlayerAndCameraParent (Transform newParent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void stopShakeCamera ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual Transform getCurrentTargetToLook ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual void setUpdatePlayerCameraPositionOnLateUpdateActiveState (bool state)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void setUpdatePlayerCameraPositionOnFixedUpdateActiveState (bool state)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual bool isFullBodyAwarenessEnabled ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void setPivotCameraTransformParentCurrentTransformToFollow ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void setPivotCameraTransformOriginalParent ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void resetPivotCameraTransformLocalRotation ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void setHeadColliderStateOnFBA (bool state)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void setFBAPivotCameraTransformActiveState (bool state)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void startOrStopUpdatePivotPositionOnFBA (bool state)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void checkActivateOrDeactivateHeadColliderOnFBA (bool state)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void checkResetLeanState (bool resetPivotCameraTransform)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual bool isShowCameraCursorWhenNotAimingActive ()
|
||||
{
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual void setFBAPivotTransformParentFromPlayer (Transform newParent)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c78e484febad1f4428cca9239634eef4
|
||||
timeCreated: 1631151176
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Camera/Player Camera/cameraControllerManager.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,212 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
[System.Serializable]
|
||||
public class cameraStateInfo
|
||||
{
|
||||
public string Name;
|
||||
public Vector3 camPositionOffset;
|
||||
public Vector3 pivotPositionOffset;
|
||||
public Vector3 pivotParentPositionOffset;
|
||||
public Vector2 yLimits;
|
||||
|
||||
public float initialFovValue;
|
||||
public float fovTransitionSpeed = 10;
|
||||
|
||||
public float maxFovValue;
|
||||
public float minFovValue = 17;
|
||||
|
||||
public bool showGizmo;
|
||||
public Color gizmoColor;
|
||||
|
||||
public Vector3 originalCamPositionOffset;
|
||||
|
||||
public bool leanEnabled;
|
||||
public float maxLeanAngle;
|
||||
public float leanSpeed;
|
||||
public float leanResetSpeed;
|
||||
public float leanRaycastDistance;
|
||||
public float leanAngleOnSurfaceFound;
|
||||
public float leanHeight;
|
||||
|
||||
public bool isLeanOnFBA;
|
||||
public float FBALeanPositionOffsetX;
|
||||
public float FBALeanPositionOffsetY;
|
||||
|
||||
public bool headTrackActive = true;
|
||||
|
||||
public bool lookInPlayerDirection;
|
||||
public float lookInPlayerDirectionSpeed;
|
||||
public bool allowRotationWithInput;
|
||||
public float timeToResetRotationAfterInput;
|
||||
|
||||
public bool useYLimitsOnLookAtTargetActive;
|
||||
public Vector2 YLimitsOnLookAtTargetActive = new Vector2 (-20, 30);
|
||||
|
||||
public bool cameraCollisionActive = true;
|
||||
|
||||
public float pivotRotationOffset;
|
||||
|
||||
public bool ignoreCameraShakeOnRunState;
|
||||
|
||||
public bool followTransformPosition;
|
||||
public Transform transformToFollow;
|
||||
public bool useFollowTransformPositionOffset;
|
||||
public Vector3 followTransformPositionOffset;
|
||||
|
||||
public bool setNearClipPlaneValue;
|
||||
public float nearClipPlaneValue;
|
||||
|
||||
public bool useCustomMovementLerpSpeed;
|
||||
|
||||
public float movementLerpSpeed = 5;
|
||||
|
||||
|
||||
|
||||
public cameraStateInfo (cameraStateInfo newState)
|
||||
{
|
||||
Name = newState.Name;
|
||||
|
||||
camPositionOffset = newState.camPositionOffset;
|
||||
pivotPositionOffset = newState.pivotPositionOffset;
|
||||
pivotParentPositionOffset = newState.pivotParentPositionOffset;
|
||||
|
||||
yLimits = newState.yLimits;
|
||||
|
||||
initialFovValue = newState.initialFovValue;
|
||||
fovTransitionSpeed = newState.fovTransitionSpeed;
|
||||
maxFovValue = newState.maxFovValue;
|
||||
minFovValue = newState.minFovValue;
|
||||
|
||||
originalCamPositionOffset = newState.originalCamPositionOffset;
|
||||
|
||||
leanEnabled = newState.leanEnabled;
|
||||
maxLeanAngle = newState.maxLeanAngle;
|
||||
leanSpeed = newState.leanSpeed;
|
||||
leanResetSpeed = newState.leanResetSpeed;
|
||||
leanRaycastDistance = newState.leanRaycastDistance;
|
||||
leanAngleOnSurfaceFound = newState.leanAngleOnSurfaceFound;
|
||||
leanHeight = newState.leanHeight;
|
||||
|
||||
isLeanOnFBA = newState.isLeanOnFBA;
|
||||
FBALeanPositionOffsetX = newState.FBALeanPositionOffsetX;
|
||||
FBALeanPositionOffsetY = newState.FBALeanPositionOffsetY;
|
||||
|
||||
headTrackActive = newState.headTrackActive;
|
||||
|
||||
lookInPlayerDirection = newState.lookInPlayerDirection;
|
||||
lookInPlayerDirectionSpeed = newState.lookInPlayerDirectionSpeed;
|
||||
allowRotationWithInput = newState.allowRotationWithInput;
|
||||
timeToResetRotationAfterInput = newState.timeToResetRotationAfterInput;
|
||||
|
||||
useYLimitsOnLookAtTargetActive = newState.useYLimitsOnLookAtTargetActive;
|
||||
YLimitsOnLookAtTargetActive = newState.YLimitsOnLookAtTargetActive;
|
||||
|
||||
cameraCollisionActive = newState.cameraCollisionActive;
|
||||
|
||||
pivotRotationOffset = newState.pivotRotationOffset;
|
||||
|
||||
ignoreCameraShakeOnRunState = newState.ignoreCameraShakeOnRunState;
|
||||
|
||||
followTransformPosition = newState.followTransformPosition;
|
||||
transformToFollow = newState.transformToFollow;
|
||||
|
||||
useFollowTransformPositionOffset = newState.useFollowTransformPositionOffset;
|
||||
followTransformPositionOffset = newState.followTransformPositionOffset;
|
||||
|
||||
setNearClipPlaneValue = newState.setNearClipPlaneValue;
|
||||
nearClipPlaneValue = newState.nearClipPlaneValue;
|
||||
|
||||
useCustomMovementLerpSpeed = newState.useCustomMovementLerpSpeed;
|
||||
movementLerpSpeed = newState.movementLerpSpeed;
|
||||
}
|
||||
|
||||
public void assignCameraStateValues (cameraStateInfo from, float lerpSpeed)
|
||||
{
|
||||
Name = from.Name;
|
||||
|
||||
if (lerpSpeed > 0) {
|
||||
if (camPositionOffset != from.camPositionOffset) {
|
||||
camPositionOffset = Vector3.Lerp (camPositionOffset, from.camPositionOffset, lerpSpeed);
|
||||
}
|
||||
|
||||
if (pivotPositionOffset != from.pivotPositionOffset) {
|
||||
pivotPositionOffset = Vector3.Lerp (pivotPositionOffset, from.pivotPositionOffset, lerpSpeed);
|
||||
}
|
||||
|
||||
if (pivotParentPositionOffset != from.pivotParentPositionOffset) {
|
||||
pivotParentPositionOffset = Vector3.Lerp (pivotParentPositionOffset, from.pivotParentPositionOffset, lerpSpeed);
|
||||
}
|
||||
|
||||
if (yLimits.x != from.yLimits.x) {
|
||||
yLimits.x = Mathf.Lerp (yLimits.x, from.yLimits.x, lerpSpeed);
|
||||
}
|
||||
|
||||
if (yLimits.y != from.yLimits.y) {
|
||||
yLimits.y = Mathf.Lerp (yLimits.y, from.yLimits.y, lerpSpeed);
|
||||
}
|
||||
} else {
|
||||
camPositionOffset = from.camPositionOffset;
|
||||
pivotPositionOffset = from.pivotPositionOffset;
|
||||
pivotParentPositionOffset = from.pivotParentPositionOffset;
|
||||
|
||||
yLimits = from.yLimits;
|
||||
}
|
||||
|
||||
initialFovValue = from.initialFovValue;
|
||||
fovTransitionSpeed = from.fovTransitionSpeed;
|
||||
maxFovValue = from.maxFovValue;
|
||||
minFovValue = from.minFovValue;
|
||||
|
||||
originalCamPositionOffset = from.originalCamPositionOffset;
|
||||
|
||||
leanEnabled = from.leanEnabled;
|
||||
maxLeanAngle = from.maxLeanAngle;
|
||||
leanSpeed = from.leanSpeed;
|
||||
leanResetSpeed = from.leanResetSpeed;
|
||||
leanRaycastDistance = from.leanRaycastDistance;
|
||||
leanAngleOnSurfaceFound = from.leanAngleOnSurfaceFound;
|
||||
leanHeight = from.leanHeight;
|
||||
|
||||
if (leanEnabled) {
|
||||
isLeanOnFBA = from.isLeanOnFBA;
|
||||
FBALeanPositionOffsetX = from.FBALeanPositionOffsetX;
|
||||
FBALeanPositionOffsetY = from.FBALeanPositionOffsetY;
|
||||
}
|
||||
|
||||
headTrackActive = from.headTrackActive;
|
||||
|
||||
lookInPlayerDirection = from.lookInPlayerDirection;
|
||||
lookInPlayerDirectionSpeed = from.lookInPlayerDirectionSpeed;
|
||||
allowRotationWithInput = from.allowRotationWithInput;
|
||||
timeToResetRotationAfterInput = from.timeToResetRotationAfterInput;
|
||||
|
||||
useYLimitsOnLookAtTargetActive = from.useYLimitsOnLookAtTargetActive;
|
||||
YLimitsOnLookAtTargetActive = from.YLimitsOnLookAtTargetActive;
|
||||
|
||||
cameraCollisionActive = from.cameraCollisionActive;
|
||||
|
||||
pivotRotationOffset = from.pivotRotationOffset;
|
||||
|
||||
ignoreCameraShakeOnRunState = from.ignoreCameraShakeOnRunState;
|
||||
|
||||
followTransformPosition = from.followTransformPosition;
|
||||
transformToFollow = from.transformToFollow;
|
||||
|
||||
useFollowTransformPositionOffset = from.useFollowTransformPositionOffset;
|
||||
followTransformPositionOffset = from.followTransformPositionOffset;
|
||||
|
||||
setNearClipPlaneValue = from.setNearClipPlaneValue;
|
||||
|
||||
if (setNearClipPlaneValue) {
|
||||
nearClipPlaneValue = from.nearClipPlaneValue;
|
||||
}
|
||||
|
||||
useCustomMovementLerpSpeed = from.useCustomMovementLerpSpeed;
|
||||
|
||||
if (useCustomMovementLerpSpeed) {
|
||||
movementLerpSpeed = from.movementLerpSpeed;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d7d5de32a5418b41a978deed5518cb6
|
||||
timeCreated: 1470673329
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Camera/Player Camera/cameraStateInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,280 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class externalCameraShakeSystem : MonoBehaviour
|
||||
{
|
||||
public bool externalCameraShakeEnabled = true;
|
||||
|
||||
public string externalShakeName;
|
||||
public bool shakeUsingDistance;
|
||||
public float minDistanceToShake;
|
||||
public LayerMask layer;
|
||||
public bool useShakeListTriggeredByActions;
|
||||
public List<shakeTriggeredByActionInfo> shakeTriggeredByActionList = new List<shakeTriggeredByActionInfo> ();
|
||||
|
||||
public bool useShakeEvent;
|
||||
public UnityEvent eventAtStart;
|
||||
public UnityEvent eventAtEnd;
|
||||
|
||||
bool currentUseShakeEventValue;
|
||||
UnityEvent currentEventAtStart;
|
||||
UnityEvent currentEventAtEnd;
|
||||
|
||||
public bool setPlayerManually;
|
||||
public GameObject currentPlayer;
|
||||
|
||||
public string mainManagerName = "External Shake List Manager";
|
||||
|
||||
public bool showGizmo;
|
||||
public Color gizmoLabelColor = Color.black;
|
||||
public int nameIndex;
|
||||
public string [] nameList;
|
||||
|
||||
public externalShakeListManager externalShakeManager;
|
||||
|
||||
float distancePercentage;
|
||||
headBob headBobManager;
|
||||
|
||||
bool playerAssignedManually;
|
||||
|
||||
public void getExternalShakeList ()
|
||||
{
|
||||
bool externalShakeManagerLocated = false;
|
||||
|
||||
if (Application.isPlaying) {
|
||||
externalShakeManagerLocated = externalShakeManager != null;
|
||||
|
||||
if (!externalShakeManagerLocated) {
|
||||
externalShakeManager = externalShakeListManager.Instance;
|
||||
|
||||
externalShakeManagerLocated = externalShakeManager != null;
|
||||
}
|
||||
|
||||
if (!externalShakeManagerLocated) {
|
||||
GKC_Utils.instantiateMainManagerOnSceneWithTypeOnApplicationPlaying (externalShakeListManager.getMainManagerName (), typeof (externalShakeListManager), true);
|
||||
|
||||
externalShakeManager = externalShakeListManager.Instance;
|
||||
|
||||
externalShakeManagerLocated = externalShakeManager != null;
|
||||
}
|
||||
} else {
|
||||
externalShakeManagerLocated = externalShakeManager != null;
|
||||
|
||||
if (!externalShakeManagerLocated) {
|
||||
externalShakeManager = FindObjectOfType<externalShakeListManager> ();
|
||||
|
||||
externalShakeManagerLocated = externalShakeManager != null;
|
||||
}
|
||||
|
||||
if (!externalShakeManagerLocated) {
|
||||
GKC_Utils.instantiateMainManagerOnSceneWithType (externalShakeListManager.getMainManagerName (), typeof (externalShakeListManager));
|
||||
|
||||
externalShakeManager = FindObjectOfType<externalShakeListManager> ();
|
||||
|
||||
externalShakeManagerLocated = externalShakeManager != null;
|
||||
}
|
||||
}
|
||||
|
||||
if (externalShakeManagerLocated) {
|
||||
nameList = new string [externalShakeManager.externalShakeInfoList.Count];
|
||||
|
||||
for (int i = 0; i < externalShakeManager.externalShakeInfoList.Count; i++) {
|
||||
nameList [i] = externalShakeManager.externalShakeInfoList [i].name;
|
||||
}
|
||||
|
||||
updateComponent ();
|
||||
}
|
||||
}
|
||||
|
||||
public void setCurrentPlayer (GameObject player)
|
||||
{
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
currentPlayer = player;
|
||||
|
||||
if (headBobManager == null) {
|
||||
playerComponentsManager mainPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
|
||||
|
||||
if (mainPlayerComponentsManager != null) {
|
||||
headBobManager = mainPlayerComponentsManager.getHeadBob ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setCurrentPlayerAndActivateCameraShake (GameObject player)
|
||||
{
|
||||
setCurrentPlayer (player);
|
||||
|
||||
setCameraShake ();
|
||||
}
|
||||
|
||||
public void setCameraShake ()
|
||||
{
|
||||
if (!externalCameraShakeEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
currentUseShakeEventValue = useShakeEvent;
|
||||
|
||||
if (currentUseShakeEventValue) {
|
||||
currentEventAtStart = eventAtStart;
|
||||
currentEventAtEnd = eventAtEnd;
|
||||
}
|
||||
|
||||
if (setPlayerManually) {
|
||||
if (!playerAssignedManually) {
|
||||
setCurrentPlayer (currentPlayer);
|
||||
|
||||
playerAssignedManually = true;
|
||||
}
|
||||
}
|
||||
|
||||
setCameraShakeByName (externalShakeName);
|
||||
|
||||
currentUseShakeEventValue = false;
|
||||
}
|
||||
|
||||
public void setCameraShakeByAction (string actionName)
|
||||
{
|
||||
if (!externalCameraShakeEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
int shakeTriggeredByActionListCount = shakeTriggeredByActionList.Count;
|
||||
|
||||
for (int i = 0; i < shakeTriggeredByActionListCount; i++) {
|
||||
if (shakeTriggeredByActionList [i].actionName.Equals (actionName)) {
|
||||
|
||||
currentUseShakeEventValue = shakeTriggeredByActionList [i].useShakeEvent;
|
||||
|
||||
if (currentUseShakeEventValue) {
|
||||
currentEventAtStart = shakeTriggeredByActionList [i].eventAtStart;
|
||||
currentEventAtEnd = shakeTriggeredByActionList [i].eventAtEnd;
|
||||
}
|
||||
|
||||
setPlayerManually = true;
|
||||
|
||||
if (setPlayerManually) {
|
||||
setCurrentPlayer (currentPlayer);
|
||||
}
|
||||
|
||||
setCameraShakeByName (shakeTriggeredByActionList [i].shakeName);
|
||||
|
||||
currentUseShakeEventValue = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setCameraShakeByName (string shakeName)
|
||||
{
|
||||
if (!externalCameraShakeEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (setPlayerManually) {
|
||||
if (currentPlayer != null) {
|
||||
setExternalShakeSignal (currentPlayer, shakeName);
|
||||
}
|
||||
} else {
|
||||
List<Collider> colliders = new List<Collider> ();
|
||||
|
||||
colliders.AddRange (Physics.OverlapSphere (transform.position, minDistanceToShake, layer));
|
||||
|
||||
int collidersCount = colliders.Count;
|
||||
|
||||
for (int i = 0; i < collidersCount; i++) {
|
||||
Collider hit = colliders [i];
|
||||
|
||||
if (hit != null && !hit.isTrigger) {
|
||||
setExternalShakeSignal (hit.gameObject, shakeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setExternalShakeSignal (GameObject objectToCall, string shakeName)
|
||||
{
|
||||
if (!externalCameraShakeEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (shakeUsingDistance) {
|
||||
float currentDistance = GKC_Utils.distance (objectToCall.transform.position, transform.position);
|
||||
|
||||
if (currentDistance <= minDistanceToShake) {
|
||||
distancePercentage = currentDistance / minDistanceToShake;
|
||||
distancePercentage = 1 - distancePercentage;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
distancePercentage = 1;
|
||||
}
|
||||
|
||||
if (!setPlayerManually) {
|
||||
playerComponentsManager mainPlayerComponentsManager = objectToCall.GetComponent<playerComponentsManager> ();
|
||||
|
||||
if (mainPlayerComponentsManager != null) {
|
||||
headBobManager = mainPlayerComponentsManager.getHeadBob ();
|
||||
}
|
||||
}
|
||||
|
||||
if (headBobManager != null) {
|
||||
if (currentUseShakeEventValue) {
|
||||
headBobManager.setCurrentExternalCameraShakeSystemEvents (currentEventAtStart, currentEventAtEnd);
|
||||
} else {
|
||||
headBobManager.disableUseShakeEventState ();
|
||||
}
|
||||
|
||||
headBobManager.setExternalShakeStateByName (shakeName, distancePercentage);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateComponent ()
|
||||
{
|
||||
GKC_Utils.updateComponent (this);
|
||||
|
||||
GKC_Utils.updateDirtyScene ("Updating External Camera Shake System ", gameObject);
|
||||
}
|
||||
|
||||
void OnDrawGizmos ()
|
||||
{
|
||||
if (!showGizmo) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (GKC_Utils.isCurrentSelectionActiveGameObject (gameObject)) {
|
||||
DrawGizmos ();
|
||||
}
|
||||
}
|
||||
|
||||
void OnDrawGizmosSelected ()
|
||||
{
|
||||
DrawGizmos ();
|
||||
}
|
||||
|
||||
void DrawGizmos ()
|
||||
{
|
||||
if (showGizmo) {
|
||||
Gizmos.color = Color.red;
|
||||
Gizmos.DrawWireSphere (transform.position, minDistanceToShake);
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class shakeTriggeredByActionInfo
|
||||
{
|
||||
public string actionName;
|
||||
public string shakeName;
|
||||
public int nameIndex;
|
||||
|
||||
public bool useShakeEvent;
|
||||
public UnityEvent eventAtStart;
|
||||
public UnityEvent eventAtEnd;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1688134050b0e8a4b86b67ac8cc8f30e
|
||||
timeCreated: 1501357091
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Camera/Player Camera/externalCameraShakeSystem.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,58 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
[System.Serializable]
|
||||
public class externalShakeInfo
|
||||
{
|
||||
|
||||
public Vector3 shakePosition;
|
||||
public Vector3 shakePositionSpeed;
|
||||
public float shakePositionSmooth;
|
||||
public Vector3 shakeRotation;
|
||||
public Vector3 shakeRotationSpeed;
|
||||
public float shakeRotationSmooth;
|
||||
public float shakeDuration;
|
||||
|
||||
public bool decreaseShakeInTime;
|
||||
public float decreaseShakeSpeed;
|
||||
|
||||
public bool useDelayBeforeStartDecrease;
|
||||
public float delayBeforeStartDecrease;
|
||||
|
||||
public bool repeatShake;
|
||||
public int numberOfRepeats;
|
||||
public float delayBetweenRepeats;
|
||||
|
||||
public float externalShakeDelay;
|
||||
|
||||
public bool useUnscaledTime;
|
||||
|
||||
public externalShakeInfo (externalShakeInfo newShake)
|
||||
{
|
||||
shakePosition = newShake.shakePosition;
|
||||
shakePositionSpeed = newShake.shakePositionSpeed;
|
||||
shakePositionSmooth = newShake.shakePositionSmooth;
|
||||
shakeRotation = newShake.shakeRotation;
|
||||
shakeRotationSpeed = newShake.shakeRotationSpeed;
|
||||
shakeRotationSmooth = newShake.shakeRotationSmooth;
|
||||
shakeDuration = newShake.shakeDuration;
|
||||
decreaseShakeInTime = newShake.decreaseShakeInTime;
|
||||
decreaseShakeSpeed = newShake.decreaseShakeSpeed;
|
||||
|
||||
useDelayBeforeStartDecrease = newShake.useDelayBeforeStartDecrease;
|
||||
delayBeforeStartDecrease = newShake.delayBeforeStartDecrease;
|
||||
|
||||
repeatShake = newShake.repeatShake;
|
||||
numberOfRepeats = newShake.numberOfRepeats;
|
||||
delayBetweenRepeats = newShake.delayBetweenRepeats;
|
||||
|
||||
externalShakeDelay = newShake.externalShakeDelay;
|
||||
|
||||
useUnscaledTime = newShake.useUnscaledTime;
|
||||
}
|
||||
|
||||
public externalShakeInfo ()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c3a997b6c44b057409b6311ab9163557
|
||||
timeCreated: 1514422036
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Camera/Player Camera/externalShakeInfo.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,23 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
[System.Serializable]
|
||||
public class externalShakeInfoListElement
|
||||
{
|
||||
public string name;
|
||||
public bool sameValueBothViews;
|
||||
public bool useDamageShakeInThirdPerson;
|
||||
public externalShakeInfo thirdPersonDamageShake;
|
||||
public bool useDamageShakeInFirstPerson;
|
||||
public externalShakeInfo firstPersonDamageShake;
|
||||
|
||||
public externalShakeInfoListElement (externalShakeInfoListElement newExternalShake)
|
||||
{
|
||||
name = newExternalShake.name;
|
||||
sameValueBothViews = newExternalShake.sameValueBothViews;
|
||||
useDamageShakeInThirdPerson = newExternalShake.useDamageShakeInThirdPerson;
|
||||
thirdPersonDamageShake = newExternalShake.thirdPersonDamageShake;
|
||||
useDamageShakeInFirstPerson = newExternalShake.useDamageShakeInFirstPerson;
|
||||
firstPersonDamageShake = newExternalShake.firstPersonDamageShake;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8eaa54e0a0210534a8eedd78c76b4bde
|
||||
timeCreated: 1514422143
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Camera/Player Camera/externalShakeInfoListElement.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,83 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class externalShakeListManager : MonoBehaviour
|
||||
{
|
||||
public List<externalShakeInfoListElement> externalShakeInfoList = new List<externalShakeInfoListElement> ();
|
||||
|
||||
|
||||
|
||||
public const string mainManagerName = "External Shake List Manager";
|
||||
|
||||
public static string getMainManagerName ()
|
||||
{
|
||||
return mainManagerName;
|
||||
}
|
||||
|
||||
private static externalShakeListManager _externalShakeListManagerInstance;
|
||||
|
||||
public static externalShakeListManager Instance { get { return _externalShakeListManagerInstance; } }
|
||||
|
||||
bool instanceInitialized;
|
||||
|
||||
|
||||
public void getComponentInstance ()
|
||||
{
|
||||
if (instanceInitialized) {
|
||||
// print ("already initialized manager");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (_externalShakeListManagerInstance != null && _externalShakeListManagerInstance != this) {
|
||||
Destroy (this.gameObject);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_externalShakeListManagerInstance = this;
|
||||
|
||||
instanceInitialized = true;
|
||||
}
|
||||
|
||||
void Awake ()
|
||||
{
|
||||
getComponentInstance ();
|
||||
}
|
||||
|
||||
public void setShakeInManagerList (externalShakeInfoListElement element, int index)
|
||||
{
|
||||
externalShakeInfoList [index] = element;
|
||||
}
|
||||
|
||||
public void udpateAllHeadbobShakeList ()
|
||||
{
|
||||
headBob[] headBobList = FindObjectsOfType<headBob> ();
|
||||
foreach (headBob bob in headBobList) {
|
||||
bob.updateExternalShakeInfoList (externalShakeInfoList);
|
||||
}
|
||||
|
||||
print ("All head bob in the scene have been updated with the current shake list");
|
||||
}
|
||||
|
||||
public void setExternalShakeStateByIndex (int index, bool isFirstPerson)
|
||||
{
|
||||
externalShakeInfoListElement newShake = externalShakeInfoList [index];
|
||||
|
||||
headBob[] headBobList = FindObjectsOfType<headBob> ();
|
||||
|
||||
int headBobListLength = headBobList.Length;
|
||||
|
||||
for (int i = 0; i < headBobListLength; i++) {
|
||||
headBob bob = headBobList [i];
|
||||
|
||||
if (isFirstPerson) {
|
||||
bob.setExternalShakeState (newShake.firstPersonDamageShake);
|
||||
|
||||
} else {
|
||||
bob.setExternalShakeState (newShake.thirdPersonDamageShake);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0082f82322be03b4bad60878294b4c92
|
||||
timeCreated: 1514421539
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Camera/Player Camera/externalShakeListManager.cs
|
||||
uploadId: 814740
|
||||
1053
Assets/Game Kit Controller/Scripts/Camera/Player Camera/headBob.cs
Normal file
1053
Assets/Game Kit Controller/Scripts/Camera/Player Camera/headBob.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,17 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39f970c91f016c04a87e392c873240f1
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Camera/Player Camera/headBob.cs
|
||||
uploadId: 814740
|
||||
10066
Assets/Game Kit Controller/Scripts/Camera/Player Camera/playerCamera.cs
Normal file
10066
Assets/Game Kit Controller/Scripts/Camera/Player Camera/playerCamera.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d355886559d8f547bb1a1a0c0560b1c
|
||||
timeCreated: 1469551980
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Camera/Player Camera/playerCamera.cs
|
||||
uploadId: 814740
|
||||
@@ -0,0 +1,121 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class setCameraFOVValue : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public bool cameraFOVChangeEnabled = true;
|
||||
|
||||
public float changeFOVAmount = 0.4f;
|
||||
|
||||
public Vector2 FOVClampValue;
|
||||
|
||||
[Space]
|
||||
|
||||
public bool getMainPlayerCameraOnScene;
|
||||
|
||||
[Space]
|
||||
[Header ("Debug")]
|
||||
[Space]
|
||||
|
||||
public bool mainCameraLocated;
|
||||
|
||||
public bool showDebugPrint;
|
||||
|
||||
[Space]
|
||||
[Header ("Components")]
|
||||
[Space]
|
||||
|
||||
public Camera mainCamera;
|
||||
|
||||
|
||||
public void enableOrDisableCameraFOVChange (bool state)
|
||||
{
|
||||
cameraFOVChangeEnabled = state;
|
||||
}
|
||||
|
||||
public void increaseFov ()
|
||||
{
|
||||
if (!cameraFOVChangeEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
changeFOV (1);
|
||||
}
|
||||
|
||||
public void decreaseFOV ()
|
||||
{
|
||||
if (!cameraFOVChangeEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
changeFOV (-1);
|
||||
}
|
||||
|
||||
void changeFOV (float changeDirection)
|
||||
{
|
||||
checkMainCameraLocated ();
|
||||
|
||||
if (!mainCameraLocated) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainCamera.fieldOfView += (changeFOVAmount * changeDirection);
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("setting FOV value to " + mainCamera.fieldOfView);
|
||||
}
|
||||
|
||||
clampFOVValue ();
|
||||
}
|
||||
|
||||
public void setCameraFOV (float newValue)
|
||||
{
|
||||
checkMainCameraLocated ();
|
||||
|
||||
if (!mainCameraLocated) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainCamera.fieldOfView = newValue;
|
||||
|
||||
clampFOVValue ();
|
||||
}
|
||||
|
||||
void clampFOVValue ()
|
||||
{
|
||||
mainCamera.fieldOfView = Mathf.Clamp (mainCamera.fieldOfView, FOVClampValue.x, FOVClampValue.y);
|
||||
}
|
||||
|
||||
public void setFOVClampValueX (float newValue)
|
||||
{
|
||||
FOVClampValue.x = newValue;
|
||||
}
|
||||
|
||||
public void setFOVClampValueY (float newValue)
|
||||
{
|
||||
FOVClampValue.y = newValue;
|
||||
}
|
||||
|
||||
void checkMainCameraLocated ()
|
||||
{
|
||||
if (!mainCameraLocated) {
|
||||
mainCameraLocated = mainCamera != null;
|
||||
|
||||
if (!mainCameraLocated && getMainPlayerCameraOnScene) {
|
||||
playerCamera mainPlayerCamera = GKC_Utils.findMainPlayerCameraOnScene ();
|
||||
|
||||
if (mainPlayerCamera != null) {
|
||||
mainCamera = mainPlayerCamera.getMainCamera ();
|
||||
} else {
|
||||
mainCamera = Camera.main;
|
||||
}
|
||||
|
||||
mainCameraLocated = mainCamera != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 726d4c2371a49214cb814b25928188eb
|
||||
timeCreated: 1589092547
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Camera/Player Camera/setCameraFOVValue.cs
|
||||
uploadId: 814740
|
||||
Reference in New Issue
Block a user