Example #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "onigiri")
        {
            Destroy(collision.gameObject);
            collision.gameObject.tag = "not_onigiri";

            //加速
            speed += 0.2f;
            animator.SetFloat("Speed", speed);

            gravity        += 0.2f;
            rg.gravityScale = gravity;

            move_speed_UCS += 1.8f;
            //

            //UI
            CTS.change_Text(speedup_text.textComponent, "スピードアップ!");
            CTS.change_color(speedup_text.textComponent, textColor.yellow);
            StartCoroutine(CTS.FalseUI(2.0f, speedup_text.textComponent));
        }

        if (collision.gameObject.tag == "bomb" || collision.gameObject.tag == "rock")
        {
            Destroy(collision.gameObject);

            StartCoroutine("WaitFlash");//点滅用コルーチン

            //減速
            speed -= 0.4f;
            if (speed < 0.2f)
            {
                speed = 0.2f;
            }
            animator.SetFloat("Speed", speed);

            gravity -= 0.2f;
            if (gravity < 3.0f)
            {
                gravity = 3.0f;
            }
            collision.gameObject.tag = "not_bomb";


            move_speed_UCS -= 3.6f;
            if (move_speed_UCS < 1.8f)
            {
                move_speed_UCS = 1.8f;
            }
            //

            //UI
            CTS.change_Text(speeddown_text.textComponent, "スピードダウン…");
            CTS.change_color(speeddown_text.textComponent, textColor.red);
            StartCoroutine(CTS.FalseUI(2.0f, speeddown_text.textComponent));
        }
    }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        //時間管理
        timeElapsed += Time.deltaTime;
        totalTime   += Time.deltaTime;



        //スタートまでのカウントダウン
        if (timeElapsed >= time_countdown)
        {
            startFlag      = 1;
            startTime      = timeElapsed;
            time_countdown = 100.0f;

            //UI系
            CTS.change_Text(main_text.textComponent, "Start!");
            StartCoroutine(CTS.FalseUI(0.8f, main_text.textComponent));


            //filedScript有効に
            GameObject[] fields = GameObject.FindGameObjectsWithTag("field");
            foreach (GameObject x in fields)
            {
                x.GetComponent <FieldScript>().enabled = true;
            }
        }
        else if (startFlag == 0)
        {
            count -= Time.deltaTime;
            CTS.change_Text(main_text.textComponent, count.ToString("F0"));
        }



        //爆弾生成
        if (timeElapsed >= time_bombmake && startFlag == 1)
        {
            Instantiate(objects[1], new Vector3(30f, -1.6f, 0), Quaternion.identity);
            timeElapsed = 0.0f;
        }


        //タイムアップ
        if (remainingTime <= 0.0f)
        {
            TimeUp();
        }
    }