Question by
Unity_Models · Feb 10, 2019 at 09:03 PM ·
collisionparticlestrackingexitonparticlecollision
ParticleCollision Exit Tracking?
So, I am working on irrigation for my farming game, and I have particle collisions tracked [for water particles], but can't get it to track when it's not being added, for it to go down. Here's my code:
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI;
public class Plot : MonoBehaviour {
public Image fill;
public Color dry;
public Color poor;
public Color okay;
public Color good;
public Color perfect;
public float irrigation;
public bool isIrrigating;
void Start ()
{
}
void Update ()
{
if (irrigation < 0.25f)
{
fill.color = dry;
}
else if (irrigation < 0.5f)
{
fill.color = poor;
}
else if (irrigation < 0.75f)
{
fill.color = okay;
}
else if (irrigation < 0.9f)
{
fill.color = good;
}
else if(irrigation <= 1)
{
fill.color = perfect;
}
fill.fillAmount = irrigation;
}
public void OnParticleCollision(GameObject other)
{
if(irrigation < 1.0f)
{
irrigation += 0.002f;
Debug.Log("Irrigation Added 0.001f");
}
}
} THANKS! :)
Comment
Your answer
Follow this Question
Related Questions
how to make particles NOT collide with triggers? 1 Answer
Particle System Collision Mode 1 Answer
Particle Collision causes Explosion?,Explosion on particle contact? 0 Answers
OnParticleCollision not getting triggered 3 Answers
How do I make my particle system detect/mark a floor collision? 0 Answers