示例#1
0
        /// <summary>
        /// 指定された場所に指定された設定で3Dのメッセージを表示する
        /// </summary>
        public void ShowMessage3D(string message, Vector3 position, Quaternion rotation, Transform parent, FontSettings settings)
        {
            AbstractTextMesh text = textMeshPool.GetInstance();

            InitializeTextMesh(text, message, settings);

            text.transform.SetParent(parent);
            text.transform.SetPositionAndRotation(position, rotation);

            StartCoroutine(settings.showAnimation.GetAnimation(text, settings.showAnimationTime).OnCompleted(() =>
            {
                if (settings.limitLife <= 0.0f)
                {
                    StartCoroutine(settings.hideAnimation.GetAnimation(text, settings.hideAnimationTime).OnCompleted(() =>
                    {
                        textMeshPool.ReturnInstance(text);
                    }));
                }
                else
                {
                    KKUtilities.Delay(settings.limitLife, () =>
                    {
                        StartCoroutine(settings.hideAnimation.GetAnimation(text, settings.hideAnimationTime).OnCompleted(() =>
                        {
                            textMeshPool.ReturnInstance(text);
                        }));
                    }, this);
                }
            }));
        }
示例#2
0
        //3D座標を指定するUGUIの場合は親を設定するメリットがないので用意しない
        /// <summary>
        /// 指定された場所に指定された設定でUGUIのメッセージを表示する
        /// </summary>
        public void ShowMessage(string message, Vector3 position, Quaternion rotation, FontSettings settings)
        {
            AbstractUGUIText text = textPool.GetInstance();

            text.transform.SetPositionAndRotation(uiCamera.WorldToScreenPoint(position), rotation);

            InitializeUGUIText(text, message, settings);

            StartCoroutine(settings.showAnimation.GetAnimation(text, settings.showAnimationTime).OnCompleted(() =>
            {
                if (settings.limitLife <= 0.0f)
                {
                    StartCoroutine(settings.hideAnimation.GetAnimation(text, settings.hideAnimationTime).OnCompleted(() =>
                    {
                        textPool.ReturnInstance(text);
                    }));
                }
                else
                {
                    KKUtilities.Delay(settings.limitLife, () =>
                    {
                        StartCoroutine(settings.hideAnimation.GetAnimation(text, settings.hideAnimationTime).OnCompleted(() =>
                        {
                            textPool.ReturnInstance(text);
                        }));
                    }, this);
                }
            }));
        }
示例#3
0
        /// <summary>
        /// 指定された場所に指定された設定でUGUIのメッセージを表示する
        /// </summary>
        public void ShowMessage(string message, Vector2 localPosition, Quaternion localRotation, Transform parent, FontSettings settings)
        {
            AbstractUGUIText text = textPool.GetInstance();

            InitializeUGUIText(text, message, settings);
            text.RectTransform.SetParent(parent);
            text.RectTransform.anchoredPosition = localPosition;
            text.RectTransform.localRotation    = localRotation;


            StartCoroutine(settings.showAnimation.GetAnimation(text, settings.showAnimationTime).OnCompleted(() =>
            {
                if (settings.limitLife <= 0.0f)
                {
                    StartCoroutine(settings.hideAnimation.GetAnimation(text, settings.hideAnimationTime).OnCompleted(() =>
                    {
                        textPool.ReturnInstance(text);
                    }));
                }
                else
                {
                    KKUtilities.Delay(settings.limitLife, () =>
                    {
                        StartCoroutine(settings.hideAnimation.GetAnimation(text, settings.hideAnimationTime).OnCompleted(() =>
                        {
                            textPool.ReturnInstance(text);
                        }));
                    }, this);
                }
            }));
        }
示例#4
0
        public PoolMonoBehaviour Play(string name, Vector3 position, float limitLife, Transform parent)
        {
            PoolMonoBehaviour spriteAnimation = Play(name, position, parent);

            KKUtilities.Delay(limitLife, () => spriteAnimation.gameObject.SetActive(false), this);

            return(spriteAnimation);
        }
        /// <summary>
        /// 指定された地点にパーティクルを配置し、limitLife秒後にactiveをfalseにする
        /// </summary>
        public PoolMonoBehaviour Play(string name, Vector3 localPosition, Quaternion localRotation, float limitLife, Transform parent)
        {
            PoolMonoBehaviour particle = Play(name, localPosition, localRotation, parent);

            KKUtilities.Delay(limitLife, () => particle.gameObject.SetActive(false), this);

            return(particle);
        }
        /// <summary>
        /// 指定された地点にパーティクルを配置し、limitLife秒後にactiveをfalseにする
        /// </summary>
        public PoolMonoBehaviour Play(string name, Vector3 position, Quaternion rotation, float limitLife)
        {
            PoolMonoBehaviour particle = Play(name, position, rotation);

            KKUtilities.Delay(limitLife, () => particle.gameObject.SetActive(false), this);

            return(particle);
        }
示例#7
0
        //loopするSEを鳴らしたい場合は止める条件を設定する
        public void LoopPlay(AudioClip clip, float limitLife, Action callback, float volume = 1.0f, float pitch = 1.0f)
        {
            Source.loop = true;
            Play(clip, volume, pitch);

            KKUtilities.Delay(limitLife, () =>
            {
                Source.Stop();
                if (callback != null)
                {
                    callback.Invoke();
                }
            }, this);
        }
        /// <summary>
        /// 指定された地点に瞬間的なパーティクルを再生する
        /// </summary>
        public void PlayOneShot(string name, Vector3 position, Quaternion rotation, Transform parent)
        {
            MomentParticle particle = GetMomentParticle(name);

            if (particle == null)
            {
                return;
            }

            particle.transform.SetPositionAndRotation(position, rotation);
            particle.transform.SetParent(parent);
            particle.Play();

            KKUtilities.Delay(0.1f, () => particle.transform.SetParent(transform), this);
        }
        /// <summary>
        /// 指定された地点に瞬間的なパーティクルを再生する
        /// </summary>
        public void PlayOneShot(string name, Vector3 position, Quaternion rotation, Color color, Transform parent)
        {
            MomentParticle particle = GetMomentParticle(name);

            if (particle == null)
            {
                return;
            }

            particle.transform.SetPositionAndRotation(position, rotation);
            particle.transform.SetParent(parent);

            var main         = particle.ParticleSystem.main;
            var defaultColor = main.startColor;

            main.startColor = color;
            particle.Play();
            main.startColor = defaultColor;

            KKUtilities.Delay(main.duration, () => particle.transform.SetParent(transform), this);
        }
示例#10
0
 /// <summary>
 /// duration秒後にactionを実行する
 /// </summary>
 public static Coroutine Delay(this MonoBehaviour mono, float duration, Action action, bool isScalable = true)
 {
     return(mono.StartCoroutine(KKUtilities.Delay(duration, action, isScalable)));
 }