Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        privateNoteList.Add(notes.checkNoteInput());
        notes.cleanLastPlayedNotes(privateNoteList);

        int correctInput = goThroughOptions(new int[][] { forwards, backwards, right, left });

        if (correctInput >= 0)
        {
            switch (correctInput)
            {
            case 0:
                //go forward
                break;

            case 1:
                //go back
                break;

            case 2:
                //go right
                break;

            case 3:
                //go left
                break;
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (pushpul == true)
        {
            this.gameObject.transform.parent.transform.position = Vector3.MoveTowards(this.gameObject.transform.parent.transform.position, new Vector3(tg.x, this.gameObject.transform.parent.transform.position.y, tg.z), speed * Time.deltaTime);

            //move();
        }
        if (privateNoteList.Count >= 4)
        {
            cleanLastPlayedNotes(privateNoteList);
            //cleanLastPlayedNotes(notes.PlayedNotes);
        }
        if (entered == true)
        {
            Debug.Log("adddd");
            if (notes.checkNoteInput() > -1)
            {
                privateNoteList.Add(notes.checkNoteInput());
            }
        }


        //cleanLastPlayedNotes(privateNoteList);
        Debug.Log(privateNoteList[0]);



        //Debug.Log(this.gameObject.transform.parent.transform.position +"  ======  "+ tg);
        if (this.gameObject.transform.parent.transform.position == new Vector3(tg.x, this.gameObject.transform.parent.transform.position.y, tg.z) && pushpul == true || envo == true)
        {
            Debug.Log("basinga");
            tgobject.transform.parent = this.gameObject.transform.parent.parent;
            pushpul = false;
            envo    = false;
        }
    }
Ejemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        if (privateNoteList.Count >= 4)
        {
            cleanLastPlayedNotes(privateNoteList);
            //cleanLastPlayedNotes(notes.PlayedNotes);
        }

        if (mounted == true && tijd > 0)
        {
            // start timer when mounted
            //tijd -= Time.deltaTime;
            // timer.text = tijd.ToString("0");
        }
        else if (mounted == true && tijd < 0)
        {
            // die
            Debug.Log("TIJD IS OM JE HEBT HET NIET GEHAALD");
            goat.transform.position = new Vector3(goatStart.position.x, goatStart.position.y + 0.2f, goatStart.position.z);

            mounted = false;
            backgroundMusic.SetParameter("Situatie", 0, false);
            player.transform.parent = null;
            cam.SetActive(false);
            pcam.SetActive(true);
            player.GetComponent <pcontroller>().enabled = true;
            player.transform.position = new Vector3(goatStart.position.x, goatStart.position.y + 0.2f, goatStart.position.z + 1);
            player.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None;
            player.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotationZ;
            tijd = 5;

            if (top == true)
            {
                goat.transform.position   = new Vector3(goatEnd.position.x, goatEnd.position.y + 0.2f, goatEnd.position.z);
                player.transform.position = new Vector3(goatEnd.position.x, goatEnd.position.y + 0.2f, goatEnd.position.z + 1);
                pos.Clear();
                pos.Add(goatEnd);
                i = 0;
            }
            else if (top == false)
            {
                pos.Clear();
                pos.Add(goatStart);
                i = 0;
            }
        }



        if (notes.checkNoteInput() > -1)
        {
            privateNoteList.Add(notes.checkNoteInput());
        }

        //cleanLastPlayedNotes(privateNoteList);
        // Debug.Log(privateNoteList[0]);



        int correctInput = goThroughOptions(new int[][] { rightup, leftup, rightdown, leftdown });

        //0 is upper right
        //1 is upper left
        //2 is down right
        //3 is down left

        if (mounted == true && coroutineAllowed)
        {
            switch (correctInput)
            {
            case -1:
                break;

            case 0:
                //go right

                if (pos[i].gameObject.GetComponent <GoatPlatform>().connectingPlatformsRU.Length != 0)
                {
                    // rechts boven
                    goatAnim.gameObject.GetComponent <SpriteRenderer>().flipX = true;
                    MoveToRUPlatform(pos[i].gameObject.GetComponent <GoatPlatform>().connectingPlatformsRU[0].transform);
                    privateNoteList.Clear();
                    rightup = notes.RandomizeSequence();
                    //a++;
                }
                else
                {
                    break;
                }
                //cleanLastPlayedNotes(privateNoteList);

                break;

            case 1:
                //go left
                if (pos[i].gameObject.GetComponent <GoatPlatform>().connectingPlatformsLU.Length != 0)
                {
                    // links boven
                    goatAnim.gameObject.GetComponent <SpriteRenderer>().flipX = false;
                    MoveToRUPlatform(pos[i].gameObject.GetComponent <GoatPlatform>().connectingPlatformsLU[0].transform);
                    privateNoteList.Clear();
                    leftup = notes.RandomizeSequence();
                }

                else
                {
                    break;
                }
                //cleanLastPlayedNotes(privateNoteList);
                break;

            case 2:
                //    //go right
                if (pos[i].gameObject.GetComponent <GoatPlatform>().connectingPlatformsRD.Length != 0)
                {
                    // rechts onder
                    MoveToRUPlatform(pos[i].gameObject.GetComponent <GoatPlatform>().connectingPlatformsRD[0].transform);
                    privateNoteList.Clear();
                    rightdown = notes.RandomizeSequence();
                }

                else
                {
                    break;
                }
                //cleanLastPlayedNotes(privateNoteList);
                break;

            case 3:
                //    //go left

                if (pos[i].gameObject.GetComponent <GoatPlatform>().connectingPlatformsLD.Length != 0)
                {
                    // links onder
                    MoveToRUPlatform(pos[i].gameObject.GetComponent <GoatPlatform>().connectingPlatformsLD[0].transform);
                    privateNoteList.Clear();
                    leftdown = notes.RandomizeSequence();
                }

                else
                {
                    break;
                }
                //cleanLastPlayedNotes(privateNoteList);
                break;
            }

            if (privateNoteList.Count >= 4)
            {
                //cleanLastPlayedNotes(notes.PlayedNotes);

                cleanLastPlayedNotes(privateNoteList);
            }
        }



        //if (mounted == true)
        //{

        //    if (Input.GetKeyDown(KeyCode.Alpha1) && pos[i].gameObject.GetComponent<GoatPlatform>().connectingPlatformsRU[0] != null)
        //    {
        //        // rechts boven
        //        MoveToRUPlatform(pos[i].gameObject.GetComponent<GoatPlatform>().connectingPlatformsRU[0].transform);
        //    }
        //    else if (Input.GetKeyDown(KeyCode.Alpha2) && pos[i].gameObject.GetComponent<GoatPlatform>().connectingPlatformsLU[0] != null)
        //    {
        //        // links boven
        //        MoveToRUPlatform(pos[i].gameObject.GetComponent<GoatPlatform>().connectingPlatformsLU[0].transform);
        //    }
        //    else if (Input.GetKeyDown(KeyCode.Alpha3) && pos[i].gameObject.GetComponent<GoatPlatform>().connectingPlatformsRD[0] != null)
        //    {
        //        // rechts onder
        //        MoveToRUPlatform(pos[i].gameObject.GetComponent<GoatPlatform>().connectingPlatformsRD[0].transform);
        //    }
        //    else if (Input.GetKeyDown(KeyCode.Alpha4) && pos[i].gameObject.GetComponent<GoatPlatform>().connectingPlatformsLD[0] != null)
        //    {
        //        // links onder
        //        MoveToRUPlatform(pos[i].gameObject.GetComponent<GoatPlatform>().connectingPlatformsLD[0].transform);
        //    }

        //}
        if (pos[i].gameObject.GetComponent <GoatPlatform>().end == true && i != 0)
        {
            privateNoteList.Clear();
            //notes.PlayedNotes.Clear();
            if (top == true && jumpdone == true)
            {
                ui.texture = null;
                var tempColor = ui.color;
                tempColor.a = 0f;
                ui.color    = tempColor;
                goatAnim.SetBool("mounted", false);
                goatAnim.SetBool("jump", false);
                goatEnd = pos[i];
                mounted = false;
                backgroundMusic.SetParameter("Situatie", 0, false);
                this.transform.parent = oldParent;
                cam.SetActive(false);
                pcam.SetActive(true);
                player.GetComponent <pcontroller>().enabled = true;                                               // deze is het niet
                player.transform.position = new Vector3(pos[i].position.x, pos[i].position.y, pos[i].position.z); //deze is het niet
                player.GetComponent <Rigidbody>().constraints  = RigidbodyConstraints.None;
                player.GetComponent <Rigidbody>().constraints  = RigidbodyConstraints.FreezeRotation;
                player.GetComponent <SpriteRenderer>().enabled = true;
                //  timer.text = tijd.ToString(" ");
                tijd = 5;
                top  = false;
                pos.Clear();
                pos.Add(goatStart);
                i = 0;

                //maincam.gameObject.SetActive(false);
                //turtlecam.gameObject.SetActive(true);
                //buddy.GetComponent<BuddyMovement>().cam = turtlecam.gameObject;
                //this.gameObject.GetComponent<Rigidbody>().constraints = RigidbodyConstraints.FreezePosition;
                //this.transform.parent = other.transform.parent;
                //this.transform.position = other.transform.position;
                //if (other.gameObject.tag == "turtle" && ride == true)
                //{
                //    this.gameObject.GetComponent<Rigidbody>().constraints = RigidbodyConstraints.None;
                //    this.gameObject.GetComponent<Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation;
                //    this.transform.parent = oldParent;
                //    tut = false;
                //}
            }
            else if (jumpdone == true)
            {
                ui.texture = null;
                var tempColor = ui.color;
                tempColor.a = 0f;
                ui.color    = tempColor;
                goatEnd     = pos[i];
                mounted     = false;
                backgroundMusic.SetParameter("Situatie", 0, false);
                player.transform.parent = null;
                goatAnim.SetBool("mounted", false);
                goatAnim.SetBool("jump", false);
                cam.SetActive(false);
                pcam.SetActive(true);
                player.GetComponent <SpriteRenderer>().enabled = true;
                player.GetComponent <pcontroller>().enabled    = true;                                                   //deze is het niet
                player.transform.position = new Vector3(pos[i].position.x, pos[i].position.y + 0.2f, pos[i].position.z); //deze is het niet
                player.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None;
                player.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation;
                // timer.text = tijd.ToString(" ");
                tijd = 5;
                top  = true;
                pos.Clear();
                pos.Add(goatEnd);
                i = 0;
            }
        }
    }
Ejemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        if (notes.checkNoteInput() > -1)
        {
            privateNoteList.Add(notes.checkNoteInput());
        }

        //cleanLastPlayedNotes(privateNoteList);


        int correctInput = goThroughOptions(new int[][] { rightup });

        if (inrange == true)
        {
            switch (correctInput)
            {
            case -1:
                break;

            case 0:
                //follow
                bearback.SetBool("walk", true);
                bearsideL.SetBool("walk", true);
                bearsideR.SetBool("walk", true);
                bearfront.SetBool("walk", true);
                bearsideL.SetBool("pull", false);
                bearsideR.SetBool("pull", false);
                bearsideL.SetBool("push", false);
                bearsideR.SetBool("push", false);
                bear.speed = 3.5f;
                Destroy(ss);
                ss = Instantiate(target, target.transform.position, Quaternion.identity);
                ss.GetComponent <SpriteRenderer>().material            = null;
                bear.gameObject.GetComponent <Patrol>().target         = ss.transform;
                bear.gameObject.GetComponent <MeshRenderer>().material = green;
                jump.transform.localScale = new Vector3(1, 5, 1);
                jump.tag = "ground";
                bearSteps.Play();
                break;
            }
        }



        //    if (DBpotential ==4)
        //{
        //    destroy = true;
        //}
        //else
        //{
        //    destroy = false;
        //}
        //if (Input.GetKeyDown(KeyCode.E) && inrange == true)
        //{
        //    bear.speed = 3.5f;
        //    Destroy(ss);
        //    ss =  Instantiate(target, target.transform.position, Quaternion.identity);

        //    bear.gameObject.GetComponent<Patrol>().target = ss.transform;
        //    bear.gameObject.GetComponent<MeshRenderer>().material = green;
        //    jump.transform.localScale = new Vector3(1, 5, 1);
        //    jump.tag = "ground";
        //}
        //if (Input.GetKeyDown(KeyCode.R) && inrange == true)
        //{
        //    // jump active
        //    bear.gameObject.GetComponent<MeshRenderer>().material = red;
        //    jump.transform.localScale = new Vector3(1,1,1);
        //    jump.tag = "ground";
        //}
        //if (Input.GetKeyDown(KeyCode.V) && destroy == true)
        //{
        //    DB.GetComponent<Patrol>().target = DBtarget.transform;
        //    DB.GetComponent<DestroyBear>().target = DBtarget;
        //}

        if (privateNoteList.Count == 4)
        {
            cleanLastPlayedNotes(privateNoteList);
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (coroutineAllowed)
        {
            StartCoroutine(GoByTheRoute(routeToGo));
        }

        //Vector3 p0 = routes[0].GetChild(0).position;
        //Vector3 p1 = routes[0].GetChild(1).position;
        //Vector3 p2 = routes[0].GetChild(2).position;
        //Vector3 p3 = routes[0].GetChild(3).position;

        //objectPosition = Mathf.Pow(1 - tParam, 3) * p0 + 3 * Mathf.Pow(1 - tParam, 2) * tParam * p1 + 3 * (1 - tParam) * Mathf.Pow(tParam, 2) * p2 + Mathf.Pow(tParam, 3) * p3;
        //transform.position = objectPosition;

        if (notes.checkNoteInput() > -1)
        {
            privateNoteList.Add(notes.checkNoteInput());
        }

        notes.cleanLastPlayedNotes(privateNoteList);
        ///Debug.Log(privateNoteList[0]);

        int correctInput = goThroughOptions(new int[][] { right, left });

        Debug.Log(correctInput);


        switch (correctInput)
        {
        case -1:

            break;

        case 0:
            if (mounted == true)
            {
                moveSpeed = Time.deltaTime;
            }
            //go right
            break;

        case 1:
            if (mounted == true)
            {
                moveSpeed = -Time.deltaTime;
            }
            //go left
            break;

            //case 2:
            //    //go right
            //    break;

            //case 3:
            //    //go left
            //    break;
        }

        sideToSide += moveSpeed;
        sideToSide  = Mathf.Clamp(sideToSide, -2f, 2f);
    }