mirror of
https://github.com/ApfelTeeSaft/Slender.git
synced 2026-09-03 03:53:42 +00:00
Complete Upgrade
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class SmoothFollow2D : MonoBehaviour
|
||||
{
|
||||
public Transform target;
|
||||
|
||||
public float smoothTime;
|
||||
|
||||
private Transform thisTransform;
|
||||
|
||||
private Vector2 velocity;
|
||||
|
||||
public SmoothFollow2D()
|
||||
{
|
||||
smoothTime = 0.3f;
|
||||
}
|
||||
|
||||
public virtual void Start()
|
||||
{
|
||||
thisTransform = transform;
|
||||
}
|
||||
|
||||
public virtual void Update()
|
||||
{
|
||||
float x = Mathf.SmoothDamp(thisTransform.position.x, target.position.x, ref velocity.x, smoothTime);
|
||||
Vector3 position = thisTransform.position;
|
||||
float num = (position.x = x);
|
||||
Vector3 vector = (thisTransform.position = position);
|
||||
float y = Mathf.SmoothDamp(thisTransform.position.y, target.position.y, ref velocity.y, smoothTime);
|
||||
Vector3 position2 = thisTransform.position;
|
||||
float num2 = (position2.y = y);
|
||||
Vector3 vector3 = (thisTransform.position = position2);
|
||||
}
|
||||
|
||||
public virtual void Main()
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user