Permalink
Browse files

Add liquid types

Still needs a scriptable object to hold all types and told hold the interactions
  • Loading branch information...
Legorobotdude committed May 8, 2018
1 parent 5a54196 commit 452e7430da409c23b4b3bb8a4e1e52bb2e51b241
Showing with 11 additions and 2 deletions.
  1. +11 −2 Assets/Scripts/Liquids/LiquidContainer.cs
@@ -4,7 +4,8 @@
public class LiquidContainer : MonoBehaviour
{
[SerializeField] string liquidType = "Water";//todo: liquid and solid interaction
[SerializeField] Color color;
[SerializeField] ParticleSystem liquidParticleSystem;
[SerializeField] GameObject liquidObject;
[SerializeField] bool isPourable = true;
@@ -19,6 +20,8 @@ public class LiquidContainer : MonoBehaviour
private Renderer liquidRend;
private Material liquidMaterial;
private float pourRate = 0.1f;//ToDo: This should be calculated every frame by the pour angle
// Use this for initialization
void Start()
{
@@ -29,6 +32,7 @@ void Start()
liquidMaterial = liquidRend.material;
//liquidMaterial.SetFloat()
//Todo: Set color and level
//liquidMaterial.shader.propertyToId();
}
@@ -39,9 +43,14 @@ void Update()
{
if (Vector3.Dot(myTransform.up, Vector3.down) > 0)//todo: vary pour rate
if ((Vector3.Dot(myTransform.up, Vector3.down) > 0)&&(currentLevel>emptyLevel))//todo: vary pour rate
{
emission.enabled = true;
currentLevel -= pourRate;
if (currentLevel < emptyLevel)
{
currentLevel = emptyLevel;
}
}
else
{

0 comments on commit 452e743

Please sign in to comment.