Example #1
0
    void Update()
    {
        if (scriptsc.ended())
        {
            deleteRock();
        }

        dwarf_position = go.transform.position;
        dwarf_jumping  = scriptH.get_Y();
        level          = scriptPB.getLevel();
        pause          = scriptsc.pause();

        position   = transform.position;
        position.y = -2;

        if (!pause)
        {
            position.z -= rock_speed * level;
        }

        if (position.z < view_mini)
        {
            deleteRock();
        }

        transform.position = position;

        if (Math.Abs(dwarf_position.x - position.x) < 2 && Math.Abs(dwarf_position.z - position.z) < 3 && dwarf_jumping < 2) //rentre dans un caillou
        {
            hit();
            deleteRock();
        }
    }
Example #2
0
    void Update()
    {
        position       = transform.position;
        dwarf_position = go.transform.position.x;
        level          = scriptPB.getLevel();
        pause          = scriptsc.pause();

        if (scriptsc.ended())
        {
            deleteCoin();
        }

        if (!pause)
        {
            position.z -= coin_speed * level;
        }

        if (position.z < view_mini)
        {
            deleteCoin();
        }

        transform.position = position;
        transform.Rotate(Vector3.down * Time.deltaTime * rotation_speed);

        if (Math.Abs(dwarf_position - position.x) < 2 && position.z < 5)         //piece attrapé
        {
            score();
            deleteCoin();
        }
    }
Example #3
0
 void Update()
 {
     if (script.ended())
     {
         isDead();
     }
     else
     {
         isnotDead();
     }
 }
Example #4
0
    void Update()
    {
        gameover = script.ended();

        if (gameover)
        {
            isDead();
        }
        else
        {
            isnotDead();
        }
    }
Example #5
0
    void Update()
    {
        pause = scriptsc.pause();
        ended = scriptsc.ended();


        Scale   = transform.localScale;
        Scale.x = progress;

        if (!pause && !ended)
        {
            progress++;
        }
        transform.localScale = Scale;
        if (progress == 300)
        {
            progress = 0;
            level++;
        }
    }
Example #6
0
    void Update()
    {
        level = scriptPB.getLevel();
        pause = scriptsc.pause();
        ended = scriptsc.ended();

        if (ended)
        {
            transform.position = originalPosition;
        }

        position = transform.position;
        if (!pause && !ended)
        {
            position.z -= cart_speed * level;
        }

        if (position.z < view_mini)
        {
            position.z = view_maxi;
        }

        transform.position = position;
    }
Example #7
0
    void Update()
    {
        pause = scriptsc.pause();
        ended = scriptsc.ended();

        position = transform.position;
        double aimed_X  = RAIL_X[aimed_rail - 1];
        double distance = 0;

        if (!pause && !ended)
        {
            if (aimed_rail != onrail)
            {
                distance = position.x - aimed_X;

                if (Math.Abs(distance) < VIT_LATERAL)           //arrivé
                {
                    position.x = (float)aimed_X;
                    onrail     = aimed_rail;
                }
                else if (position.x > aimed_X)                  //déplace a gauche
                {
                    position.x -= (float)VIT_LATERAL;
                }
                else if (position.x < aimed_X)                  //déplace a droite
                {
                    position.x += (float)VIT_LATERAL;
                }
                transform.position = position;
            }
            else        //action en fonction des inputs claviers

            {
                jumping = animator.GetCurrentAnimatorStateInfo(0).IsName("jump");

                if (Input.GetKeyDown("space") && !jumping)
                {
                    animator.SetTrigger("jumping");
                    jumping = true;
                }

                if (Input.GetKeyDown(KeyCode.LeftArrow) && onrail != 1 && !jumping)
                {
                    aimed_rail--;
                    if (!animator.GetCurrentAnimatorStateInfo(0).IsName("jump_left"))
                    {
                        animator.SetTrigger("move_left");
                    }
                }

                if (Input.GetKeyDown(KeyCode.RightArrow) && onrail != 3 && !jumping)
                {
                    aimed_rail++;
                    if (!animator.GetCurrentAnimatorStateInfo(0).IsName("jump_right"))
                    {
                        animator.SetTrigger("move_right");
                    }
                }
            }
        }
    }
Example #8
0
    void Update()
    {
        pause = scriptsc.pause();

        if (scriptsc.ended())
        {
            timer = -1;
        }
        else if (timer < 0)
        {
            timer = 0;
        }



        //gestion coin
        if (timer == 0)
        {
            if (sequence == 0)
            {
                sequence  = random.Next(1, 5);
                wave_coin = 5;
            }
            switch (sequence)
            {
            case 1:
            case 2:
            case 3:
                timer = coin_intervall;
                if (wave_coin != 1)
                {
                    newObject(sequence, Coin);
                }
                else
                {
                    newObject(sequence, Red_Coin);
                }
                wave_coin--;
                if (wave_coin == 0)
                {
                    endWave();
                }
                break;

            case 4:
                timer = coin_intervall;
                if (wave_coin != 1)
                {
                    newObject(1 + wave_coin % 2, Coin);
                }
                else
                {
                    newObject(1 + wave_coin % 2, Red_Coin);
                }

                wave_coin--;
                if (wave_coin == 0)
                {
                    endWave();
                }
                break;

            default:
                Debug.Log("error at coin generation");
                break;
            }
        }
        else
        {
            if (!pause)
            {
                timer--;
            }
        }


        //gestion rock
        if (Rock_timer == 0)
        {
            newObject(random.Next(1, 4), Rock);
            Rock_timer = 50;
        }
        else
        {
            if (!pause)
            {
                Rock_timer--;
            }
        }
    }