コード例 #1
0
 // Update is called once per frame
 void Update()
 {
     if (coinsOnMap == 0)
     {
         TimeAttack script = (TimeAttack)gameObject.GetComponent(typeof(TimeAttack));
         script.Finish();
     }
 }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            GameObject bullet = Instantiate(prefab) as GameObject;
            bullet.transform.position = transform.position + Camera.main.transform.forward * 2;
            Rigidbody rb = bullet.GetComponent <Rigidbody>();
            rb.velocity = Camera.main.transform.forward * 40;
            Destroy(bullet, 5);
        }

        if (enemyOnMap == 0)
        {
            TimeAttack script = (TimeAttack)gameObject.GetComponent(typeof(TimeAttack));
            script.Finish();
        }
    }