我有一个与硬币碰撞的角色。当角色与硬币碰撞时,一个粒子"动画"应该发生。到目前为止,这是我的代码。一些基本的帮助会有很大帮助。此代码附加到玩家角色。
var geomap = L.geoJson(geojson, {
//TODO: change the colors to be randomly separated and updated based on the # of features
//TODO: Should change the feature properties to be the population and zone number -- show this in the pop-up instead of the "description"
style: function (feature) {
return {color: feature.properties.color};
},
onEachFeature: function (feature, layer) {
layer.bindPopup(feature.properties.zone);
}
});
答案 0 :(得分:1)
这是你需要做的。
public ParticleSystem collisionParticlePrefab; //Assign the Particle from the Editor (You can do this from code too)
private ParticleSystem tempCollisionParticle;
void OnTriggerEnter (Collider _hit)
{
if (_hit.tag == "Coin") {
Destroy (_hit.gameObject);
coinCount++;
coinsText.text = "Coins: " + coinCount.ToString() + "/" + coinTotal.ToString();
tempCollisionParticle = Instantiate (collisionParticlePrefab, transform.position, Quaternion.identity) as ParticleSystem;
tempCollisionParticle.Play ();
}
}