Exemple #1
0
    //enumerator for the corn rising an rotation
    IEnumerator CornRise()
    {
        cooking = true;


        float t = 0;
        //start position and end position of the corn cakes
        Vector3 StartPosition = cornCake.transform.localPosition;
        Vector3 EndPosition   = cornCake.transform.localPosition + new Vector3(0, 1, 0);

        //rotation of the corn cake to indicate it finished cooking
        Vector3 StartRotation = cornCake.transform.localEulerAngles;
        Vector3 EndRotation   = cornCake.transform.localEulerAngles + new Vector3(0, 0, 90);

        clickIcon1.SetActive(false);
        while (t < 1)
        {
            cornCake.transform.localPosition    = Vector3.LerpUnclamped(StartPosition, EndPosition, animCurve.Evaluate(t));
            cornCake.transform.localEulerAngles = Vector3.LerpUnclamped(StartRotation, EndRotation, animCurve.Evaluate(t));
            t += Time.deltaTime * 2;
            yield return(0);
        }

        clickIcon2.SetActive(true);
        cornCake.transform.localPosition              = EndPosition;
        cornCake.transform.localEulerAngles           = EndRotation;
        cornCake.GetComponent <BoxCollider>().enabled = true;
    }
Exemple #2
0
    //scale string size for Start Fire Minigame
    IEnumerator ScaleStrings()
    {
        if (!fire1.GetComponent <SpriteRenderer>().enabled)
        {
            fire1.GetComponent <SpriteRenderer>().enabled = true;
            fire2.GetComponent <SpriteRenderer>().enabled = false;
        }
        else

        {
            fire1.GetComponent <SpriteRenderer>().enabled = false;
            fire2.GetComponent <SpriteRenderer>().enabled = true;
        }
        scaling = true;
        float   t          = 0;
        Vector3 StartScale = poleStringParent.transform.localScale;
        Vector3 EndScale   = poleStringParent.transform.localScale + new Vector3(-.2f, -.2f, -.2f);

        while (t < 1)
        {
            poleStringParent.transform.localScale = Vector3.LerpUnclamped(StartScale, EndScale, animCurve.Evaluate(t));
            t += Time.deltaTime * 6;
            yield return(0);
        }
        poleStringParent.transform.localScale = StartScale;
        scaling = false;
    }
Exemple #3
0
 // Update is called once per frame
 void Update()
 {
     if (m_Scroll == true && Camera.main.transform.position != m_ThisPos)
     {
         Camera.main.transform.position = Vector3.LerpUnclamped(Camera.main.transform.position, m_ThisPos, m_Speed * Time.deltaTime);
         m_Focused = true;
     }
     else
     {
         m_Scroll = false;
     }
 }
Exemple #4
0
    //enumerator for creating running water and hand movement
    IEnumerator CornWashing()
    {
        Debug.Log("movement check 1");

        forming = true;
        float t = 0;
        //water moving up and down
        Vector3 StartPosition = water.transform.localPosition;
        Vector3 EndPosition   = water.transform.localPosition + new Vector3(0, .25f, 0);

        Vector3 StartPositionL = Vector3.zero;
        Vector3 EndPositionL   = Vector3.zero;

        Vector3 StartPositionR = Vector3.zero;
        Vector3 EndPositionR   = Vector3.zero;

        if (currentScene.name == "CornWash")
        {
            //left hand moving to the right
            StartPositionL = handL.transform.localPosition;
            EndPositionL   = handL.transform.localPosition + new Vector3(-.15f, 0, 0);

            //right hand moving to the left
            StartPositionR = handR.transform.localPosition;
            EndPositionR   = handR.transform.localPosition + new Vector3(.15f, 0, 0);
        }



        while (t < 1)
        {
            water.transform.localPosition = Vector3.LerpUnclamped(StartPosition, EndPosition, recursiveCurve.Evaluate(t));
            if (currentScene.name == "CornWash")
            {
                handL.transform.localPosition = Vector3.LerpUnclamped(StartPositionL, EndPositionL, recursiveCurve.Evaluate(t));
                handR.transform.localPosition = Vector3.LerpUnclamped(StartPositionR, EndPositionR, recursiveCurve.Evaluate(t));
            }

            t += Time.deltaTime * 6;
            yield return(0);
        }
        water.transform.localPosition = StartPosition;

        if (currentScene.name == "CornWash")
        {
            handL.transform.localPosition = StartPositionL;
            handR.transform.localPosition = StartPositionR;
        }

        forming = false;
        Debug.Log(forming);
    }
Exemple #5
0
    IEnumerator CardFlip()
    {
        flipButton.SetActive(false);
        float   t        = 0;
        Vector3 StartRot = cardParent.transform.localEulerAngles;

        while (t < 1)
        {
            cardParent.transform.localEulerAngles = Vector3.LerpUnclamped(StartRot, StartRot + new Vector3(0, 0, 180), animCurve.Evaluate(t));
            t += Time.deltaTime * 6;
            yield return(0);
        }

        cardParent.transform.localEulerAngles = StartRot + new Vector3(0, 0, 180);
        flipButton.SetActive(true);
    }
Exemple #6
0
    //enumerator for creating oscillating corncake bob
    IEnumerator CornBob()
    {
        bobbing = true;
        float t = 0;
        //corn cake bobs up and down
        Vector3 StartScale = cornCake.transform.localPosition;
        Vector3 EndScale   = cornCake.transform.localPosition + new Vector3(0, .15f, 0);

        //fire size oscillates
        Vector3 StartFireScale = fire.transform.localPosition;
        Vector3 EndFireScale   = fire.transform.localPosition + new Vector3(0, -.2f, 0);

        while (t < 1)
        {
            cornCake.transform.localPosition = Vector3.LerpUnclamped(StartScale, EndScale, recursiveCurve.Evaluate(t));
            fire.transform.localPosition     = Vector3.LerpUnclamped(StartFireScale, EndFireScale, recursiveCurve.Evaluate(t));
            t += Time.deltaTime * 6;
            yield return(0);
        }
        cornCake.transform.localPosition = StartScale;
        fire.transform.localPosition     = StartFireScale;
        bobbing = false;
    }