Esempio n. 1
0
        void HandleMouse()
        {
            if (Input.GetMouseButtonDown(0))
            {
                grabbedObject = MinigameCommon.RaycastFromMouse(typeof(DraggableObject)) as DraggableObject;
                if (grabbedObject != null)
                {
                    grabbedObject.InHand = true;
                }
            }

            if (Input.GetMouseButtonUp(0) && grabbedObject != null)
            {
                grabbedObject.InHand = false;
                grabbedObject        = null;
            }
        }
Esempio n. 2
0
        void Update()
        {
            if (Input.GetMouseButtonDown(0))
            {
                grabbedObject = MinigameCommon.RaycastFromMouse(typeof(DraggableObject)) as DraggableObject;
                if (grabbedObject != null)
                {
                    grabbedObject.InHand = true;
                }
            }

            if (Input.GetMouseButtonUp(0) && grabbedObject != null)
            {
                grabbedObject.InHand = false;
                grabbedObject        = null;
                PlaySquish();
            }

            if (Input.GetMouseButtonUp(0))
            {
                // Check if all organs are in the right spots
                var correct = 0;
                foreach (DragZone zone in dragZones)
                {
                    if (zone.hasDesiredObject)
                    {
                        correct++;
                    }
                }
                if (correct == dragZones.Count && isPlaying)
                {
                    isPlaying = false;
                    Debug.Log("Game won!");
                    OnGameWin();
                }
            }
        }