/// <summary> /// パーティクルを再生する /// </summary> /// <param name="type">パーティクルの種類</param> /// <param name="position">再生する位置</param> /// <param name="rotation">回転</param> /// <returns>再生しているパーティクル</returns> public static ParticleSystem Play(ParticleType type, Vector2 position, Quaternion rotation) { //生成・位置合わせ var ps = Instantiate(particleArray[(int)type]); ps.name = "[Particle - " + type.ToString() + " - Editable]"; ps.transform.position = position; ps.transform.rotation = rotation; ps.Play(); //返却 return(ps); }
/// <summary> /// パーティクルを再生する /// </summary> /// <param name="type">パーティクルの種類</param> /// <param name="position">再生する位置</param> /// <param name="rotation">回転</param> /// <param name="playTime">再生する時間</param> public static void PlayOneShot(ParticleType type, Vector2 position, Quaternion rotation, float playTime) { //生成・位置合わせ var ps = Instantiate(particleArray[(int)type]); ps.name = "[Particle - " + type.ToString() + " ]"; ps.transform.position = position; ps.transform.rotation = rotation; ps.Play(); //削除を予約 Destroy(ps.gameObject, playTime); }
// Spawns a requested particle at position public void SpawnParticleAt(ParticleType type, Vector3 position) { Debug.Log("Making particle"); GameObject particle = ReadyParticle(position); switch (type) { case ParticleType.sword: effectParticleAnimator.SetTrigger("SwordTrigger"); break; default: Debug.LogError("ParticleEffectSpawner::SpawnParticleAt(" + type.ToString() + ", " + position.ToString() + ") -- Unknown particle type."); Destroy(particle); break; } }
void InitializeParticle(ParticleType particle) { GameObject particleObject = null; switch (particle) { case ParticleType.Butterflies: //butterflies are not a Particle System thus need a special case. particleObject = handleButterflies(UnityEngine.Random.Range(4, 6)); break; case ParticleType.Dust: particleObject = GameObject.Instantiate(dust, transform, true); break; case ParticleType.Fireflies: particleObject = GameObject.Instantiate(fireflies, transform, true); break; } if (particleObject != null) { particleObject.name = particle.ToString(); } }
/// <summary> /// method to be used internally to create a dummy item to be verified, not to be used otherwise /// </summary> /// <param name="t1">type of the first particle</param> /// <param name="t2">type of the second particle</param> public CreationtableItem(ParticleType t1, ParticleType t2) { type1 = t1.ToString(); type2 = t2.ToString(); }
public ParticleTypeController(ParticleType _type) { type = _type; instantiated = new List <SpriteSheetParticleController>(); prefab = Resources.Load <GameObject>("SpriteSheetParticle/" + type.ToString()); }