예제 #1
0
    // Start is called before the first frame update
    void Start()
    {
        _waterControlScript = GetAttachedControlScript();

        if (_waterControlScript == null)
        {
            throw new UnityException("Problem finding water control script in " + gameObject.name);
        }
    }
예제 #2
0
    Water_Controls GetAttachedControlScript()
    {
        Transform parent = transform.parent;

        for (int i = 0; i < parent.childCount; ++i)
        {
            if (parent.GetChild(i).gameObject.tag == "Steam Valve Pipe")
            {
                Water_Controls _controlScript = parent.GetChild(i).gameObject.GetComponent <Water_Controls>();
                return(_controlScript);
            }
        }

        return(null);
    }
예제 #3
0
 public void Awake()
 {
     Water_Controls = new Water_Controls();
     BindInputs();
 }