示例#1
0
 void OnCollisionEnter2D(Collision2D other)
 {
     if (other.gameObject.tag == "ship" && !Game_.isDead)
     {
         Debug.Log("bump");
         //health -= 0.25f;
         transform.localScale = new Vector3(health, health, 1);
         Game_.health        -= damage;
         if (Random.Range(0, 1) > .5f)
         {
             Game_.gotDarkMatter();
         }
         //screateDarkMatter (Random.Range(0,4),startHere);
     }
 }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        timer += Time.deltaTime;
        goHere = GameObject.FindGameObjectWithTag("core").transform.position;
        //goHere = new Vector3(2.5f,-4,0);
        float speed = Time.deltaTime * rate;

        transform.position = Vector3.Lerp(transform.position, goHere, speed);

        if (Vector3.Magnitude(transform.position - goHere) < 1)
        {
            Game_.gotDarkMatter();

            Destroy(transform.gameObject);
        }


        if (timer > 2)
        {
            //Game_.darkMatter += 1;
            Destroy(transform.gameObject);
        }
    }