コード例 #1
0
        public IEnumerator Should_ThrowNullReferenceException_When_NullIsPassed()
        {
            // Important note: LogAssert did not seem to work here
            try
            {
                SafeGuard.ThrowNullReferenceExceptionWhenFieldNotInitialized(null, PlaceholderScript, "myField");
            }
            catch (NullReferenceException exception)
            {
                Debug.Log(exception);
                Assert.Pass();
            }

            yield return(null);

            Assert.Fail();
        }
コード例 #2
0
        public IEnumerator Should_ThrowArgumentException_When_OwnerWasNotSet()
        {
            // Important note: LogAssert did not seem to work here
            try
            {
                SafeGuard.ThrowNullReferenceExceptionWhenFieldNotInitialized(null, null, "myField");
            }
            catch (ArgumentException exception)
            {
                Debug.Log(exception);
                Assert.Pass();
            }

            yield return(null);

            Assert.Fail();
        }
コード例 #3
0
    void Start()
    {
        leftHand        = capsuleHandLeftPrefab.GetComponent <MyCapsuleHand>();
        rightHand       = capsuleHandRightPrefab.GetComponent <MyCapsuleHand>();
        expanDialSticks = expanDialSticksPrefab.GetComponent <ExpanDialSticks>();
        safeGuard       = safeGuardPrefab.GetComponent <SafeGuard>();
        // Listen to events
        expanDialSticks.OnConnecting      += HandleConnecting;
        expanDialSticks.OnConnected       += HandleConnected;
        expanDialSticks.OnDisconnected    += HandleDisconnected;
        expanDialSticks.OnXAxisChanged    += HandleXAxisChanged;
        expanDialSticks.OnYAxisChanged    += HandleYAxisChanged;
        expanDialSticks.OnClickChanged    += HandleClickChanged;
        expanDialSticks.OnRotationChanged += HandleRotationChanged;
        expanDialSticks.OnPositionChanged += HandlePositionChanged;
        expanDialSticks.onHoldingChanged  += HandleHoldingChanged;
        expanDialSticks.onReachingChanged += HandleReachingChanged;

        connected = false;
        expanDialSticks.client_MqttConnect();
        // generate potential candidates
        orderedCandidates    = new List <Vector3Int>();
        prevOrderedCandidate = new Vector3Int(-1, -1, -1);
        candidates           = new List <Vector2Int>(); //= Enumerable.Range(0, nbPins).ToList<int>();
        // get pins inside matrix only
        for (int i = 1; i < expanDialSticks.NbRows - 1; i++)
        {
            for (int j = 1; j < expanDialSticks.NbColumns - 1; j++)
            {
                candidates.Add(new Vector2Int(i, j));
            }
        }
        // Generate trials
        overlays = new List <ExpanDialSticks.SafetyOverlayMode> {
            ExpanDialSticks.SafetyOverlayMode.Edge, ExpanDialSticks.SafetyOverlayMode.Fill, ExpanDialSticks.SafetyOverlayMode.Hull, ExpanDialSticks.SafetyOverlayMode.Zone
        };
        currOverlay  = ExpanDialSticks.SafetyOverlayMode.None;
        difficulties = new List <Difficulty> {
            Difficulty.Easy, Difficulty.Medium, Difficulty.Hard
        };
        trials   = new Dictionary <Difficulty, List <List <int> > >();
        nbTrials = 0;
    }
コード例 #4
0
    void Start()
    {
        leftHand        = capsuleHandLeftPrefab.GetComponent <MyCapsuleHand>();
        rightHand       = capsuleHandRightPrefab.GetComponent <MyCapsuleHand>();
        expanDialSticks = expanDialSticksPrefab.GetComponent <ExpanDialSticks>();
        safeGuard       = safeGuardPrefab.GetComponent <SafeGuard>();
        // Listen to events
        expanDialSticks.OnConnecting      += HandleConnecting;
        expanDialSticks.OnConnected       += HandleConnected;
        expanDialSticks.OnDisconnected    += HandleDisconnected;
        expanDialSticks.OnXAxisChanged    += HandleXAxisChanged;
        expanDialSticks.OnYAxisChanged    += HandleYAxisChanged;
        expanDialSticks.OnClickChanged    += HandleClickChanged;
        expanDialSticks.OnRotationChanged += HandleRotationChanged;
        expanDialSticks.OnPositionChanged += HandlePositionChanged;
        expanDialSticks.onHoldingChanged  += HandleHoldingChanged;
        expanDialSticks.onReachingChanged += HandleReachingChanged;

        dataPhysModel = new DataPhysModel(expanDialSticks.NbRows, expanDialSticks.NbColumns);
        expanDialSticks.client_MqttConnect();
    }
コード例 #5
0
 public IEnumerator Should_NotThrowAnyException_When_ClassIsPassed()
 {
     SafeGuard.ThrowNullReferenceExceptionWhenFieldNotInitialized(new DefaultClass(), PlaceholderScript, "myField");
     yield return(null);
 }
コード例 #6
0
 public IEnumerator Should_NotThrowAnyException_When_DiffuseMaterialIsPassed()
 {
     SafeGuard.ThrowNullReferenceExceptionWhenFieldNotInitialized(new Material(Shader.Find("Diffuse")), PlaceholderScript, "myField");
     yield return(null);
 }
コード例 #7
0
 public IEnumerator Should_NotThrowAnyException_When_GameObjectIsPassed()
 {
     SafeGuard.ThrowNullReferenceExceptionWhenFieldNotInitialized(new GameObject(TypeName), PlaceholderScript, "myField");
     yield return(null);
 }