コード例 #1
0
ファイル: StunController.cs プロジェクト: natis1/ModCommon
        IEnumerator MainAILoop()
        {
            Dev.Where();

            for (; ;)
            {
                yield return(new WaitForEndOfFrame());

                if (stuns >= maxStuns)
                {
                    break;
                }

                if (isSuspended)
                {
                    continue;
                }

                if (hitsTaken < hitsToStun)
                {
                    continue;
                }

                yield return(Stun());
            }

            this.enabled = false;
        }
コード例 #2
0
        protected virtual IEnumerator MainAILoop()
        {
            Dev.Where();

            for (;;)
            {
                if (!Running)
                {
                    break;
                }

                yield return(currentState);

                if (nextState != null)
                {
                    //TODO: remove as the states get implemented
                    //Dev.Log( "State Complete - Hit N to advance" );
                    //while( !Input.GetKeyDown( KeyCode.N ) )
                    //{
                    //    yield return new WaitForEndOfFrame();
                    //}
                    //Dev.Log( "Next" );
                    if (overrideNextState != null)
                    {
                        nextState         = overrideNextState;
                        overrideNextState = null;
                    }

                    currentState = nextState();
                    nextState    = null;
                }
            }

            yield break;
        }
コード例 #3
0
        protected virtual IEnumerator PlayAndWaitForEndOfAnimation(tk2dSpriteAnimator tk2dAnimator, string animation, Action doWhileWaiting = null)
        {
            Dev.Where();

            if (tk2dAnimator.GetClipByName(animation) == null)
            {
                Dev.Log("Warning: " + animation + " clip not found");
                yield break;
            }

            tk2dAnimator.AnimationCompleted = OnAnimationComplete;
            tk2dAnimator.Play(animation);

            BlockingAnimationIsPlaying = true;

            while (BlockingAnimationIsPlaying)
            {
                if (doWhileWaiting != null)
                {
                    doWhileWaiting.Invoke();
                }

                yield return(new WaitForEndOfFrame());
            }
            yield break;
        }
コード例 #4
0
ファイル: FlashEffect.cs プロジェクト: natis1/ModCommon
        IEnumerator Init()
        {
            Dev.Where();

            meshRenderer.enabled = true;

            transform.localPosition = new Vector3(0f, 0f, 0f);

            transform.localRotation = Quaternion.identity;

            Vector3 localScale = transform.localScale;
            Vector3 lossyScale = transform.lossyScale;

            transform.SetParent(null);

            transform.localScale = lossyScale;

            yield return(PlayFromFrameAndWaitForEndOfAnimation(0));

            isAnimating = false;

            transform.SetParent(parent.transform);

            transform.localScale = localScale;

            meshRenderer.enabled = false;

            currentState = null;

            gameObject.SetActive(false);

            yield break;
        }
コード例 #5
0
        private IEnumerator Start()
        {
            Dev.Where();
            while (owner == null)
            {
                yield return(null);
            }

            if (logFSM)
            {
                if (collider != null)
                {
                    lines = new List <GameObject>();
                    lines = Dev.CreateBoxOfLineRenderers(collider.bounds, Color.green, -2.1f, .01f);
                    foreach (var go in lines)
                    {
                        go.transform.SetParent(owner.transform);
                        go.transform.localPosition = Vector3.zero;
                    }
                }
            }

            if (monitorFSMStates)
            {
                StartCoroutine(DebugFSMS());
            }
        }
コード例 #6
0
        IEnumerator Complete()
        {
            Dev.Where();

            Stop();

            yield break;
        }
コード例 #7
0
ファイル: SuperDash.cs プロジェクト: natis1/ModCommon
        protected virtual IEnumerator GRight()
        {
            Dev.Where();

            nextState = Right;

            yield break;
        }
コード例 #8
0
ファイル: SuperDash.cs プロジェクト: natis1/ModCommon
        protected virtual IEnumerator GLeft()
        {
            Dev.Where();

            nextState = Left;

            yield break;
        }
コード例 #9
0
ファイル: SuperDash.cs プロジェクト: natis1/ModCommon
        //switch to this state when we enter from a transition
        protected virtual IEnumerator EnterSuperDash()
        {
            Dev.Where();

            nextState = EnterL;
            nextState = EnterR;

            yield break;
        }
コード例 #10
0
ファイル: SuperDash.cs プロジェクト: natis1/ModCommon
        protected virtual IEnumerator HitWall()
        {
            Dev.Where();


            nextState = CheckOnGround;

            yield break;
        }
コード例 #11
0
ファイル: SuperDash.cs プロジェクト: natis1/ModCommon
        protected virtual IEnumerator DirectionWall()
        {
            Dev.Where();

            nextState = Right;
            nextState = Left;

            yield break;
        }
コード例 #12
0
ファイル: SuperDash.cs プロジェクト: natis1/ModCommon
        protected virtual IEnumerator ChargeCancelWall()
        {
            Dev.Where();


            nextState = RegainControl;

            yield break;
        }
コード例 #13
0
ファイル: SuperDash.cs プロジェクト: natis1/ModCommon
        protected virtual IEnumerator WallCharged()
        {
            Dev.Where();


            nextState = DirectionWall;

            yield break;
        }
コード例 #14
0
ファイル: SuperDash.cs プロジェクト: natis1/ModCommon
        protected virtual IEnumerator Left()
        {
            Dev.Where();


            nextState = DashStart;

            yield break;
        }
コード例 #15
0
ファイル: SuperDash.cs プロジェクト: natis1/ModCommon
        protected virtual IEnumerator DashStart()
        {
            Dev.Where();


            nextState = CheckOnGround;

            yield break;
        }
コード例 #16
0
ファイル: SuperDash.cs プロジェクト: natis1/ModCommon
        protected virtual IEnumerator EnterVelocity()
        {
            Dev.Where();


            nextState = Dashing;

            yield break;
        }
コード例 #17
0
ファイル: SuperDash.cs プロジェクト: natis1/ModCommon
        protected virtual IEnumerator RegainControl()
        {
            Dev.Where();

            hero.RegainControl();

            nextState = Inactive;

            yield break;
        }
コード例 #18
0
ファイル: SuperDash.cs プロジェクト: natis1/ModCommon
        protected virtual IEnumerator RelinquishControl()
        {
            Dev.Where();

            hero.RelinquishControl();

            nextState = CheckOnGround;

            yield break;
        }
コード例 #19
0
        protected virtual void OnAnimationComplete(tk2dSpriteAnimator sprite, tk2dSpriteAnimationClip clip)
        {
            Dev.Where();
            BlockingAnimationIsPlaying = false;

            if (sprite != null)
            {
                sprite.AnimationCompleted = null;
            }
        }
コード例 #20
0
ファイル: SuperDash.cs プロジェクト: natis1/ModCommon
        protected virtual IEnumerator Cancelable()
        {
            Dev.Where();


            nextState = AirCancel;
            nextState = HitWall;
            nextState = AirCancel;

            yield break;
        }
コード例 #21
0
        public static void PrintHideFlagsInChildren(GameObject parent, bool print_nones = false)
        {
#if UNITY_EDITOR && !DISABLE_EDITOR_DEBUG
            bool showed_where = false;

            if (print_nones)
            {
                Dev.Where();
                showed_where = true;
            }

            foreach (Transform child in parent.GetComponentsInChildren <Transform>())
            {
                if (print_nones && child.gameObject.hideFlags == HideFlags.None)
                {
                    UnityEngine.Debug.Log(Dev.Colorize(child.gameObject.name, Dev.ColorToHex(Color.white)) + ".hideflags = " + Dev.Colorize(Convert.ToString(child.gameObject.hideFlags), _param_color));
                }
                else if (child.gameObject.hideFlags != HideFlags.None)
                {
                    if (!showed_where)
                    {
                        Dev.Where();
                        showed_where = true;
                    }
                    UnityEngine.Debug.Log(Dev.Colorize(child.gameObject.name, Dev.ColorToHex(Color.white)) + ".hideflags = " + Dev.Colorize(Convert.ToString(child.gameObject.hideFlags), _param_color));
                }
            }
#else
            bool showed_where = false;

            if (print_nones)
            {
                Dev.Where();
                showed_where = true;
            }

            foreach (Transform child in parent.GetComponentsInChildren <Transform>())
            {
                if (print_nones && child.gameObject.hideFlags == HideFlags.None)
                {
                    DevLoggingOutput.Instance.Log(Dev.Colorize(child.gameObject.name, Dev.ColorToHex(Color.white)) + ".hideflags = " + Dev.Colorize(Convert.ToString(child.gameObject.hideFlags), _param_color));
                }
                else if (child.gameObject.hideFlags != HideFlags.None)
                {
                    if (!showed_where)
                    {
                        Dev.Where();
                        showed_where = true;
                    }
                    DevLoggingOutput.Instance.Log(Dev.Colorize(child.gameObject.name, Dev.ColorToHex(Color.white)) + ".hideflags = " + Dev.Colorize(Convert.ToString(child.gameObject.hideFlags), _param_color));
                }
            }
#endif
        }
コード例 #22
0
ファイル: Needle.cs プロジェクト: natis1/ModCommon
 void OnDisable()
 {
     Dev.Where();
     if (meshRenderer != null)
     {
         meshRenderer.enabled = false;
     }
     isAnimating  = false;
     mainLoop     = null;
     currentState = null;
 }
コード例 #23
0
ファイル: Needle.cs プロジェクト: natis1/ModCommon
        IEnumerator Complete()
        {
            Dev.Where();

            meshRenderer.enabled = false;
            isAnimating          = false;
            gameObject.SetActive(false);
            mainLoop     = null;
            currentState = null;

            yield break;
        }
コード例 #24
0
ファイル: StunController.cs プロジェクト: natis1/ModCommon
        IEnumerator Stun()
        {
            Dev.Where();

            stuns++;
            hitsTaken = 0;
            if (onStun != null)
            {
                onStun.Invoke();
            }
            yield break;
        }
コード例 #25
0
ファイル: Needle.cs プロジェクト: natis1/ModCommon
        IEnumerator CompleteFromHitWall()
        {
            Dev.Where();

            thread.SetActive(true);

            isAnimating  = false;
            currentState = null;
            mainLoop     = null;

            yield break;
        }
コード例 #26
0
ファイル: SuperDash.cs プロジェクト: natis1/ModCommon
        protected virtual IEnumerator GroundCharged()
        {
            Dev.Where();

            while ((isPressed))
            {
                yield return(new WaitForEndOfFrame());
            }

            nextState = Direction;

            yield break;
        }
コード例 #27
0
ファイル: Needle.cs プロジェクト: natis1/ModCommon
        protected virtual void OnTriggerEnter2D(Collider2D collider)
        {
            if (!isAnimating)
            {
                return;
            }

            Dev.Where();
            if (collisionLayer.Contains(collider.gameObject))
            {
                HitWall = true;
            }
        }
コード例 #28
0
        protected static void PlayAnimation(tk2dSpriteAnimator tk2dAnimator, string animation)
        {
            Dev.Where();

            if (tk2dAnimator.GetClipByName(animation) == null)
            {
                Dev.Log("Warning: " + animation + " clip not found");
                return;
            }

            tk2dAnimator.AnimationCompleted = null;
            tk2dAnimator.Play(animation);
        }
コード例 #29
0
ファイル: SuperDash.cs プロジェクト: natis1/ModCommon
        protected virtual IEnumerator CheckOnGround()
        {
            Dev.Where();

            if (hero.cState.onGround)
            {
                nextState = GroundCharge;
            }
            else
            {
                nextState = WallCharge;
            }
            yield break;
        }
コード例 #30
0
ファイル: Needle.cs プロジェクト: natis1/ModCommon
        void OnEnable()
        {
            Dev.Where();
            if (thread == null)
            {
                thread = gameObject.FindGameObjectInChildren("Thread");
            }

            isAnimating = true;
            HitWall     = false;

            mainLoop = MainAILoop();
            StartCoroutine(mainLoop);
        }