duck

duck

Jan 20th, 2011
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 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.         Destroy(gameObject);
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment