Question by
dudedude123 · Jul 20, 2016 at 02:14 PM ·
particlesemission
Emitting water
I have set up the code
using UnityEngine;
using System.Collections;
public class Water : MonoBehaviour {
public float fireRateReduction;
public float sparksExtraReduction;
private float heightAboveFloor;
private ParticleCollisionEvent[][] collisionEvents;
private ParticleSystem[] water;
private GameObject floor;
private Fire fire;
private float lookSensitivity;
private GameObject ball;
void Awake ()
{
water = GetComponentsInChildren<ParticleSystem>();
}
void Update ()
{
if (Input.GetButton("Fire1"))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit[] hits;
hits = Physics.RaycastAll(ray);
foreach (RaycastHit h in hits)
{
if (h.collider.name == "ground")
transform.position = h.point + new Vector3(0f, heightAboveFloor, 0f);
}
if (!water[0].isPlaying)
{
for (int i = 0; i < water.Length; i++)
{
water[i].Play();
}
}
}
else
{
if (water[0].isPlaying)
{
for (int i = 0; i < water.Length; i++)
{
water[i].Stop();
}
}
}
}
}
To work with this
It wont emit the water, how can I get the code to emit water?
2016-07-13-22h48-18.png
(336.5 kB)
Comment