Example #1
0
        public bool Play(string stateName, float time = 0.0f, float transitionTime = 0.3f)
        {
            if (!_stateManager.Exists(stateName))
            {
                DebugLog.Error($"EasyAnimationPlayable.Play : アニメーションステートが存在しないため再生できませんでした。{stateName}", DebugLogColor.animation);
                return(false);
            }

            _blendingName   = string.Empty;
            _transitionTime = transitionTime;

            foreach (var state in _stateManager.states)
            {
                state.originWeight = state.weight;

                if (state.StateName == stateName)
                {
                    state.destinationWeight = 1f;
                    state.SetTime(time);
                    state.Play();
                }
                else
                {
                    state.destinationWeight = 0f;
                    state.isBlending        = false;
                }
            }

            DebugLog.Normal($"EasyAnimationPlayable.Play : {stateName}を再生します", DebugLogColor.animation);

            return(true);
        }
Example #2
0
        public bool Blend(string blendTreeName, float transitionTime = 0.3f)
        {
            var target = _stateManager.FindBlend(blendTreeName);

            if (target == null)
            {
                DebugLog.Error($"EasyAnimationPlayable.Blend : ブレンドアニメーションステートが存在しないため再生できませんでした。{blendTreeName}", DebugLogColor.animation);
                return(false);
            }

            _blendingName   = blendTreeName;
            _transitionTime = transitionTime;

            foreach (var state in _stateManager.states)
            {
                state.destinationWeight = 0f;
                state.originWeight      = state.weight;
                state.isBlending        = false;
            }

            target.Play();
            target.ComputeDestinationWeights(0f, 0f);

            DebugLog.Normal($"EasyAnimationPlayable.Blend : {blendTreeName}を再生します。", DebugLogColor.animation);

            return(true);
        }
Example #3
0
        public static void SignInAnonymously(Action <string> onResult)
        {
            DebugLog.Normal($"FireBase Auth : 匿名ログインを行います");

            FirebaseAuth.DefaultInstance.SignInAnonymouslyAsync().ContinueWithOnMainThread(task =>
            {
                if (task.IsCanceled)
                {
                    DebugLog.Error("FireBase Auth : 匿名ログインをキャンセルしました");
                    return;
                }

                if (task.IsFaulted)
                {
                    DebugLog.Error("FireBase Auth : 匿名ログインに失敗しました。" + task.Exception);
                    return;
                }

                FirebaseUser anonymousUser = task.Result;
                DebugLog.Normal($"FireBase Auth : 匿名ユーザーを作成しました {anonymousUser.DisplayName} ({anonymousUser.UserId})");
                DidAnonymouslyLoggedIn = true;

                onResult?.Invoke(anonymousUser.UserId);
            });
        }
Example #4
0
        public bool Play(string clipName = null)
        {
            if (_animation.clip == null)
            {
                DebugLog.Error("アニメーションクリップがnullです" + "," + gameObject.name, DebugLogColor.animation);
                return(false);
            }

            if (_animation.GetClip(clipName) == null)
            {
                DebugLog.Error("アニメーションクリップが存在しません。" + clipName + "," + gameObject.name, DebugLogColor.animation);
                return(false);
            }

            if (_animation.isPlaying)
            {
                DebugLog.Error("アニメーションは再生中です。" + _animation.clip.name + "," + gameObject.name, DebugLogColor.animation);
                return(false);
            }

            _animation.Play(clipName);
            onPlay?.Invoke();

            onPlay = null;

            isStop = false;

            return(true);
        }
Example #5
0
        public bool IsPlaying()
        {
            if (_animation.clip == null)
            {
                DebugLog.Error("アニメーションクリップがnullです" + "," + gameObject.name, DebugLogColor.animation);
                return(false);
            }

            return(_animation.isPlaying);
        }
Example #6
0
        public bool Play(int index, float time = 0.0f, float transitionTime = 0.3f)
        {
            var target = _stateManager.Find(index);

            if (target == null)
            {
                DebugLog.Error($"EasyAnimationPlayable.Play : アニメーションステートが存在しないため再生できませんでした。{index}", DebugLogColor.animation);
                return(false);
            }

            return(Play(target.StateName, time, transitionTime));
        }
Example #7
0
        public EasyAnimationState GetState(int stateIndex)
        {
            EasyAnimationState target = _stateManager.Find(stateIndex);

            if (target == null)
            {
                DebugLog.Error($"EasyAnimationPlayable.GetState : アニメーションステートが存在しないため取得できませんでした。{stateIndex}", DebugLogColor.animation);
                return(null);
            }

            return(target);
        }
Example #8
0
        public EasyAnimationState GetState(string stateName)
        {
            var target = _stateManager.Find(stateName);

            if (target == null)
            {
                DebugLog.Error($"EasyAnimationPlayable.GetState : アニメーションステートが存在しないため取得できませんでした。{stateName}", DebugLogColor.animation);
                return(null);
            }

            return(target);
        }
Example #9
0
        public static void SignInAnonymously(Action <string> onSignIn)
        {
            FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task => {
                DependencyStatus dependencyStatus = task.Result;

                if (dependencyStatus == DependencyStatus.Available)
                {
                    DebugLog.Normal("Firebase : ユーザー設定を行います");
                    MFBFAuth.SignInAnonymously(onSignIn);
                }
                else
                {
                    DebugLog.Error("Firebase : 依存関係を解決できませんでした: " + dependencyStatus);
                }

                MFBFDatabase.SetupDatabase(DATA_BASE_URL);
            });
        }
Example #10
0
        public bool Stop()
        {
            if (_animation.clip == null)
            {
                DebugLog.Error("アニメーションクリップがnullです" + "," + gameObject.name, DebugLogColor.animation);
                return(false);
            }

            _animation.Stop();
            onStop?.Invoke();

            onPlay   = null;
            onFinish = null;
            onStop   = null;

            isStop = true;

            return(true);
        }
Example #11
0
        public void Play(AnimationEventInvoker invoker)
        {
            Transform parent   = null;
            var       children = invoker.GetComponentsInChildren <Transform>(true);

            foreach (var child in children)
            {
                if (child.name == _effectParentName)
                {
                    parent = child;
                }
            }

            if (parent == null)
            {
                parent = invoker.transform;
            }

            if (_effectPrefab == null)
            {
                DebugLog.Error("AnimationEventObjectPlayEffect:Play:エフェクトプレハブが設定されていません", DebugLogColor.animationEvent);
                return;
            }

            if (Application.isPlaying)
            {
                var effectObj = Object.Instantiate(_effectPrefab, parent);
                var system    = effectObj.GetComponent <ParticleSystem>();
                system.Play();
            }
#if UNITY_EDITOR
            else
            {
                OnEditorEnter(parent);
            }
#endif
        }