duck

duck

Jan 20th, 2011
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.03 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4.  
  5. public class Shape : MonoBehaviour {
  6.    
  7.     public static List<Shape> shapes = new List<Shape>();
  8.    
  9.     void Start () {
  10.         shapes.Add(this);
  11.     }
  12.    
  13.     public static DestroyAll()
  14.     {
  15.         foreach (Shape shape in shapes)
  16.         {
  17.             shape.Kill();
  18.         }
  19.     }
  20.    
  21.     public void Kill()
  22.     {
  23.         // Spawn "destroy" visual effect
  24.         using UnityEngine;
  25. using System.Collections;
  26. using System.Collections.Generic;
  27.  
  28. public class Shape : MonoBehaviour {
  29.    
  30.     public static List<Shape> shapes = new List<Shape>();
  31.    
  32.     void Start () {
  33.         shapes.Add(this);
  34.     }
  35.    
  36.     public static DestroyAll()
  37.     {
  38.         foreach (Shape shape in shapes)
  39.         {
  40.             shape.Kill();
  41.         }
  42.     }
  43.    
  44.     public void Kill()
  45.     {
  46.         // Spawn "destroy" visual effect
  47.         shapes.Remove(this);
  48.         Destroy(gameObject);
  49.     }
  50. }
  51.  
  52.         Destroy(gameObject);
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment