public void InitEffectAnimation() { if (SplineEndAnimation != null) { EffectAnimationController eac = GameObjectPool.Instance.GetEffectAnimationQueue().Get(); eac.AnimationClip = SplineEndAnimation; EffectAnimationControllers.Add(eac); SplineMovement.onFinalPointUpdate += EffectAnimationControllers[0].MoveToPosition; onBehaviorStart += delegate(Effectable effectable, Vector2 vector2) { eac.PlayLoopingAnimation(); }; onBehaviorEnd += eac.StopEffectAnimation; } }
public PoolObjectQueue <EffectAnimationController> GetEffectAnimationQueue() { if (EffectAnimationPoolQueue.IsNullOrEmpty()) { GameObject eac = new GameObject(); eac.name = EffectAnimationController.DefaultName; eac.AddComponent <SpriteRenderer>(); eac.AddComponent <AnimancerComponent>(); eac.GetOrAddComponent <AnimationController>(); EffectAnimationController effectAnimationController = eac.GetOrAddComponent <EffectAnimationController>(); CreateNewObjectQueue <EffectAnimationController>(EffectAnimationPoolQueue, effectAnimationController); return(EffectAnimationPoolQueue[eac.name]); } return(EffectAnimationPoolQueue[EffectAnimationController.DefaultName]); }