Ejemplo n.º 1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == coinTarget.tag)
     {
         PoolObject.DespawnCoin(other.gameObject);
     }
 }
Ejemplo n.º 2
0
    //void FixedUpdate()
    //{
    //    rigidbody2D.velocity = moveVector2;
    //}

    void Despawn()
    {
        transform.position = Vector3.MoveTowards(transform.position, targetPos, moveSpeed);
        if (transform.position == targetPos)
        {
            PoolObject.DespawnCoin(gameObject);
        }
    }