IEnumerator MoveAndColor()
    {
        //Wiggle
        ballBlob.MoveTo(new Vector3(2f, 0.5f, -2), duration: 1f);
        yield return(new WaitForSeconds(2f));

        ballBlob.MoveTo(new Vector3(-2f, 0.5f, -3), duration: 1f);
        yield return(new WaitForSeconds(2f));

        ballBlob.MoveTo(new Vector3(0f, 0.5f, 0), duration: 1f);
        yield return(new WaitForSeconds(2f));

        //Walk around and change color
        ballBlob.WalkTo(new Vector3(3, 0.5f, -3), duration: 1);
        yield return(new WaitForSeconds(2));

        MeshRenderer mr  = ballBlob.GetComponent <MeshRenderer>();
        Material     mat = mr.material;

        StartCoroutine(ballBlob.changeColor(mat, new Color(1, 0, 0, 1), duration: 0.5f, ease: EaseMode.None));
        //ballBlob.ChangeColor(PrimerConstants.GetColor("Red"));
        ballBlob.WalkTo(new Vector3(-3, 0.5f, 3), duration: 1);
        yield return(new WaitForSeconds(2));

        ballBlob.WalkTo(new Vector3(-3, 0.5f, -3), duration: 1);
        yield return(null);
    }
示例#2
0
    //TODO: Method for keeping rig in a constant direction when attached to a moving object.s

    public void ZoomTo(float distance, float duration = 0.5f, EaseMode ease = EaseMode.Cubic)
    {
        camObject.MoveTo(new Vector3(0, 0, -distance), duration, ease);
    }