// Update is called once per frame
    void Update()
    {
        switch (MaxSpeedArrivalFlg)
        {
        case 0:
            GameStateStash.SpeedUp(0.03f);
            if (GameStateStash._speed >= GameStateStash._maxSpeed)
            {
                EffectTime -= Time.deltaTime;
                if (EffectTime < 0)
                {
                    MaxSpeedArrivalFlg = 1;
                }
            }

            break;

        case 1:
            EffectTime = Random.Range(1.0f, 2.5f);
            GameStateStash.SpeedUp(-0.01f);
            MaxSpeedArrivalFlg = 2;
            break;

        case 2:
            EffectTime -= Time.deltaTime;
            if (EffectTime < 0)
            {
                EffectTime         = Random.Range(1.0f, 3.0f);
                MaxSpeedArrivalFlg = 0;
            }
            break;
        }
        this.GetComponent <Text>().text = Mathf.FloorToInt(GameStateStash._speed * 100).ToString();
        Debug.Log(MaxSpeedArrivalFlg);
    }
Beispiel #2
0
 void OnTriggerEnter(Collider other)
 {
     Right_col = true;
     if (other.gameObject.tag == "NormalEnemy") //一般車と衝突
     {
         GameStateStash.GameOver();
         Destroy(parent.gameObject);
     }
     else if (other.gameObject.tag == "Wall")//壁と衝突
     {
         GameStateStash.GameOver();
         Destroy(parent.gameObject);
     }
     else if (other.gameObject.tag == "Enemy")//特殊敵と衝突
     {
         audiosource.PlayOneShot(SE_hit);
         GameStateStash.BreakCarCountUp();
         GameStateStash.AddScore(10);
         if (player_check.player_move == false)
         {
             right_enemy = true;
         }
         else
         {
             Debug.Log("Blast!!");
             var rigid   = other.gameObject.GetComponent <Rigidbody>();
             var impulse = (rigid.position - transform.parent.position).normalized * impulse_Power;
             rigid.AddForce(impulse, ForceMode.Impulse);
             //other.transform.position = Vector3.MoveTowards(other.transform.position,
             //    new Vector3(other.transform.position.x + 4, 0.5f, 0), 200 * Time.deltaTime);
         }
     }
 }
Beispiel #3
0
 void OnTriggerEnter(Collider other)
 {
     Left_col = true;
     if (other.gameObject.tag == "NormalEnemy")//一般車と衝突
     {
         hit_SE.PlayOneShot(SE_hit);
         GameStateStash.GameOver();
         Destroy(parent.gameObject);
     }
     else if (other.gameObject.tag == "Wall")//壁と衝突
     {
         hit_SE.PlayOneShot(SE_hit);
         GameStateStash.GameOver();
         Destroy(parent.gameObject);
     }
     else if (other.gameObject.tag == "Enemy")//特殊敵と衝突
     {
         hit_SE.PlayOneShot(SE_hit);
         GameStateStash.BreakCarCountUp();
         GameStateStash.AddScore(10);
         if (player_check.player_move == false)
         {
             left_enemy = true;
         }
         else
         {
             var rigid   = other.gameObject.GetComponent <Rigidbody>();
             var impulse = (rigid.position - transform.parent.position).normalized * impulse_Power;
             rigid.AddForce(impulse, ForceMode.Impulse);
             Debug.Log("Blast!!");
         }
     }
 }
Beispiel #4
0
 void OnTriggerEnter(Collider other)
 {
     Back_col = true;
     if (other.gameObject.tag == "NormalEnemy")
     {
         hit_SE.PlayOneShot(SE_hit);
         GameStateStash.GameOver();
         Destroy(parent.gameObject);
     }
 }
 // Update is called once per frame
 void Update()
 {
     if (GameStateStash._gameOverFlg)         // gameoverflgがtrueならシーン遷移
     {
         PlayerPrefs.SetInt("score", (int)GameStateStash._score);
         PlayerPrefs.SetInt("BreakCarCount", (int)GameStateStash._breakCarCount);
         Instantiate(SceneMove);
         GameStateStash.reStart();
     }
 }