Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. public class SpawnObjects : MonoBehaviour
  2. {
  3. public GameObject[] RandomObjects;
  4.  
  5. public void spawnSomeObjects()
  6. {
  7. GameObject Gobj = Instantiate(RandomObjects[0]) as GameObject;
  8. Gobj.transform.position = new Vector3(0f, 50f, 5f);
  9. }
  10. }
  11.  
  12. public class BucketMovement : MonoBehaviour {
  13.  
  14. SpawnObjects SpawnObj;
  15. public float TimeSpawn = 2.0f;
  16. public float AssignTimeSpawn = 2.0f;
  17.  
  18. void Start()
  19. {
  20. SpawnObj = GameObject.FindObjectOfType<SpawnObjects>();
  21. }
  22.  
  23. void Update ()
  24. {
  25. TimeSpawn -= Time.deltaTime;
  26. if (TimeSpawn < 0)
  27. {
  28. TimeSpawn = AssignTimeSpawn;
  29. SpawnObj.spawnSomeObjects();
  30. }
  31. }
  32.  
  33. public class CollisionToBucket : MonoBehaviour {
  34.  
  35. void OnCollisionEnter2D(Collision2D other)
  36. {
  37. if(other.gameObject.tag == "Object")
  38. {
  39. //tried with isTrigger, no luck at all, objects would collide with
  40. //them selves and then fall out of the world ignoring the bucket
  41.  
  42. //tried also with collider.enabled = false; but unity tells me that I can't
  43. //access that property
  44. }
  45. }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement