示例#1
0
        public void HandleHoverCatButtonClickedEvent(object sender, HoverCatButtonEventArgs buttonArgs)
        {
            switch (this.gameState)
            {
            case SensorState.DeviceReady:
                this.MainCamera.GetComponent <PinchToScale>().enablePinchToScale = false;
                StructureARPlugin.startScanning();    //tell StructurePlugin to start scanning
                this.gameState = SensorState.Scanning;
                break;

            case SensorState.Scanning:
                StructureARPlugin.doneScanning();    //tell StructurePlugin to finish scanning.
                this.gameState = SensorState.WaitingForMesh;
                break;

            case SensorState.WaitingForMesh:    //ignore buttons.
                break;

            case SensorState.Playing:

                if (buttonArgs.catButtonEvent == HoverCatButtonEvent.ResetGame)
                {
                    this.MainCamera.GetComponent <PinchToScale>().enablePinchToScale = true;
                    structureObjectLoader.ClearMesh(this.scanObject);
                    StructureARPlugin.resetScanning();    //tell StructurePlugin to reset the scanned data.
                    this.gameState = SensorState.DeviceReady;
                }
                break;

            default:
                GameLog.Log(this.ToString() + " -- unhandled game state for button" + buttonArgs.catButtonEvent);
                break;
            }
        }
示例#2
0
        /// <summary>
        /// Raises the button click event.
        /// </summary>
        ///***********************  IMPORTANT  ***********************
        /// this is the method that sends the start, done and reset
        /// commands to the plug-in!
        public virtual void HandleButtonClickedEvent(object sender, ButtonEventArgs buttonArgs)
        {
            //we already know what state we're in, and what state we
            //need to go to. The local property will update the button's
            //when it's changed.
            switch (this.gameState)
            {
            case SensorState.DeviceReady:     // DeviceReady -> Scanning
                if (this.MainCamera.GetComponent <PinchToScale>() != null)
                {
                    this.MainCamera.GetComponent <PinchToScale>().enablePinchToScale = false;
                }
                //tell StructurePlugin to start scanning
                StructureARPlugin.startScanning();
                this.gameState = SensorState.Scanning;
                break;

            case SensorState.Scanning:     // Scanning -> WaitingForMesh
                if (this.trackingIsGood)
                {
                    //tell StructurePlugin to finish scanning.
                    //this finishes up the scanning session, when the
                    //mesh is finished, it's sent to the wireframe
                    //object where it's copied over.
                    //the HandleStructureEvent gets ScannedMeshReady where
                    //the construction of the mesh is completed.
                    StructureARPlugin.doneScanning();
                    this.gameState = SensorState.WaitingForMesh;
                }
                else
                {
                    if (this.MainCamera.GetComponent <PinchToScale>() != null)
                    {
                        this.MainCamera.GetComponent <PinchToScale>().enablePinchToScale = true;
                    }

                    //clear scanned mesh
                    this.ClearScannedMesh();

                    StructureARPlugin.resetScanning();    //tell StructurePlugin to reset the scanned data.
                    this.gameState = SensorState.DeviceReady;
                }
                break;

            case SensorState.WaitingForMesh:     // WaitingForMesh -> Playing
                UploadScannedMesh();
                break;

            case SensorState.Playing:     // Playing -> DeviceReady
                if (this.MainCamera.GetComponent <PinchToScale>() != null)
                {
                    this.MainCamera.GetComponent <PinchToScale>().enablePinchToScale = true;
                }

                //clear scanned mesh
                this.ClearScannedMesh();

                StructureARPlugin.resetScanning();    //tell StructurePlugin to reset the scanned data.
                this.gameState = SensorState.DeviceReady;
                break;

            default:
                GameLog.Log(this.ToString() + " -- unhandled game state for button" + buttonArgs.toState);
                break;
            }
        }