public void PlayAnimationTrigger(CharacterParams param) { this.StopAnimation(); base.gameObject.SetActive(true); if (this._target == CharacterTarget.CharacterCenter) { this._PlayAnimation = base.PlayAnimation(param.characterCenterTarget, param.RootToCenterDistance()); } else if (this._target == CharacterTarget.CharacterFaceCenter) { this._PlayAnimation = base.PlayAnimation(param.characterFaceCenterTarget, param.RootToCenterDistance()); } else if (this._target == CharacterTarget.CharacterRoot) { this._PlayAnimation = base.PlayAnimation(param.transform, param.RootToCenterDistance()); } else { this._PlayAnimation = base.PlayAnimation(null, param.RootToCenterDistance()); } this.CharacterFollowingInitializeInternal(param); this.cachedCharacter = param; base.StartCoroutine(this._PlayAnimation); this._scale = this.cachedCharacter.effectScale; base.transform.localScale = Vector3.one; base.transform.localScale *= this._scale; foreach (ParticleSystem particles in this._particleSystems) { ParticleScaler.Scale(particles, this._scale, true, null); } }
protected virtual void StopAnimationInternal() { if (this._effectAnimation != null && this._effectAnimation.isPlaying) { this._effectAnimation.Stop(); this._effectAnimation[this._effectAnimation.clip.name].time = this._effectAnimation[this._effectAnimation.clip.name].length; } foreach (ParticleController particleController in this._particleControllers) { particleController.ClearParticle(); } this._isPlaying = false; float scale = 1f / this._scale; base.transform.localScale = Vector3.one; foreach (ParticleSystem particles in this._particleSystems) { ParticleScaler.Scale(particles, scale, true, null); } }
public static void Scale(this ParticleSystem particles, float scale, bool includeChildren = true) { ParticleScaler.Scale(particles, scale, includeChildren, null); }
private IEnumerator PlaySkillAnimationInternal(CharacterParams attacker) { if (attacker != null) { if (this._cameraMotionId.Length > 0) { this.SetPosition(attacker.transform, null); } else { this.SetPosition(attacker.transform, new Vector3?(attacker.dropItemOffsetPosition)); } } this.StopAnimationInternal(); this._isPlaying = true; this.currentStageColor = Color.black; if (this._renderCamera != null) { this.currentStageColor = this._renderCamera.backgroundColor; if (this._hideStage) { if (this._lightColorChanger != null) { this._lightColorChanger.isEnable = false; this.currentSunLightColor = this._lightColorChanger.light.color; this._lightColorChanger.light.color = this._hideStageLightColor; this.currentSunLightRotation = this._lightColorChanger.light.transform.rotation; this._lightColorChanger.light.transform.rotation = Quaternion.Euler(this._hideStageLightEulerAngles); } if (this._stageObject != null) { this._stageObject.SetActive(false); } this._renderCamera.backgroundColor = this._hideStageBackgroundColor; } } this._effectAnimation.clip.wrapMode = WrapMode.Once; this._effectAnimation[this._effectAnimation.clip.name].time = 0f; this._effectAnimation.PlayQueued(this._effectAnimation.clip.name, QueueMode.PlayNow); if (attacker != null && attacker.GetFindAttackMotion(this._motionIndex)) { attacker.PlayAnimation(CharacterAnimationType.attacks, this._attackAnimationType, this._motionIndex, null, null); this.CharacterFollowingInitializeInternal(attacker); this.BillboardObjectInitializeInternal(attacker.transform, attacker.RootToCenterDistance()); this.ParticheControllerInitializeInternal(); } if (this._cameraMotionId.Length == 0) { this._scale = attacker.effectScale; base.transform.localScale = Vector3.one; base.transform.localScale *= this._scale; foreach (ParticleSystem particles in this._particleSystems) { ParticleScaler.Scale(particles, this._scale, true, null); } } if (this._attackAnimationType == SkillType.InheritanceTechnique) { float motionTime = (!(attacker != null)) ? 0f : attacker.AnimationClipLength; float effectTime = this._effectAnimation[this._effectAnimation.clip.name].length; float time = Mathf.Max(motionTime, effectTime); while (time > 0f) { time -= Time.deltaTime; if (!this._effectAnimation.isPlaying && this._effectAnimation.gameObject.activeInHierarchy) { this._effectAnimation.gameObject.SetActive(false); } yield return(null); } this._effectAnimation.gameObject.SetActive(true); } else { while (this._effectAnimation.isPlaying) { yield return(null); } } yield break; }