vitorfgd

Untitled

Jan 25th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class SpawnCircleNew : MonoBehaviour {
  5.  
  6. int numObjects = 50;
  7. public GameObject prefab;
  8. private Quaternion rot;
  9.  
  10. void Start() {
  11. Time.timeScale = 0.001f;
  12. Vector3 center = transform.position;
  13. for (int i = 0; i < numObjects; i++) {
  14. int a = i * (360/numObjects);
  15. Vector3 pos = RandomCircle(center, 2.0f ,a);
  16.  
  17. Quaternion rotation = Quaternion.FromToRotation (Vector3.down, pos - center);
  18. Instantiate (prefab, pos, rotation);
  19. }
  20. }
  21. }
  22.  
  23.  
  24. ------
  25.  
  26.  
  27. using UnityEngine;
  28. using System.Collections;
  29.  
  30. public class BulletBehavior : MonoBehaviour {
  31.  
  32. void Update (){
  33. moveWithAngle (360, 0.05f);
  34. }
  35.  
  36. public void moveWithAngle (float pAngle, float pSpeed) {
  37. this.transform.Translate(pSpeed * Mathf.Cos(Mathf.PI / 180 * pAngle), pSpeed * Mathf.Sin(Mathf.PI / 180 * pAngle), 0f);
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment