Exemple #1
0
        IEnumerator <float> JumpOffFromBed(bool cancel)
        {
            Player.anim.SetBool("Sleeping", false);
            yield return(0f);

            while (true)
            {
                var state = Player.anim.GetCurrentAnimatorStateInfo(0);
                if (!state.IsName("JumpOffToBed"))
                {
                    Debug.Log("Something is wrong.. this finished before firing the method. Make sure you don't call this from FixedUpdate.");
                    break;
                }

                if (state.normalizedTime >= 40 / 50f)
                {
                    break;
                }
                yield return(0f);
            }

            //Covers.sortingOrder = 0;
            HandlePlayerSprites(enable: true);

            void action()
            {
                Player.col.enabled = true;
                //SpriteControler.Instance.ChangeSortingOrder(0);
                //Covers.sortingOrder = 0;
                GameLibOfMethods.player.transform.parent.transform.parent = null;
                PlayerBuff.Remove <DeepSleep>();
            }

            PlayerCommands.JumpOff(useableFunctionality.CustomSpeedToPosition, action);
            //try { FinishUsing(cancel); }
            //catch { Debug.Log("TODO: Fix error on bed after animations btw."); }
        }