mirror of
https://github.com/tym1116/BH3.git
synced 2025-12-12 22:44:35 +01:00
36 lines
829 B
C#
36 lines
829 B
C#
using UnityEngine;
|
|
|
|
namespace MoleMole
|
|
{
|
|
public class SizedPaster : Paster
|
|
{
|
|
[Header("Use targetTransform's Y position for Y sizing")]
|
|
public Transform TargetTransform;
|
|
|
|
[Header("Min/Max Heights")]
|
|
public float MinHeight = 1f;
|
|
|
|
public float MaxHeight = 4f;
|
|
|
|
private float _origSize;
|
|
|
|
protected override void Start()
|
|
{
|
|
base.transform.forward = Vector3.down;
|
|
base.Start();
|
|
_origSize = Size;
|
|
}
|
|
|
|
protected override void Update()
|
|
{
|
|
float num = ((!(TargetTransform.position.y < MinHeight)) ? TargetTransform.position.y : MinHeight);
|
|
Size = _origSize * Mathf.Lerp(1f, 0.4f, (num - MinHeight) / (MaxHeight - MinHeight));
|
|
Vector3 position = TargetTransform.position;
|
|
position.y = num;
|
|
base.transform.position = position;
|
|
base.transform.forward = Vector3.down;
|
|
base.Update();
|
|
}
|
|
}
|
|
}
|