You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
130 lines
3.9 KiB
130 lines
3.9 KiB
using System;
|
|
using UnityEngine;
|
|
|
|
namespace MU3
|
|
{
|
|
// Token: 0x02000739 RID: 1849
|
|
public class MotionEffectInstance
|
|
{
|
|
// Token: 0x06002FB3 RID: 12211 RVA: 0x000FE618 File Offset: 0x000FE618
|
|
public MotionEffectInstance(MotionEffectDefine effectDefine, MotionEffectBase effectInstance)
|
|
{
|
|
this.effectDefine = effectDefine;
|
|
this._effectInstance = effectInstance;
|
|
if (effectDefine.isSetPosition)
|
|
{
|
|
this._effectInstance.setPosition(effectDefine.positionToFollow);
|
|
}
|
|
if (effectDefine.isSetRotation)
|
|
{
|
|
this._effectInstance.setRotation(effectDefine.rotationToFollow);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06002FB4 RID: 12212 RVA: 0x000FE674 File Offset: 0x000FE674
|
|
public static MotionEffectInstance create(MotionEffectDefine effectDefine)
|
|
{
|
|
MotionEffectInstance result = null;
|
|
GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(effectDefine.prefab);
|
|
if (gameObject != null)
|
|
{
|
|
ParticleSystem componentInChildren = gameObject.GetComponentInChildren<ParticleSystem>();
|
|
if (componentInChildren != null)
|
|
{
|
|
MotionEffectShuriken motionEffectShuriken = new MotionEffectShuriken();
|
|
motionEffectShuriken.initialize(gameObject);
|
|
result = new MotionEffectInstance(effectDefine, motionEffectShuriken);
|
|
}
|
|
else
|
|
{
|
|
MotionEffectSimple motionEffectSimple = new MotionEffectSimple();
|
|
motionEffectSimple.initialize(gameObject);
|
|
result = new MotionEffectInstance(effectDefine, motionEffectSimple);
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// Token: 0x06002FB5 RID: 12213 RVA: 0x000FE6E4 File Offset: 0x000FE6E4
|
|
public void play()
|
|
{
|
|
this._effectInstance.start();
|
|
this.isPlaying = true;
|
|
}
|
|
|
|
// Token: 0x06002FB6 RID: 12214 RVA: 0x000FE6F8 File Offset: 0x000FE6F8
|
|
public void stop()
|
|
{
|
|
this._effectInstance.stop();
|
|
this.isPlaying = false;
|
|
}
|
|
|
|
// Token: 0x06002FB7 RID: 12215 RVA: 0x000FE70C File Offset: 0x000FE70C
|
|
public void destroy()
|
|
{
|
|
this._effectInstance.destroy();
|
|
this.isDestroyed = true;
|
|
this.isPlaying = false;
|
|
}
|
|
|
|
// Token: 0x06002FB8 RID: 12216 RVA: 0x000FE728 File Offset: 0x000FE728
|
|
public void execute()
|
|
{
|
|
this._duration += Time.deltaTime;
|
|
if (this.effectDefine.isFollow)
|
|
{
|
|
if (this.effectDefine.isSetPosition)
|
|
{
|
|
this._effectInstance.setPosition(this.effectDefine.positionToFollow);
|
|
}
|
|
if (this.effectDefine.isSetRotation)
|
|
{
|
|
this._effectInstance.setRotation(this.effectDefine.rotationToFollow);
|
|
}
|
|
}
|
|
if (this.isPlaying && this._duration > this.effectDefine.minimumLife && this._effectInstance.isFinished())
|
|
{
|
|
this.destroy();
|
|
}
|
|
else if (this.effectDefine.isDestoryByScale && this.effectDefine.scaleTransform != null)
|
|
{
|
|
if (this.effectDefine.scaleTransform.lossyScale.magnitude * 0.57735026f < this.effectDefine.scaleThreashold)
|
|
{
|
|
this._isOnceBelowScaleThreashold = true;
|
|
}
|
|
else if (this._isOnceBelowScaleThreashold)
|
|
{
|
|
this.destroy();
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000702 RID: 1794
|
|
// (get) Token: 0x06002FB9 RID: 12217 RVA: 0x000FE850 File Offset: 0x000FE850
|
|
// (set) Token: 0x06002FBA RID: 12218 RVA: 0x000FE858 File Offset: 0x000FE858
|
|
public MotionEffectDefine effectDefine { get; private set; }
|
|
|
|
// Token: 0x17000703 RID: 1795
|
|
// (get) Token: 0x06002FBB RID: 12219 RVA: 0x000FE864 File Offset: 0x000FE864
|
|
// (set) Token: 0x06002FBC RID: 12220 RVA: 0x000FE86C File Offset: 0x000FE86C
|
|
public bool isPlaying { get; private set; }
|
|
|
|
// Token: 0x17000704 RID: 1796
|
|
// (get) Token: 0x06002FBD RID: 12221 RVA: 0x000FE878 File Offset: 0x000FE878
|
|
// (set) Token: 0x06002FBE RID: 12222 RVA: 0x000FE880 File Offset: 0x000FE880
|
|
public bool isDestroyed { get; private set; }
|
|
|
|
// Token: 0x04005537 RID: 21815
|
|
private const float ScaleCoeff = 0.57735026f;
|
|
|
|
// Token: 0x0400553B RID: 21819
|
|
private MotionEffectBase _effectInstance;
|
|
|
|
// Token: 0x0400553C RID: 21820
|
|
private float _duration;
|
|
|
|
// Token: 0x0400553D RID: 21821
|
|
private bool _isOnceBelowScaleThreashold;
|
|
}
|
|
}
|