using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class Effect_Control : MonoBehaviour { // Start is called before the first frame update public Vector3 mousePosition; public GameObject effectPredf; private float timer; public AudioSource katong; void Start() { // effectPredf.GetComponent<ParticleSystem>().playOnAwake = true; timer = 0; } void Update() { //timer -= Time.deltaTime; //if (timer <= 0) //{ // playLizi(); // timer =2f;s //} if(Input.GetMouseButtonDown(0)) { playLizi(); } //Debug.LogError(timer); } void playLizi() { effectPredf.GetComponent<ParticleSystem>().playOnAwake = true; mousePosition = new Vector3(Input.mousePosition.x, Input.mousePosition.y, 4f); mousePosition = Camera.main.ScreenToWorldPoint(mousePosition); GameObject go = Instantiate(effectPredf); go.transform.position = mousePosition; Destroy(go, 10); Debug.Log("chuxian"); katong.Play(); } }