Esempio n. 1
0
        public override void OnPointerUp(PointerEventData eventData)
        {
            base.OnPointerUp(eventData);

            if (eventData is SCPointEventData)
            {
                SCPointEventData scPointEventData = eventData as SCPointEventData;
                if (eventDataDic.ContainsKey(scPointEventData.inputDevicePartBase.PartType))
                {
                    eventDataDic.Remove(scPointEventData.inputDevicePartBase.PartType);
                }

                //from two hand to one hand
                if (eventDataDic.Count == 1)
                {
                    devicePartCountManipulation = new OneDevicePartCountManipulation();
                    devicePartCountManipulation.Init(devicePartManipulation, eventDataDic, Target == null ? this.transform : Target.transform, moveLogic, canOneHandRotate ? rotateLogic : null, null);
                }
            }

            if (rigidBody != null)
            {
                rigidBody.isKinematic = wasKinematic;
                rigidBody             = null;
            }
            AudioSystem.getInstance.PlayAudioOneShot(gameObject, EndAudio);
        }
Esempio n. 2
0
        public override void OnPointerDown(PointerEventData eventData)
        {
            base.OnPointerDown(eventData);

            if (eventDataDic == null)
            {
                eventDataDic = new Dictionary <InputDevicePartType, SCPointEventData>();
            }

            if (scaleLogic == null)
            {
                scaleLogic = new ScaleLogic();
            }

            if (rotateLogic == null)
            {
                rotateLogic = new RotateLogic();
            }

            if (moveLogic == null)
            {
                moveLogic = new MoveLogic();
            }

            if (eventData is SCPointEventData)
            {
                SCPointEventData scPointEventData = eventData as SCPointEventData;
                eventDataDic[scPointEventData.inputDevicePartBase.PartType] = scPointEventData;
                if (scPointEventData.inputDevicePartBase is InputDeviceHandPart)
                {
                    devicePartManipulation = new HandDevicePartManipulation();
                }
                else if (scPointEventData.inputDevicePartBase is InputDeviceGCPart)
                {
                    devicePartManipulation = new GameControllerDevicePartManipulation();
                }
                else if (scPointEventData.inputDevicePartBase is InputDeviceHeadPart)
                {
                    devicePartManipulation = new HeadDevicePartManipulation();
                }
            }

            //Two DevicePart
            if (eventDataDic.Count > 1)
            {
                devicePartCountManipulation = new TwoDevicePartCountManipulation();
                devicePartCountManipulation.Init(devicePartManipulation, eventDataDic, Target == null ? this.transform : Target.transform, moveLogic, canTwoHandRotate ? rotateLogic : null, canTwoHandScale ? scaleLogic : null);
            }
            //One DevicePart
            else if (eventDataDic.Count == 1)
            {
                devicePartCountManipulation = new OneDevicePartCountManipulation();
                devicePartCountManipulation.Init(devicePartManipulation, eventDataDic, Target == null ? this.transform : Target.transform, moveLogic, canOneHandRotate ? rotateLogic : null, null);
            }

            rigidBody = Target == null?this.GetComponent <Rigidbody>() : Target.GetComponent <Rigidbody>();

            if (rigidBody != null)
            {
                wasKinematic          = rigidBody.isKinematic;
                rigidBody.isKinematic = true;
            }

            AudioSystem.getInstance.PlayAudioOneShot(gameObject, StartAudio);
        }