Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (EEGManager.IsInitialized() && outline && raycastTimer.Finished)
        {
            raycastTimer.Reset();
            RaycastHit hit;
            Vector3    dir = ((EEGGameManager.Instance.player.transform.position + Vector3.up * 0.2f) - transform.position);
            if (Physics.Raycast(transform.position + (dir.normalized * 0.5f), dir, out hit, EEGGameManager.Instance.hearingDistance))
            {
                if (hit.collider.gameObject.layer == LayerMask.NameToLayer("Wall"))
                {
                    foreach (MaterialSwitcher s in materialSwitchers)
                    {
                        s.SwitchToAlternative();
                    }
                }
                else
                {
                    foreach (MaterialSwitcher s in materialSwitchers)
                    {
                        s.SwitchToMain();
                    }
                }
            }
        }

        raycastTimer.Update(Time.deltaTime);
    }
Exemplo n.º 2
0
 // Use this for initialization
 public void Awake()
 {
     Instance = this;
 }