コード例 #1
0
    private void Update()
    {
        bool hasHit = Physics.Raycast(transform.position, transform.forward, out RaycastHit hit, Mathf.Infinity);

        if (hasHit)
        {
            SunlightBar sunlightBar = hit.transform.GetComponent <SunlightBar>();
            if (sunlightBar)
            {
                sunlightBar.GainLight();
            }
        }
    }
コード例 #2
0
ファイル: SunlightUI.cs プロジェクト: Luxiere/LD45
 private void Awake()
 {
     bar  = GameObject.FindWithTag("Player").GetComponent <SunlightBar>();
     text = GetComponent <Text>();
 }