private void OnAnimationEventTriggered(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frameIndex) { animator.AnimationEventTriggered -= OnAnimationEventTriggered; tk2dSpriteAnimationFrame frame = clip.GetFrame(frameIndex); if (frame.eventInfo == AnimationTriggerDefs.SkillApply.ToString()) { if (owner.componentsHolder.transform.localScale.x > 0f) { skillUIElement.Apply(owner, data, Mathf.PI); } else { skillUIElement.Apply(owner, data, 0); } GhostEffectScript ghost = skillUIElement.GetComponent <GhostEffectScript>(); ghost.StartEffect(); skillUIElement.OnDestroyed = () => { skillUIElement = null; Destroy(this); }; } }
IEnumerator WaitToGhostEffect(float time) { yield return(new WaitForSeconds(time)); GameObject instance = (GameObject)Instantiate(ghostEffect, transform.position, Quaternion.identity); gEffectScript = instance.GetComponent <GhostEffectScript>(); gEffectScript.spriteRenderer.color = spriteRenderer.color; gEffectScript.spriteRenderer.flipX = spriteRenderer.flipX; }