예제 #1
0
    public void OnReset()
    {
        StopAllCoroutines();
        KillAllMovement();
        disableDesireBubble();
        HideDirectionIndicator();

        m_DetectedWall = false;
        CanMove        = false;
        IsInteractable = true;
        m_LevelStarted = false;
        IsCommanded    = false;

        DOTween.Kill(this);

        //DOTween.Kill(DOTweenIDs.Rotate);
        //DOTween.Kill(DOTweenIDs.Opposite);

        State = eBabyState.Default;

        DesireBubble.gameObject.SetActive(false);
        DesireList.Clear();

        transform.eulerAngles = Vector3.zero;
        transform.position    = m_StartPosition;
        transform.eulerAngles = m_StartRotation;

        if (m_DummyBedCollider != null)
        {
            m_DummyBedCollider.enabled = true;
            m_DummyBedCollider         = null;
        }
    }
예제 #2
0
 private void babyCry()
 {
     StopMovement();
     HideDirectionIndicator();
     State = eBabyState.Cry;
     BabyAnimation.Cry();
 }
예제 #3
0
    private void babyPlay(BabyAnimationHandler.eSitType type = 0)
    {
        StopMovement();
        State          = eBabyState.Play;
        IsInteractable = false;
        CanMove        = false;
        switch (type)
        {
        case BabyAnimationHandler.eSitType.Happy:
            BabyAnimation.CrawlToSit(BabyAnimationHandler.eSitType.Happy);
            break;

        default:
            BabyAnimation.CrawlToSit(BabyAnimationHandler.eSitType.Default);
            break;
        }

        SetChangeDirection(m_DesiredObject.transform.position);

        enableDesireBubble(true);
        transform.DORotate(m_TargetRotation.eulerAngles, m_BabyVars.RotationDuration).OnUpdate(() => { CanMove = false; }).
        OnComplete(() => {
            DOVirtual.DelayedCall(m_BabyVars.PlayTimeDuration, () => {
                State = eBabyState.Default;
                enableDesireBubble();
                IsInteractable = true;
                CanMove        = true;
            });
        });
    }
예제 #4
0
    private void snapToBed(Vector3 pos)
    {
        StopCoroutine("ShowDesireBubble");
        State = eBabyState.Sleep;
        KillAllMovement();

        DOTween.Kill(this);

        transform.position    = pos;
        transform.eulerAngles = m_BedRotation;


        //m_DummyBedCollider.enabled = false;
        HideDirectionIndicator();         // In case the baby has already reached the bed while trying to change it's direction.

        BabyAnimation.Sleep();
        m_Bed.ChangeComplete();
        DesireBubble.gameObject.SetActive(false);
    }
예제 #5
0
    private void changeRotationToWalk()
    {
        if (State == eBabyState.Sleep)
        {
            return;
        }
        float i_RotationTimer = 0;
        float i_Progress      = 0;
        bool  i_ThresholdMet  = false;

        if (IsCommanded)
        {
            ShowDirectionIndicator();             // Visual Indicator
        }

        StopMovement();

        BabyAnimation.Crawl();
        //BabyAnimation.Idle();
        State = eBabyState.Turn;

        transform.DORotate(m_TargetRotation.eulerAngles, m_BabyVars.RotationDuration).
        SetId(DOTweenIDs.Rotate).
        OnUpdate(() => {
            if (State == eBabyState.Sleep)
            {
                snapToBed(m_Bed.transform.GetChild(0).position);  DOTween.Kill(this);
            }
            if (!i_ThresholdMet)
            {
                DirectionalArrow.rotation = m_TargetRotation;
                i_RotationTimer          += Time.deltaTime;
                i_Progress = i_RotationTimer / m_BabyVars.RotationDuration;
                if (i_Progress >= m_BabyVars.RotationThreshold)
                {
                    if (State == eBabyState.Play)
                    {
                        HideDirectionIndicator();
                        i_ThresholdMet = true;
                    }
                    else
                    {
                        HideDirectionIndicator();
                        BeginMovement();
                        BabyAnimation.Crawl();
                        i_ThresholdMet = true;
                    }
                }
            }
        }).
        OnComplete(() => {
            //IsCommanded = false;

            m_DetectedWall = false;
            if (State != eBabyState.Sleep)
            {
                BabyAnimation.Crawl();
                BeginMovement();
                m_DetectedWall = false;
                State          = eBabyState.Default;
            }
        });
    }