删除无用代码
This commit is contained in:
parent
147b1496ee
commit
05fb45511f
@ -1,55 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class SyncCameraPos : MonoBehaviour
|
|
||||||
{
|
|
||||||
public Transform actorTrans;
|
|
||||||
public Vector3 offsetPos;
|
|
||||||
private float speed = 2.5f;
|
|
||||||
private Func<Vector3> _getBattleCenterFunc = null;
|
|
||||||
|
|
||||||
public void SetFollowTarget(Transform actorTrans, Vector3 offsetPos)
|
|
||||||
{
|
|
||||||
this.actorTrans = actorTrans;
|
|
||||||
this.offsetPos = offsetPos;
|
|
||||||
transform.position = this.actorTrans.position + this.offsetPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetFollowTargetPos(Func<Vector3> getBattleCenterFunc, Vector3 offsetPos)
|
|
||||||
{
|
|
||||||
this._getBattleCenterFunc = getBattleCenterFunc;
|
|
||||||
//this.offsetPos = offsetPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
float horizontalSmooth = 0.1f;
|
|
||||||
float verticalSmooth = 0.05f;
|
|
||||||
void LateUpdate()
|
|
||||||
{
|
|
||||||
if(this.actorTrans != null)
|
|
||||||
{
|
|
||||||
var targetPos = this.actorTrans.position + this.offsetPos;
|
|
||||||
Vector3 newPos = transform.position;
|
|
||||||
newPos.x = Mathf.Lerp(newPos.x, targetPos.x, horizontalSmooth);
|
|
||||||
newPos.z = Mathf.Lerp(newPos.z, targetPos.z, horizontalSmooth);
|
|
||||||
newPos.y = Mathf.Lerp(newPos.y, targetPos.y, verticalSmooth);
|
|
||||||
transform.position = newPos;
|
|
||||||
//transform.position = targetPos;
|
|
||||||
//this.transform.position = Vector3.Lerp(transform.position, targetPosition,speed * Time.deltaTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_getBattleCenterFunc != null)
|
|
||||||
{
|
|
||||||
var pos = this._getBattleCenterFunc();
|
|
||||||
var targetPos = pos + this.offsetPos;
|
|
||||||
Vector3 newPos = transform.position;
|
|
||||||
newPos.x = Mathf.Lerp(newPos.x, targetPos.x, horizontalSmooth);
|
|
||||||
newPos.z = Mathf.Lerp(newPos.z, targetPos.z, horizontalSmooth);
|
|
||||||
newPos.y = Mathf.Lerp(newPos.y, targetPos.y, verticalSmooth);
|
|
||||||
transform.position = newPos;
|
|
||||||
//transform.position = targetPosition;
|
|
||||||
//this.transform.position = Vector3.Lerp(transform.position, targetPosition,speed * Time.deltaTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 3ec955241bba3bf49b62de5ada77c4f9
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
Loading…
x
Reference in New Issue
Block a user