コード例 #1
0
    public void Teardown()
    {
        GameObject.Destroy(testObj);

        FurnitureTriggerInfo.DeactivateFurniture();
        GameObject.Destroy(gui);
    }
コード例 #2
0
 /// <summary>
 /// Dectivate the furnitrue.
 /// Disables the furniture info window.
 /// </summary>
 public void Deactivate()
 {
     if (isTriggerd)
     {
         isTriggerd = false;
         FurnitureTriggerInfo.DeactivateFurniture();
     }
 }
コード例 #3
0
 /// <summary>
 /// Activate the furnitrue.
 /// Sets the furniture info window.
 /// </summary>
 public void Activate(FurnitureType type, FurnitureInfo info)
 {
     if (FurnitureTriggerInfo.Type == FurnitureType.None)
     {
         isTriggerd = true;
         FurnitureTriggerInfo.SetActiveFurniture(type, info);
     }
 }
コード例 #4
0
    public void DeactivateFunitureSetsTypeToNone_Test()
    {
        // setup
        FurnitureTriggerInfo.Type = FurnitureType.CArm;

        // perform
        FurnitureTriggerInfo.DeactivateFurniture();

        // assert
        Assert.AreEqual(FurnitureType.None, FurnitureTriggerInfo.Type);
    }
コード例 #5
0
    public void DeactivateFurnitureDeactivatesFurnitureInfoUI_Test()
    {
        // perform
        FurnitureTriggerInfo.DeactivateFurniture();

        // get
        bool active = GameObject.Find("GUI").transform.Find("FurnitureInfo").gameObject.activeSelf;

        // assert
        Assert.IsFalse(active);
    }
コード例 #6
0
    public void SetActiveFurnitureSetsCorrectFurnitureType_Test(FurnitureType expected)
    {
        // setup
        FurnitureInfo info = new FurnitureInfo(expected.ToString(), expected.ToString(), new KeyCode[] { });

        // perform
        FurnitureTriggerInfo.SetActiveFurniture(expected, info);

        // assert
        Assert.AreEqual(expected, FurnitureTriggerInfo.Type);
    }
コード例 #7
0
    public void SetActiveFurnitureThrowsWarningMessageWhenFurnitureInfoHasMoreThanTwoKeyCodes_Test()
    {
        // setup
        FurnitureInfo info = new FurnitureInfo("example", "example", new KeyCode[] { KeyCode.A, KeyCode.B, KeyCode.C });

        // perform
        FurnitureTriggerInfo.SetActiveFurniture(FurnitureType.CArm, info);

        // assert
        LogAssert.Expect(LogType.Warning, "The GUI can only handle two different keys!");
    }
コード例 #8
0
    public void SetActiveFurnitureActivatesFurnitureInfoUI_Test()
    {
        // setup
        FurnitureInfo info = new FurnitureInfo("example", "example", new KeyCode[] { });

        // perform
        FurnitureTriggerInfo.SetActiveFurniture(FurnitureType.CArm, info);

        // get
        bool active = GameObject.Find("GUI/FurnitureInfo").activeSelf;

        // assert
        Assert.IsTrue(active);
    }
コード例 #9
0
    public void SetActiveFurnitureLoadsCorrectFurnitureNameIntoUI_Test(FurnitureType type)
    {
        // setup
        string        expected = type.ToString();
        FurnitureInfo info     = new FurnitureInfo(expected, expected, new KeyCode[] { });

        // perform
        FurnitureTriggerInfo.SetActiveFurniture(type, info);

        // get
        string actual = GameObject.Find("GUI/FurnitureInfo/Name").GetComponent <TextMeshProUGUI>().text;

        // assert
        Assert.AreEqual(expected, actual);
    }
コード例 #10
0
    public void SetActiveFurnitureLoadsCorrectKeyCodesIntoUIForTwoKeys_Test(FurnitureType type, KeyCode[] keys)
    {
        // setup
        string        expected = type.ToString();
        FurnitureInfo info     = new FurnitureInfo(expected, expected, keys);

        // perform
        FurnitureTriggerInfo.SetActiveFurniture(type, info);

        // get
        string actual0 = GameObject.Find("GUI/FurnitureInfo/Keys/1/KeyName").GetComponent <TextMeshProUGUI>().text;
        string actual1 = GameObject.Find("GUI/FurnitureInfo/Keys/2/KeyName").GetComponent <TextMeshProUGUI>().text;

        // assert
        Assert.AreEqual(keys[0].ToString(), actual0);
        Assert.AreEqual(keys[1].ToString(), actual1);
    }
コード例 #11
0
    public void SetActiveFurnitureLoadsCorrectKeyCodesIntoUIForZeroKeys_Test(FurnitureType type)
    {
        // setup
        string        expected = "";
        string        name     = type.ToString();
        FurnitureInfo info     = new FurnitureInfo(name, name, new KeyCode[] {  });

        // perform
        FurnitureTriggerInfo.SetActiveFurniture(FurnitureType.CArm, info);

        // get
        string actual0 = GameObject.Find("GUI/FurnitureInfo/Keys/1/KeyName").GetComponent <TextMeshProUGUI>().text;
        string actual1 = GameObject.Find("GUI/FurnitureInfo/Keys/2/KeyName").GetComponent <TextMeshProUGUI>().text;

        // assert
        Assert.AreEqual(expected, actual0);
        Assert.AreEqual(expected, actual1);
    }