private void LookAt()
    {
        //Ray ray = playerCam.ScreenPointToRay(Input.mousePosition);
        Ray ray = new Ray(playerCam.transform.position, playerCam.transform.forward);

        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, maxDistance))
        {
            if (hit.collider.CompareTag("Interactable"))
            {
                currentController = hit.collider.GetComponent <OutlineController>();

                if (prevController != currentController)
                {
                    HideOutline();
                    ShowOutline();

                    prevController = currentController;
                }
            }
            else
            {
                HideOutline();
            }
        }
    }
Exemplo n.º 2
0
    private void Update()
    {
        // Ray of the mouse from the camera
        Ray ray = cam.ScreenPointToRay(Input.mousePosition);

        // Launch a raycast with this ray
        if (Physics.Raycast(ray, out RaycastHit hit, highlightRange, ~wallLayer))
        {
            Debug.DrawRay(ray.origin, ray.direction * 1000, Color.yellow);
            // Check if we hit something
            if (hit.transform == null)
            {
                return;
            }

            // Get the outline controller of the object that we hit
            currentOutlineController = hit.collider.GetComponent <OutlineController>();

            // Check if the object has an outline controller
            if (currentOutlineController == null)
            {
                return;
            }

            if (previousOutlineController != currentOutlineController)
            {
                HideOutline();
                ShowOutline();
            }
            previousOutlineController = currentOutlineController;
        }
Exemplo n.º 3
0
    private void LookAtRay()
    {
        Ray        ray = cam.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, dist))
        {
            cursorPos = hit.point;

            if (hit.collider.CompareTag("GravInteract") || hit.collider.CompareTag("GrapplePoint") || hit.collider.CompareTag("Armour") || hit.collider.CompareTag("Knife"))
            {
                currentOC = hit.collider.GetComponent <OutlineController>();

                if (prevOC != currentOC)
                {
                    HideOutline();
                    ShowOutline();
                }

                prevOC = currentOC;
            }
            else
            {
                HideOutline();
            }
        }
        else
        {
            HideOutline();
        }
    }
 private void HideOutline()
 {
     if (prevController != null)
     {
         prevController.HideOutline();
         prevController = null;
     }
 }
Exemplo n.º 5
0
 private void HideOutline()
 {
     if (prevOC != null)
     {
         prevOC.HideOutline();
         prevOC = null;
     }
 }
Exemplo n.º 6
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(gameObject);
     }
     else
     {
         _instance = this;
     }
     material = GetComponent <Renderer>().material;
 }
Exemplo n.º 7
0
 // Start is called before the first frame update
 protected virtual void Start()
 {
     outline = gameObject.GetComponent <OutlineController>();
 }
Exemplo n.º 8
0
 private void Awake()
 {
     _outlineController = GetComponent <OutlineController>();
     _resourceNode      = GetComponent <ResourceNode>();
 }
Exemplo n.º 9
0
 void Start()
 {
     instance = this;
 }
Exemplo n.º 10
0
	// Use this for initialization
	void Start () {
        outlineController = GetComponent<OutlineController>();
	}
Exemplo n.º 11
0
 private void Start()
 {
     gridManager       = GridManager.instance;
     outlineController = OutlineController.instance;
 }