浏览代码

[Bot] Automated dotnet-format update

/main
treivize 4 年前
当前提交
c978e5d4
共有 2 个文件被更改,包括 23 次插入23 次删除
  1. 36
      UOP1_Project/Assets/Scripts/Effects/DissolveHelper.cs
  2. 10
      UOP1_Project/Assets/Scripts/Effects/VFXUtil.cs

36
UOP1_Project/Assets/Scripts/Effects/DissolveHelper.cs


public class DissolveHelper : MonoBehaviour
{
[SerializeField] ParticleSystem _dissolveParticlesPrefab;
[SerializeField] ParticleSystem _dissolveParticlesPrefab;
[SerializeField] float _dissolveDuration = 1f;
private MeshRenderer _renderer;

[ContextMenu("Trigger Dissolve")]
public void TriggerDissolve()
{
public void TriggerDissolve()
{
if (_materialPropertyBlock == null)
{
_materialPropertyBlock = new MaterialPropertyBlock();

}
}
[ContextMenu("Reset Dissolve")]
private void ResetDissolve()

}
private void InitParticleSystem()
{
{
_particules = GameObject.Instantiate(_dissolveParticlesPrefab, transform);
_renderer = GetComponent<MeshRenderer>();

ParticleSystem.MainModule mainModule = _particules.main;
mainModule.duration = _dissolveDuration;
}
}
public IEnumerator DissolveCoroutine()
{
float normalizedDeltaTime = 0;
public IEnumerator DissolveCoroutine()
{
float normalizedDeltaTime = 0;
while(normalizedDeltaTime < _dissolveDuration)
{
normalizedDeltaTime += Time.deltaTime;
float remappedValue = VFXUtil.RemapValue(normalizedDeltaTime, 0, _dissolveDuration, 0, 1);
_materialPropertyBlock.SetFloat("_Dissolve", remappedValue);
_renderer.SetPropertyBlock(_materialPropertyBlock);
while (normalizedDeltaTime < _dissolveDuration)
{
normalizedDeltaTime += Time.deltaTime;
float remappedValue = VFXUtil.RemapValue(normalizedDeltaTime, 0, _dissolveDuration, 0, 1);
_materialPropertyBlock.SetFloat("_Dissolve", remappedValue);
_renderer.SetPropertyBlock(_materialPropertyBlock);
yield return null;
}
yield return null;
}
}
}
}

10
UOP1_Project/Assets/Scripts/Effects/VFXUtil.cs



public class VFXUtil
{
public static float RemapValue(float value, float low1, float high1, float low2, float high2)
{
float x = low2 + (value - low1) * (high2 - low2) / (high1 - low1);
return x;
}
public static float RemapValue(float value, float low1, float high1, float low2, float high2)
{
float x = low2 + (value - low1) * (high2 - low2) / (high1 - low1);
return x;
}
}
正在加载...
取消
保存