public void HandleEvent(GameEvent ge)
    {
        if (ge.type.Equals("piece_tapped"))
        {
            PieceController tappedPiece = (PieceController)ge.args[0];
            if (tappedPiece.GetGridLock())
            {
                if (floatingPiece != null)
                {
                    bool success = grid.TryAddPiece(floatingPiece);
                    if (success)
                    {
                        floatingPiece.SetGridLock(true);
                        floatingPiece = null;
                    }
                }
                Activate(tappedPiece);
            }
            else
            {
                bool success = grid.TryAddPiece(tappedPiece);
                if (success)
                {
                    tappedPiece.SetGridLock(true);
                    floatingPiece = null;
                }
            }
        }
        else if (ge.type.Equals("piece_dropped_on_inventory"))
        {
            PieceController piece = (PieceController)ge.args[0];
            InventoryAdd(piece);
        }
        else if (ge.type.Equals("template_tapped"))
        {
            PieceTemplateController tappedPiece = (PieceTemplateController)ge.args[0];
            Vector3 loc = (Vector3)ge.args[1];
            if (floatingPiece != null)
            {
                bool success = grid.TryAddPiece(floatingPiece);
                if (success)
                {
                    floatingPiece.SetGridLock(true);
                    floatingPiece = null;
                }
            }

            GameObject go = Instantiate(Resources.Load("Prefabs/ExistingPiece")) as GameObject;
            go.transform.SetParent(canvas.transform, false);
            go.transform.position = new Vector3(loc.x, loc.y, go.transform.position.z);
            PieceController newPiece = go.GetComponent <PieceController>();
            newPiece.ConfigureFromJSON(tappedPiece.GetFilename());
            newPiece.SetRotation(0);
            newPiece.SetMoving(true);
            Activate(newPiece);
            iwc.RemovePiece(newPiece);
            //tappedPiece.SetCount(tappedPiece.GetCount()-1);
        }
        else if (ge.type.Equals("alt_click"))
        {
            if (floatingPiece == null)
            {
                return;
            }
            if (!finger1down)
            {
                return;
            }

            Vector3 altClickPos = (Vector3)ge.args[0];
            //check if the second click is on one of the rotate buttons
            float ymax = rotCounterclockwise.rect.y + (rotCounterclockwise.rect.height / 2f);
            float xmax = rotCounterclockwise.rect.x + (rotCounterclockwise.rect.width / 2f);
            if (altClickPos.x < xmax && altClickPos.y < ymax)             //then you're on the buttons
            {
                return;
            }

            Vector3 firstClickPos = InputWatcher.GetInputPosition();
            Vector3 direction     = altClickPos - firstClickPos;
            twoFingerAngle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
            pieceAngle     = floatingPiece.transform.eulerAngles.z;

            floatingPiece.SetTwoFingerMovement(true);
            finger2down = true;
        }
        else if (ge.type.Equals("alt_release"))
        {
            Debug.Log("alt release happened");
            if (floatingPiece == null)
            {
                return;
            }
            if (!finger2down)
            {
                return;
            }

            if (waitingForOtherFingerToReset)
            {
                floatingPiece.SetTwoFingerMovement(false);
                waitingForOtherFingerToReset = false;
            }
            else
            {
                waitingForOtherFingerToReset = true;
                floatingPiece.LockRotation();
            }
            finger2down = false;
        }
        else if (ge.type.Equals("mouse_click"))
        {
            Vector3 pos = (Vector3)ge.args[0];
            if (grid.TouchIsOnMe(pos))
            {
                finger1down = true;
            }
        }
        else if (ge.type.Equals("mouse_release"))
        {
            if (floatingPiece == null)
            {
                return;
            }
            if (waitingForOtherFingerToReset)
            {
                floatingPiece.SetTwoFingerMovement(false);
                waitingForOtherFingerToReset = false;
            }
            else
            {
                waitingForOtherFingerToReset = true;
                floatingPiece.LockRotation();
            }
            finger1down = false;
        }
    }