先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
52 lines
1.2 KiB
C#
52 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
|
|
namespace URPWater
|
|
{
|
|
[RequireComponent(typeof(URPWaterDynamicEffects))]
|
|
public class URPWaterFollowTarget : MonoBehaviour
|
|
{
|
|
|
|
[SerializeField]
|
|
[Tooltip("Transform of the object that the Dynamic Effect Capture should follow.")]
|
|
private Transform _Target = null;
|
|
|
|
[SerializeField]
|
|
[Tooltip("Offset Y position of the Target.")]
|
|
private float _YOffset = 0f;
|
|
|
|
private URPWaterDynamicEffects _DynamicEffect;
|
|
|
|
|
|
void OnEnable()
|
|
{
|
|
if(_Target == null)
|
|
{
|
|
enabled = false;
|
|
return;
|
|
}
|
|
|
|
if(_DynamicEffect == null)
|
|
{
|
|
_DynamicEffect = GetComponent<URPWaterDynamicEffects>();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
void Update()
|
|
{
|
|
|
|
if(_Target != null && _DynamicEffect != null)
|
|
{
|
|
var newPos = _Target.position;
|
|
newPos.y += _DynamicEffect.CaptureDistance * 0.5f;
|
|
newPos.y += _YOffset;
|
|
|
|
transform.position = newPos;
|
|
}
|
|
}
|
|
}
|
|
} |