Ejemplo n.º 1
0
 private void Awake()
 {
     audioSource = GetComponent <AudioSource>();
     Settings    = CalibrationOptions;
     FinchCore.OnDisconnected += OnDisconnectNode;
     PlayableSet.Init();
 }
Ejemplo n.º 2
0
        private void BindUpperArms()
        {
            FinchCore.BindsUpperArms();
            int controllerCount = FinchCore.NodesState.GetControllersCount();
            int upperArmsCount  = FinchCore.NodesState.GetUpperArmCount();

            PlayableSet.RememberNodes(controllerCount, controllerCount > upperArmsCount ? 0 : controllerCount);
        }
        private void CheckChirality(bool vibrate)
        {
            FinchChirality left  = FinchCore.GetCapacitySensor(FinchNodeType.LeftHand);
            FinchChirality right = FinchCore.GetCapacitySensor(FinchNodeType.RightHand);

            if (left == FinchChirality.Unknown && FinchController.Left.IsConnected && right == FinchChirality.Unknown && FinchController.Right.IsConnected)
            {
                Sprite.sprite = NoneHoldBoth;
                return;
            }

            if (left == FinchChirality.Unknown && FinchController.Left.IsConnected || right == FinchChirality.Unknown && FinchController.Right.IsConnected)
            {
                Sprite.sprite = NoneHoldOne;
                return;
            }

            if (left == FinchChirality.Both && FinchController.Left.IsConnected && right == FinchChirality.Both && FinchController.Right.IsConnected)
            {
                Sprite.sprite = BothHoldBoth;
                return;
            }

            if (left == FinchChirality.Both && FinchController.Left.IsConnected || right == FinchChirality.Both && FinchController.Right.IsConnected)
            {
                Sprite.sprite = BothHoldOne;
                return;
            }

            if (left == FinchChirality.Left && FinchController.Left.IsConnected && right == FinchChirality.Left && FinchController.Right.IsConnected)
            {
                Sprite.sprite = BothLeftHold;
                return;
            }

            if (left == FinchChirality.Right && FinchController.Left.IsConnected && right == FinchChirality.Right && FinchController.Right.IsConnected)
            {
                Sprite.sprite = BothRightHold;
                return;
            }

            if (FinchCore.NodesState.GetControllersCount() == 0)
            {
                Sprite.sprite = NoneHoldBoth;
                return;
            }

            if (vibrate)
            {
                FinchController.Left.HapticPulse(100);
                FinchController.Right.HapticPulse(100);
            }

            FinchCore.BindsControllers();
            PlayableSet.RememberNodes();
            NextStep();
        }
Ejemplo n.º 4
0
        private void TryCalibrate()
        {
            bool leftReady     = !FinchController.Left.IsConnected || leftReadyCalibrate && FinchController.Left.GetPressTime(FinchControllerElement.HomeButton) > Settings.TimeToCallModule;
            bool rightReady    = !FinchController.Right.IsConnected || rightReadyCalibrate && FinchController.Right.GetPressTime(FinchControllerElement.HomeButton) > Settings.TimeToCallModule;
            bool fastCalibrate = Settings.Calibration == CalibrationType.FastCalibration && PlayableSet.AllPlayableNodesConnected;
            bool useDash       = FinchCore.Settings.ControllerType == FinchControllerType.Dash;

            if (fastCalibrate && useDash)
            {
                if (leftReady)
                {
                    FastCalibrate(FinchController.Left);
                    leftReadyCalibrate = false;
                }

                if (rightReady)
                {
                    FastCalibrate(FinchController.Right);
                    rightReadyCalibrate = false;
                }
            }
            else if (FinchCore.NodesState.GetControllersCount() > 0 && leftReady && rightReady && !IsCalbrating)
            {
                leftReadyCalibrate  = false;
                rightReadyCalibrate = false;

                ResetCalibration();

                bool leftCapacityCorrect  = !FinchController.Left.IsConnected || FinchCore.GetCapacitySensor(FinchNodeType.LeftHand) == FinchChirality.Left;
                bool rightCapacityCorrect = !FinchController.Right.IsConnected || FinchCore.GetCapacitySensor(FinchNodeType.RightHand) == FinchChirality.Right;
                bool angleCorrect         = NodeAngleChecker.IsCorrectAngle;
                bool momentalCalibration  = leftCapacityCorrect && rightCapacityCorrect && angleCorrect && !useDash;

                if (fastCalibrate && momentalCalibration)
                {
                    FinchController.Left.HapticPulse(Settings.HapticTime);
                    FinchController.Right.HapticPulse(Settings.HapticTime);
                    FinchCore.Calibration(FinchChirality.Both);
                }
                else
                {
                    if (!(PlayableSet.AllPlayableNodesConnected))
                    {
                        PlayableSet.ResetSaveComlect();
                    }

                    Calibrate(PlayableSet.AllPlayableNodesConnected ? Settings.Calibration : CalibrationType.FullCalibration);
                }
            }
        }