Ejemplo n.º 1
0
    public bool Evaluate(UnidentifiedObject key, out KeyCode value)
    {
        foreach (KeyValuePair <UnidentifiedObject, KeyCode> pair in FrozenArray)
        {
            if (pair.Key == key)
            {
                value = pair.Value;
                return(true);
            }
        }

        value = KeyCode.None;
        return(false);
    }
Ejemplo n.º 2
0
    private void FixedUpdate()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Vector3      point = camera.ScreenToWorldPoint(Input.mousePosition);
            RaycastHit2D hit   = Physics2D.Raycast(point, Vector3.zero, Mathf.Infinity, clickObjectsLayer);
            if (hit.collider)
            {
                Debug.Log("An object was hit!");

                clickedObject = hit.collider.gameObject.GetComponent <UnidentifiedObject>();
            }
        }
    }
Ejemplo n.º 3
0
    private void OnGUI()
    {
        Event e = Event.current;

        if (e.isKey)
        {
            if (Input.GetKeyDown(e.keyCode))
            {
                Debug.Log($"Detected key code: {e.keyCode}");
                SetToFreeze(e.keyCode);
                clickedObject = null;
            }
            else
            {
                if (Input.GetKeyUp(e.keyCode))
                {
                    Debug.Log($"Release key: {e.keyCode}");
                }
            }
        }
    }
Ejemplo n.º 4
0
 public void AddObject(UnidentifiedObject obj, KeyCode keyCode)
 {
     FrozenArray.Add(new KeyValuePair <UnidentifiedObject, KeyCode>(obj, keyCode));
 }