Play special effects

Play special effects


#region Playing special effects can be played when overloaded with transform
		public static void PlayFxAt( Transform posTrans, Vector3 offset, Vector3 vec, string name, float time, bool isParent=false)//Do not target int targetPlayerID, the target is the one who clicks when attacking
		{
        
			GameObject fxPrefab =	MonoBehaviour.Instantiate(   (GameObject)Resources.Load ("Partical/" + name), posTrans.position+offset, Quaternion.identity)   as GameObject;
			if (isParent)
            {
           // Debug.Log("The following special effects are played");
				fxPrefab.transform.parent = posTrans;
            }
          //  else
			// Debug.Log ("Playing a special effect that doesn't follow");
			ParticleSystem fx1 = fxPrefab.GetComponent<ParticleSystem>();

            fx1.transform.eulerAngles = vec;//Eulerian angle assignment

			fx1.Play ();
			// fx.transform.position = player.transform.position;//position assignment
			//   ParticleSystem fx1 = fx.GetComponent<ParticleSystem>();
			//  fx1.Play();
			//Debug.Log ("Play particles according to the specified position: "+fxPrefab.name);
			GameObject.Destroy(fxPrefab.gameObject,time);

            //	GameObject objPrefab =	MonoBehaviour.Instantiate ((GameObject)Resources.Load ("bullet"), Vector3.zero, Quaternion.identity)   as GameObject;
            //	gameObject.GetCompoment<ParticleSystem>().Play();
            //turn up
        }
        #endregion


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326139306&siteId=291194637