Пример #1
0
        private void OnAnimationEventTriggered(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frameIndex)
        {
            animator.AnimationEventTriggered -= OnAnimationEventTriggered;

            tk2dSpriteAnimationFrame frame = clip.GetFrame(frameIndex);

            if (frame.eventInfo == AnimationTriggerDefs.SkillApply.ToString())
            {
                Vector3 startPoint = this.skillUIElement.transform.position;

                float degree = Mathf.Atan2(targetPosition.y - startPoint.y, targetPosition.x - startPoint.x) * Mathf.Rad2Deg;

                float angle = degree * Mathf.Deg2Rad;

                this.skillUIElement.Apply(owner, data, angle);

                for (int index = 0; index < shotAmount; index++)
                {
                    SkillUI skillUIElement = ResourceUtils.AddAndGetComponent <SkillUI>(GlobalDefinitions.RESOURCE_PATH_SKILL + data.resourceID);
                    skillUIElement.transform.SetParent(owner.componentsHolder.transform);
                    skillUIElement.IgnoreCollisionMap(true);
                    skillUIElement.transform.position   = startPoint;
                    skillUIElement.transform.localScale = Vector2.one;
                    angle = (degree - shotDegree * (index + 1)) * Mathf.Deg2Rad;
                    skillUIElement.Apply(owner, data, angle);
                }

                for (int index = 0; index < shotAmount; index++)
                {
                    skillUIElement = ResourceUtils.AddAndGetComponent <SkillUI>(GlobalDefinitions.RESOURCE_PATH_SKILL + data.resourceID);
                    skillUIElement.transform.SetParent(owner.componentsHolder.transform);
                    skillUIElement.IgnoreCollisionMap(true);
                    skillUIElement.transform.position   = startPoint;
                    skillUIElement.transform.localScale = Vector2.one;
                    angle = (degree + shotDegree * (index + 1)) * Mathf.Deg2Rad;
                    skillUIElement.Apply(owner, data, angle);
                }

                Destroy(this);

                this.skillUIElement = null;
            }
        }
Пример #2
0
        private void Fire()
        {
            for (int index = 0; index < meteorAmount; index++)
            {
                Vector2 position = (Random.insideUnitCircle * radius) + startPoint;

                SkillUI skillUIElement = ResourceUtils.AddAndGetComponent <SkillUI>(GlobalDefinitions.RESOURCE_PATH_SKILL + data.resourceID);
                skillUIElement.transform.position   = position;
                skillUIElement.transform.localScale = Vector3.one;
                skillUIElement.IgnoreCollisionMap(true);
                skillUIElement.Visible(false);
                skillUIElement.FadeIn(3.0f);
                skillUIElement.Apply(owner, data, -Mathf.PI / 6.0f);
            }
        }
Пример #3
0
        protected override IEnumerator RunProcessor()
        {
            yield return(base.RunProcessor());

            for (int index = 0; index < startPoints.Length; index++)
            {
                SkillUI skillUIElement = ResourceUtils.AddAndGetComponent <SkillUI>(GlobalDefinitions.RESOURCE_PATH_SKILL + data.resourceID);
                skillUIElement.transform.position   = startPoints[index];
                skillUIElement.transform.localScale = Vector3.one;
                skillUIElement.IgnoreCollisionMap(true);
                skillUIElement.Visible(false);
                skillUIElement.FadeIn(3.0f);
                skillUIElement.Apply(owner, data, 0);

                yield return(new WaitForSeconds(interval));
            }

            Cancel();
        }