view 2D_Action_Game/Assets/Scripts/Particle.cs @ 2:fdab88fc2cb9

add game projects
author Yuta ANSE <e135745@ie.u-ryukyu.ac.jp>
date Fri, 17 Jul 2015 23:14:45 +0900
parents
children
line wrap: on
line source

using UnityEngine;
using System.Collections;

public class Particle : Token {
	static GameObject _prefab = null;

	public static Particle Add(float x, float y){
		_prefab = GetPrefab (_prefab, "Particle");

		return CreateInstance2<Particle> (_prefab, x, y);
	}

	IEnumerator Start (){
		float dir = Random.Range (0, 359);
		float spd = Random.Range (10.0f, 20.0f);
		SetVelocity (dir, spd);

		while (ScaleX > 0.01f){
			yield return new WaitForSeconds (0.01f);
			MulScale (0.9f);
			MulVelocity (0.9f);
		}

		DestroyObj ();
	}

	// Use this for initialization
//	void Start () {
//	
//	}
//	
	// Update is called once per frame
	void Update () {
	
	}
}