Exemple #1
0
        public override void BeginUsing()
        {
            GameLibOfMethods.cantMove       = true;
            GameLibOfMethods.canInteract    = false;
            GameLibOfMethods.doingSomething = true;

            CurrentAction.BeginAction();
            useState = ObjectUseState.InUse;
        }
Exemple #2
0
        public override void BeginUsing()
        {
            GameLibOfMethods.player.GetComponent <SpriteControler>().FaceRIGHT();
            Weights.SetActive(false);
            GameLibOfMethods.cantMove = true;

            CurrentAction.BeginAction();
            useState = ObjectUseState.InUse;
        }
Exemple #3
0
        public override void BeginUsing()
        {
            SpriteControler.Instance.UpdateCharacterOrientation(useableFunctionality.characterOrientationOnUseBegin);
            GameLibOfMethods.cantMove       = true;
            GameLibOfMethods.canInteract    = false;
            GameLibOfMethods.doingSomething = true;

            CurrentAction.BeginAction();
            useState = ObjectUseState.InUse;

            GamePauseHandler.SubscribeCloseEvent(EscCloseEvent);
        }
Exemple #4
0
        public override void BeginUsing()
        {
            GameLibOfMethods.cantMove       = true;
            GameLibOfMethods.canInteract    = false;
            GameLibOfMethods.doingSomething = true;

            CurrentAction.BeginAction();
            useState = ObjectUseState.InUse;

            if (breakFunctionality.isBroken)
            {
                float GetProgress() => breakFunctionality.RepairProgress;

                progressBarID = ProgressBar.StartTracking("Fix Toilet", GetProgress, 100);
            }
        }
Exemple #5
0
        public override void BeginUsing()
        {
            SpriteControler.Instance.FaceDOWN();
            CurrentAction.BeginAction();

            GameLibOfMethods.cantMove       = true;
            GameLibOfMethods.canInteract    = false;
            GameLibOfMethods.doingSomething = true;

            //GameLibOfMethods.animator.SetBool("TakingShower", true);
            useState = ObjectUseState.InUse;

            if (breakFunctionality.isBroken)
            {
                float GetProgress() => breakFunctionality.RepairProgress;

                progressBarID = ProgressBar.StartTracking("Fix Shower", GetProgress, 100);
            }
        }
Exemple #6
0
        IEnumerator <float> JumpToBed()
        {
            Player.anim.Play("PrepareToSleep");
            Player.anim.SetBool("Sleeping", true);
            PlayerAnimationHelper.StopPlayer();
            SpriteControler.Instance.FaceDOWN();

            yield return(0f);

            PlayerCommands.LastPositionBeforeJump = GameLibOfMethods.player.transform.position;
            //SpriteControler.Instance.ChangeSortingOrder(1);
            GameLibOfMethods.player.transform.parent.transform.parent = transform;
            while (true)
            {
                var state = Player.anim.GetCurrentAnimatorStateInfo(0);
                if (!state.IsName("PrepareToSleep"))
                {
                    Debug.Log("Something is wrong.. this finished before firing the method. Make sure you don't call this from FixedUpdate.");
                    break;
                }

                if (Player.anim.GetCurrentAnimatorStateInfo(0).normalizedTime >= 62 / 120f)
                {
                    break;
                }

                yield return(0f);
            }


            Player.col.enabled = false;


            Vector2 targetPos  = useableFunctionality.PlayerStandPosition;
            Vector2 currentPos = GameLibOfMethods.player.transform.position;

            while (true)
            {
                currentPos = Vector2.MoveTowards(currentPos, targetPos, .8f * GameTime.Time.deltaTime);
                GameLibOfMethods.player.transform.position = currentPos;
                if (currentPos == targetPos)
                {
                    break;
                }
                yield return(0f);
            }

            yield return(0f);

            if (Random.Range(0f, 1f) > 0.5f)
            {
                PlayerBuff.Add <DeepSleep>();
            }

            GameLibOfMethods.isSleeping = true;
            GameLibOfMethods.cantMove   = true;
            HandlePlayerSprites(enable: false);
            StartCoroutine(SleepSpeedChangeDelay());
            //Covers.sortingOrder = 2;
            useState = ObjectUseState.InUse;
            CurrentAction.BeginAction();
        }