void Start() { cam = Camera.main.GetComponent <ChangeCursor>(); inv = FindObjectOfType <SimpleInv>(); target = GameObject.FindWithTag("Target").transform; cont = GetComponent <Inv_Controller>(); }
// Use this for initialization void Start() { cam = Camera.main.GetComponent <ChangeCursor>(); cont = GetComponent <Inv_Controller>(); }
public void TheHits() { // Raycast to find what mouse is hovered over. Vector2 worldPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition); RaycastHit2D hit = Physics2D.Raycast(worldPoint, Vector2.zero, Mathf.Infinity); Debug.DrawRay(worldPoint, Vector3.zero, Color.cyan); if (hit.collider != null) { if (!dialog) { if (hit.transform.gameObject.tag == "Look") { Debug.Log("look"); if (hit.transform.gameObject.GetComponent <Inv_Controller>()) { Inv_Controller victim = hit.transform.gameObject.GetComponent <Inv_Controller>(); canWalk = false; if (victim.interactive) { Cursor.SetCursor(cursorInteract, hotSpot, cursorMode); } else { Cursor.SetCursor(cursorLook, hotSpot, cursorMode); Debug.Log("other"); } } } else if (walkMask == (walkMask | (1 << hit.transform.gameObject.layer))) { Cursor.SetCursor(cursorWalk, hotSpot, cursorMode); canWalk = true; } else { canWalk = false; Cursor.SetCursor(cursorDefault, hotSpot, cursorMode); Debug.Log("default"); } activeGuy = hit.collider.gameObject.name; } else { canWalk = false; Cursor.SetCursor(cursorDefault, hotSpot, cursorMode); } } else { Cursor.SetCursor(cursorDefault, hotSpot, cursorMode); canWalk = false; } }