protected virtual void Update() { // Touching the screen? inputManager.Update(Requires); if (inputManager.Fingers.Count > 0) { // Main camera exists? var mainCamera = Camera.main; if (mainCamera != null) { // World position of the mouse var position = D2dHelper.ScreenToWorldPosition(inputManager.Fingers[0].PositionA, Intercept, mainCamera); // Read the destructible and alpha at this position var destructible = default(D2dDestructible); var alpha = default(Color32); if (D2dDestructible.TrySampleAlphaAll(position, ref destructible, ref alpha) == true) { Debug.Log("Read " + destructible + " with alpha: " + alpha); } else { Debug.Log("Read nothing."); } } } }
protected virtual void Update() { // Required key is down? if (Input.GetKeyDown(Requires) == true) { // Main camera exists? var mainCamera = Camera.main; if (mainCamera != null) { // World position of the mouse var position = D2dHelper.ScreenToWorldPosition(Input.mousePosition, Intercept, mainCamera); // Read the destructible and alpha at this position var destructible = default(D2dDestructible); var alpha = default(Color32); if (D2dDestructible.TrySampleAlphaAll(position, ref destructible, ref alpha) == true) { Debug.Log("Read " + destructible + " with alpha: " + alpha); } else { Debug.Log("Read nothing."); } } } }