2
|
1 using UnityEngine;
|
|
2 using System.Collections;
|
|
3
|
|
4 public class Particle : Token {
|
|
5 static GameObject _prefab = null;
|
|
6
|
|
7 public static Particle Add(float x, float y){
|
|
8 _prefab = GetPrefab (_prefab, "Particle");
|
|
9
|
|
10 return CreateInstance2<Particle> (_prefab, x, y);
|
|
11 }
|
|
12
|
|
13 IEnumerator Start (){
|
|
14 float dir = Random.Range (0, 359);
|
|
15 float spd = Random.Range (10.0f, 20.0f);
|
|
16 SetVelocity (dir, spd);
|
|
17
|
|
18 while (ScaleX > 0.01f){
|
|
19 yield return new WaitForSeconds (0.01f);
|
|
20 MulScale (0.9f);
|
|
21 MulVelocity (0.9f);
|
|
22 }
|
|
23
|
|
24 DestroyObj ();
|
|
25 }
|
|
26
|
|
27 // Use this for initialization
|
|
28 // void Start () {
|
|
29 //
|
|
30 // }
|
|
31 //
|
|
32 // Update is called once per frame
|
|
33 void Update () {
|
|
34
|
|
35 }
|
|
36 }
|