private void ReticleEffect()
    {
        RaycastHit hit = raycast.GetHitObject();

        if (hit.collider != null && Vector3.Distance(transform.position, hit.point) < reach &&
            (hit.collider.gameObject.layer == LayerMask.NameToLayer("Enemy") ||
             hit.collider.gameObject.layer == LayerMask.NameToLayer("Interactive")))
        {
            reticle.color = Color.Lerp(reticle.color, reticleEnemyColor, Time.deltaTime * 2);
            reticle.transform.localScale = Vector3.Lerp(reticle.transform.localScale, new Vector3(.7f, .7f, 1f), Time.deltaTime * 2);
        }
        else
        {
            //currentProjectilePrefab = arrowPrefab;
            reticle.color = Color.Lerp(reticle.color, reticleMissColor, Time.deltaTime * 2);
            reticle.transform.localScale = Vector3.Lerp(reticle.transform.localScale, Vector3.one, Time.deltaTime * 2);
        }
    }
Ejemplo n.º 2
0
    void Update()
    {
        if (Input.GetButtonDown("Fire1") && !uIManager.UIShown)
        {
            RaycastHit hitInfo = raycast.GetHitObject();

            if (hitInfo.collider != null && hitInfo.collider.CompareTag("Inventory") &&
                Vector3.Distance(hitInfo.point, transform.position) < reach)
            {
                AddItemFromSource(hitInfo.collider.gameObject.GetComponent <IItemSource>());
            }
        }
    }