Exemplo n.º 1
0
        void Update()
        {
            GameObject under = getObjectUnder();

            if (under != null)
            {
                if (under.GetComponent <Bath>() != null && under.GetComponent <Bath>().filled == false)
                {
                    if (this.filled)
                    {
                        Bath bath = under.GetComponent <Bath>();
                        bath.fill();
                        this.unFill();
                    }
                }
                if (under.GetComponent <WaterSource>() != null)
                {
                    if (!this.filled)
                    {
                        WaterSource waterSource = under.GetComponent <WaterSource>();
                        this.fill();
                    }
                }
            }
        }
Exemplo n.º 2
0
        void Update()
        {
            GameObject under = getObjectUnder();

            if (under != null)
            {
                if (under.GetComponent <Bath>() != null && under.GetComponent <Bath>().filled == false)
                {
                    if (this.filled)
                    {
                        Debug.Log("emptying bucket");
                        Bath bath = under.GetComponent <Bath>();
                        bath.fill();
                        this.unFill();
                    }
                }
                if (under.GetComponent <WaterSource>() != null)
                {
                    if (!this.filled)
                    {
                        Debug.Log("filling bucket");
                        WaterSource waterSource = under.GetComponent <WaterSource>();
                        this.fill();
                    }
                }
            }
        }