init
This commit is contained in:
commit
16da8e4dde
333 changed files with 109229 additions and 0 deletions
8
Assets/Tools/Cinemachine.meta
Normal file
8
Assets/Tools/Cinemachine.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5a2ff5ceb779d824d811d139fa608262
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
40
Assets/Tools/Cinemachine/ScreenShake.cs
Normal file
40
Assets/Tools/Cinemachine/ScreenShake.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using Cinemachine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public static class ScreenShake{
|
||||
|
||||
static CinemachineBrain brain;
|
||||
static CinemachineVirtualCamera vCam;
|
||||
static ScreenShakeUpdate shakeUpdate;
|
||||
|
||||
class ScreenShakeUpdate : MonoBehaviour {
|
||||
[HideInInspector] public float shakeTimer;
|
||||
[HideInInspector] public float shakeTimerTotal;
|
||||
[HideInInspector] public float startingIntensity;
|
||||
|
||||
void Update(){
|
||||
if (shakeTimer > 0){
|
||||
shakeTimer -= Time.deltaTime;
|
||||
CinemachineBasicMultiChannelPerlin multiChannelPerlin = vCam.GetCinemachineComponent<CinemachineBasicMultiChannelPerlin>();
|
||||
multiChannelPerlin.m_AmplitudeGain = Mathf.Lerp(startingIntensity, 0f, 1 - (shakeTimer / shakeTimerTotal));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Shake(float intensity, float time){
|
||||
if(brain == null || shakeUpdate == null){
|
||||
brain = Camera.main.GetComponent<CinemachineBrain>();
|
||||
vCam = Camera.main.GetComponent<CinemachineBrain>().ActiveVirtualCamera.VirtualCameraGameObject.GetComponent<CinemachineVirtualCamera>();
|
||||
shakeUpdate = new GameObject("ShakeUpdate").AddComponent<ScreenShakeUpdate>();
|
||||
}
|
||||
|
||||
CinemachineVirtualCamera currentCam = brain.ActiveVirtualCamera.VirtualCameraGameObject.GetComponent<CinemachineVirtualCamera>();
|
||||
if (vCam == null || vCam != currentCam){
|
||||
vCam = currentCam;
|
||||
}
|
||||
shakeUpdate.startingIntensity = 2.5f;
|
||||
shakeUpdate.shakeTimer = shakeUpdate.shakeTimerTotal = .25f;
|
||||
}
|
||||
}
|
11
Assets/Tools/Cinemachine/ScreenShake.cs.meta
Normal file
11
Assets/Tools/Cinemachine/ScreenShake.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 181034c7ad5ece241a2737ab35d47c5c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue