1
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CameraMove : MonoBehaviour
|
||||
{
|
||||
private Transform player;
|
||||
void Start()
|
||||
{
|
||||
player = GameObject.FindGameObjectWithTag("Player").transform;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
//RaycastHit[] hits;
|
||||
|
||||
//hits = Physics.RaycastAll(ray, Mathf.Infinity, badMask);
|
||||
//for (int i = 0; i < hits.Length; i++)
|
||||
//{
|
||||
// Debug.Log(hits[i].collider.gameObject.name);
|
||||
//}
|
||||
//Debug.Log(hits.Length);
|
||||
|
||||
if (player!=null)
|
||||
{
|
||||
transform.position = new Vector3(player.position.x, player.position.y - 11, player.position.z);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 066236bbf8c0b6f4ab7929aa5dfec2bb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,63 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Cinemachine;
|
||||
|
||||
public class CameraVR : MonoBehaviour
|
||||
{
|
||||
private CinemachineVirtualCamera _cinemachineVirtualCamera;
|
||||
private CinemachineBasicMultiChannelPerlin _multiChannelPerlin;
|
||||
|
||||
//当前持续时间
|
||||
private float _shakeTime;
|
||||
//总时间
|
||||
private float _shakeTimeTotal;
|
||||
//强度
|
||||
private float _shakeIntensity;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
_cinemachineVirtualCamera = GetComponent<CinemachineVirtualCamera>();
|
||||
|
||||
_multiChannelPerlin = _cinemachineVirtualCamera.GetCinemachineComponent<CinemachineBasicMultiChannelPerlin>();
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (_shakeTime > 0)
|
||||
{
|
||||
_shakeTime -= Time.deltaTime;
|
||||
_multiChannelPerlin.m_AmplitudeGain = Mathf.Lerp(0, _shakeIntensity, _shakeTime / _shakeTimeTotal);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 抖动
|
||||
/// </summary>
|
||||
/// <param name="Time">抖动时间</param>
|
||||
/// <param name="Intensity">强度</param>
|
||||
public void ShakeCamera(float time, float intensity)
|
||||
{
|
||||
if (_cinemachineVirtualCamera != null)
|
||||
{
|
||||
_shakeTimeTotal = time;
|
||||
_shakeIntensity = intensity;
|
||||
|
||||
_shakeTime = _shakeTimeTotal;
|
||||
_multiChannelPerlin.m_AmplitudeGain = _shakeIntensity;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
Ray ray = new Ray(transform.position, transform.forward);
|
||||
Gizmos.color = Color.blue;
|
||||
|
||||
Gizmos.DrawRay(ray);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab12f70a05a6b764ca991a34facaca96
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,44 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Destructeable : MonoBehaviour
|
||||
{
|
||||
public GameObject destoryVFX;
|
||||
public GameObject big;
|
||||
public GameObject small;
|
||||
|
||||
private bool isDestory=false;
|
||||
public float reTiem = 5;
|
||||
|
||||
public void OnDestoryObject()
|
||||
{
|
||||
if (isDestory)
|
||||
return;
|
||||
if (destoryVFX != null)
|
||||
{
|
||||
Instantiate(destoryVFX,transform.position,transform.rotation);
|
||||
}
|
||||
|
||||
big.SetActive(false);
|
||||
SmallActive(true);
|
||||
isDestory = true;
|
||||
StartCoroutine(nameof(DestoryTime));
|
||||
}
|
||||
|
||||
IEnumerator DestoryTime()
|
||||
{
|
||||
yield return new WaitForSeconds(reTiem);
|
||||
big.SetActive(true);
|
||||
SmallActive(false);
|
||||
}
|
||||
|
||||
private void SmallActive(bool active)
|
||||
{
|
||||
if (small != null)
|
||||
{
|
||||
small.SetActive(active);
|
||||
isDestory = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 17918bd11b9ebbe4aa8f98fc6b565daa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user