Esempio n. 1
0
    public override void UpdateState()
    {
        base.UpdateState();

        Vector3 framePos = Vector3.MoveTowards(fsm.transform.position, nextDest, stepLength);

        fsm.transform.position = framePos;

        if (Vector3.Distance(fsm.transform.position, nextDest) < 0.05f)
        {
            t += resolutionStep;
            if (t >= 1 + resolutionStep) //END
            {
                switch (fsm.sliceResult)
                {
                case SliceResult.Retry:
                    fsm.TranslateState(this, fsm.gameIdle);
                    break;

                case SliceResult.Pass:
                    fsm.TranslateState(this, fsm.passState);
                    break;

                case SliceResult.Fail:
                    fsm.TranslateState(this, fsm.failState);
                    break;

                default:
                    break;
                }
            }
            nextDest = BezierCurvePointQuad(fsm.transform.position, fsm.fingerStart, fsm.fingerEnd, t);
        }
    }
Esempio n. 2
0
    public override void UpdateState()
    {
        base.UpdateState();
        if (timer <= waitTime)
        {
            timer += Time.deltaTime;
            return;
        }

        fsm.TranslateState(this, fsm.actState);
    }
Esempio n. 3
0
 public override void UpdateState()
 {
     if (timer < arriveTime)
     {
         fsm.transform.position = Vector3.Lerp(start, destiny, timer / arriveTime);
         timer += Time.deltaTime;
     }
     else
     {
         fsm.transform.position = destiny;
         fsm.TranslateState(this, fsm.gameIdle);
     }
 }
Esempio n. 4
0
    public override void UpdateState()
    {
        base.UpdateState();
        if (timer < resetWait)
        {
            timer += Time.deltaTime;
            return;
        }

        fsm.transform.position = new Vector3(GameManager.screenWidth / 2f, GameManager.screenHeight / 4f, 0f);
        fsm.Visiblility(true);
        fsm.TranslateState(this, fsm.gameIdle);
        GameManager.Instance.level.ResetLevel();
    }
Esempio n. 5
0
    public override void UpdateState()
    {
        base.UpdateState();
        if (inBackProcess) //while zooming to new level
        {
            if (GameManager.Instance.cam.State == CameraBehaviourState.Static)
            {
                GameManager.Instance.level.objContainer.gameObject.SetActive(true);
                fsm.TranslateState(this, fsm.intoScene);
                return;
            }
        }
        else if (GameManager.Instance.cam.State == CameraBehaviourState.Static) //zoom to distant is complete
        {
            if (delay < 0.2f)
            {
                delay += Time.deltaTime;
                return;
            }

            fsm.transform.position = Vector3.Lerp(fsm.transform.position, destiny, Time.deltaTime);
            journeyLine.lineRenderComponent.EndPos = fsm.transform.position;
            if (Vector3.Distance(fsm.transform.position, destiny) < 0.2f) //Niba act is complete
            {
                if (!inBackProcess && Input.GetMouseButtonDown(0))        //press to go next level
                {
                    GameManager.Instance.cam.State = CameraBehaviourState.To_InGame;
                    GameManager.Instance.level.OnNewLevelLoad();

                    fsm.transform.position = new Vector3(GameManager.screenWidth / 2f, GameManager.screenWidth / 4f, 0f);
                    GameManager.Instance.journeyLinesContainer.gameObject.SetActive(false);

                    inBackProcess = true;
                    fsm.Visiblility(false);
                    GameManager.Instance.level.objContainer.gameObject.SetActive(false);
                }
            }
        }
    }
Esempio n. 6
0
    public override void UpdateState()
    {
        base.UpdateState();

        if (!inProcess && Input.GetMouseButtonDown(0))
        {
            inProcess = true;
            fsm.Visiblility(false);
            MainMenuPage main = GameManager.Instance.ui.GetPage(UIID.MainMenu) as MainMenuPage;
            main.FadeOut();
            GameManager.Instance.cam.State = CameraBehaviourState.To_InGame;
            GameManager.Instance.level.OnNewLevelLoad();
        }
        else if (inProcess)
        {
            if (GameManager.Instance.cam.State == CameraBehaviourState.Static)
            {
                GameManager.Instance.ui.ShowPage(UIID.GameHUD);
                fsm.TranslateState(this, fsm.intoScene);
            }
        }
    }