浏览代码

Merge remote-tracking branch 'davidhenshaw/main' into pr-bash

/devlogs-3-input
Ciro Continisio 4 年前
当前提交
48a39328
共有 3 个文件被更改,包括 66 次插入1 次删除
  1. 16
      UOP1_Project/Assets/Prefabs/Characters/PigChef.prefab
  2. 18
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/PlayLandParticlesActionSO.cs
  3. 33
      UOP1_Project/Assets/Scripts/Effects/DustParticlesController.cs

16
UOP1_Project/Assets/Prefabs/Characters/PigChef.prefab


extraActionInput: 0
movementInput: {x: 0, y: 0, z: 0}
movementVector: {x: 0, y: 0, z: 0}
isRunning: 0
--- !u!114 &6243045328629046901
MonoBehaviour:
m_ObjectHideFlags: 0

type: 3}
propertyPath: m_Name
value: LandingParticle
objectReference: {fileID: 0}
- target: {fileID: 8442424470799517435, guid: 2a17d00f8cddbf44ea0f55e00cbc97e9,
type: 3}
propertyPath: InitialModule.startSize.scalar
value: 0.2
objectReference: {fileID: 0}
- target: {fileID: 8442424470799517435, guid: 2a17d00f8cddbf44ea0f55e00cbc97e9,
type: 3}
propertyPath: InitialModule.startSize.minScalar
value: 0.03
objectReference: {fileID: 0}
- target: {fileID: 8442424470799517435, guid: 2a17d00f8cddbf44ea0f55e00cbc97e9,
type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.scalar
value: 7
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2a17d00f8cddbf44ea0f55e00cbc97e9, type: 3}

18
UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/PlayLandParticlesActionSO.cs


{
//Component references
private DustParticlesController _dustController;
private Transform _transform;
private float _fallStartY = 0;
private float _fallEndY = 0;
private float _maxFallDistance = 4; //Used to adjust particle emission intensity
_transform = stateMachine.transform;
}
public override void OnStateEnter()
{
_fallStartY = _transform.position.y;
_fallEndY = _transform.position.y;
float dY = Mathf.Abs(_fallStartY - _fallEndY);
float fallIntensity = Mathf.InverseLerp(0, _maxFallDistance, dY);
_dustController.PlayLandParticles();
//_dustController.PlayLandParticles();
_dustController.PlayLandParticles(fallIntensity);
t = Time.time;
}
}

33
UOP1_Project/Assets/Scripts/Effects/DustParticlesController.cs


{
_landParticles.Play();
}
public void PlayLandParticles(float intensity)
{
// make sure intensity is always between 0 and 1
intensity = Mathf.Clamp01(intensity);
var main = _landParticles.main;
var origCurve = main.startSize; //save original curve to be assigned back to particle system
ParticleSystem.MinMaxCurve newCurve = main.startSize; //Make a new minMax curve and make our changes to the new copy
float minSize = newCurve.constantMin;
float maxSize = newCurve.constantMax;
// use the intensity to change the maximum size of the particle curve
newCurve.constantMax = Mathf.Lerp(minSize, maxSize, intensity);
main.startSize = newCurve;
_landParticles.Play();
// Put the original startSize back where you found it
StartCoroutine(ResetMinMaxCurve(_landParticles, origCurve));
}
private IEnumerator ResetMinMaxCurve(ParticleSystem ps, ParticleSystem.MinMaxCurve curve)
{
while (ps.isEmitting)
{
yield return null;
}
var main = ps.main;
main.startSize = curve;
}
}
正在加载...
取消
保存