0
我真的很新,编程和超级新的使用统一xD我想自己做一个小游戏(2D)。我需要一些帮助配置粒子系统。统一3d - 粒子系统
using UnityEngine;
using System.Collections;
public class CharacterController : MonoBehaviour {
public float charForce = 75.0f;
public float fwMvSp = 3.0f;
void FixedUpdate()
{
bool engineActive = Input.GetButton("Fire1");
if (engineActive)
{
rigidbody2D.AddForce(new Vector2(0, charForce));
}
Vector2 newVelocity = rigidbody2D.velocity;
newVelocity.x = fwMvSp;
rigidbody2D.velocity = newVelocity;
}
// Use this for initialization
void Start() {
}
// Update is called once per frame
void Update() {
}
}
问题是我不知道如何实现代码来停止粒子发射,如果没有按下按钮。我试着用if语句,但是我得到一个错误,让我检查粒子系统是否连接到了游戏对象。感谢您的帮助:)