コード例 #1
0
 public void TestMakeDebugCopyOfAction()
 {
     {
         var    actionToClone         = new TestAction1("abc");
         bool   copyOfActionSupported = false;
         object actionBeforeDispatch  = null;
         Middlewares.MakeDebugCopyOfAction(actionToClone, ref copyOfActionSupported, ref actionBeforeDispatch);
         Assert.False(copyOfActionSupported);
     }
     {
         var    actionToClone         = new TestAction2("abc");
         bool   copyOfActionSupported = false;
         object actionBeforeDispatch  = null;
         Middlewares.MakeDebugCopyOfAction(actionToClone, ref copyOfActionSupported, ref actionBeforeDispatch);
         Assert.True(copyOfActionSupported);
     }
     {
         var objectToClone = new TestAction3()
         {
             SomeDir = EnvironmentV2.instance.GetNewInMemorySystem()
         };
         bool   copyOfActionSupported = false;
         object actionBeforeDispatch  = null;
         Middlewares.MakeDebugCopyOfAction(objectToClone, ref copyOfActionSupported, ref actionBeforeDispatch);
         Assert.False(copyOfActionSupported);
     }
 }
コード例 #2
0
        public void Should_replace_action_when_updating()
        {
            var newAction = new TestAction1();

            var rule_1 = rule_0.Update(newAction);

            Assert.NotSame(newAction, rule_0.Action);
            Assert.Same(newAction, rule_1.Action);
        }
コード例 #3
0
        public void Should_create_with_trigger_and_action()
        {
            var ruleTrigger = new ContentChangedTriggerV2();
            var ruleAction  = new TestAction1();

            var newRule = new Rule(ruleTrigger, ruleAction);

            Assert.Equal(ruleTrigger, newRule.Trigger);
            Assert.Equal(ruleAction, newRule.Action);
            Assert.True(newRule.IsEnabled);
        }
コード例 #4
0
    public void Test_AffixInteraction()
    {
        TestAffix1 testAffix1 = new TestAffix1();

        testAffix1.InitAffix();

        ActionData.AFFIX_DICTIONARY.Add(ActionData.AFFIX_LIST_ID.TEST_AFFIX_1, testAffix1);

        TestAction1 testAction1 = new TestAction1();

        testAction1.SetInitPropertiesSelfTarget();

        ActionData.ABILITY_DICTIONARY.Add(ActionData.ACTION_LIST_ID.ATTACK_BASIC, testAction1);

        Test_ListAllAffixesInDictionary();

        TestCharacter testChar1 = new TestCharacter();

        testChar1.InitChar(true);

        TestCharacter testChar2 = new TestCharacter();

        testChar2.InitChar(false);
        testChar2.m_Character.SetCharacterName("Enemy Test");

        GetPlayerManager.AddCharacterToList(testChar1.m_Character);
        GetPlayerManager.AddCharacterToList(testChar2.m_Character);



        PerformActionDataModel testDataModel = new PerformActionDataModel(ActionData.ACTION_LIST_ID.ATTACK_BASIC, GenericActionModel.ACTION_TARGET_AMOUNT.SINGLE_TARGET, testChar1.m_Character, testChar2.m_Character);

        GetCombatManager.ProcessAction(testDataModel);

        for (int i = 0; i < GetPlayerManager.GetCharacterList().Count; i++)
        {
            Debug.Log("Health - " + GetPlayerManager.GetCharacterList()[i].GetCharacterName() + " : " + GetPlayerManager.GetCharacterList()[i].GetCharacterHealth());
        }

        GetCombatManager.ProcessAffix();

        Debug.Log("Affixes Processed");

        for (int i = 0; i < GetPlayerManager.GetCharacterList().Count; i++)
        {
            Debug.Log("Health - " + GetPlayerManager.GetCharacterList()[i].GetCharacterName() + " : " + GetPlayerManager.GetCharacterList()[i].GetCharacterHealth());
        }

        Debug.Log("Test Case Over");
    }
コード例 #5
0
        public void Should_replace_action_when_updating()
        {
            var newAction1 = new TestAction1 {
                Property = "NewValue"
            };
            var newAction2 = new TestAction1 {
                Property = "NewValue"
            };

            var rule_1 = rule_0.Update(newAction1);
            var rule_2 = rule_1.Update(newAction2);

            Assert.NotSame(rule_0.Action, newAction1);
            Assert.NotSame(rule_0, rule_1);
            Assert.Same(newAction1, rule_1.Action);
            Assert.Same(newAction1, rule_2.Action);
            Assert.Same(rule_1, rule_2);
        }
コード例 #6
0
    public void Test_AddAllSkillsToList()
    {
        Debug.Log("Adding skill to the master list");

        //Need better way of doing this if possible...
        //Come into play possibly with factory and parameters to adjust for it
        TestAction1 testAction1 = new TestAction1();

        testAction1.SetInitProperties();

        //Maybe put checks around this master list?
        ActionData.ABILITY_DICTIONARY.Add(ActionData.ACTION_LIST_ID.ATTACK_BASIC, testAction1);

        //Self target
        TestAction1 testAction2 = new TestAction1();

        testAction2.SetInitPropertiesSelfTarget();

        ActionData.ABILITY_DICTIONARY.Add(ActionData.ACTION_LIST_ID.SHIELD_ONE, testAction2);

        //Multi Target All
        TestActionMulti testActionOffensive = new TestActionMulti();

        testActionOffensive.SetInitPropertiesAll();

        ActionData.ABILITY_DICTIONARY.Add(ActionData.ACTION_LIST_ID.ATTACK_ONE, testActionOffensive);


        //Multi Target Offensive
        TestActionMulti testActionMultiOffensive = new TestActionMulti();

        testActionMultiOffensive.SetInitPropertiesOffensive();

        ActionData.ABILITY_DICTIONARY.Add(ActionData.ACTION_LIST_ID.ATTACK_TWO, testActionMultiOffensive);

        //Multi Target Defensive
        TestActionMulti testActionMultiDefensive = new TestActionMulti();

        testActionMultiDefensive.SetInitPropertiesDefensive();

        ActionData.ABILITY_DICTIONARY.Add(ActionData.ACTION_LIST_ID.SHIELD_TWO, testActionMultiDefensive);
    }
コード例 #7
0
    // Start is called before the first frame update
    void Start()
    {
        fsm         = new FSM("Test Ai");
        testState1  = fsm.AddState("testState1");
        testState2  = fsm.AddState("testState2");
        testState3  = fsm.AddState("testState3");
        testAction1 = new TestAction1(testState1);
        testAction2 = new TestAction1(testState2);
        testAction3 = new TestAction1(testState3);

        finishEvent1 = new List <string>
        {
            "To 2",
            "To 3"
        };
        finishEvent2 = new List <string>
        {
            "To 1",
        };
        finishEvent3 = new List <string>
        {
            "To 1",
        };

        testState1.AddAction(testAction1);
        testState2.AddAction(testAction2);
        testState3.AddAction(testAction3);


        testState1.AddTransition("To 2", testState2);
        testState1.AddTransition("To 3", testState3);

        testState2.AddTransition("To 1", testState1);
        testState3.AddTransition("To 1", testState1);

        testAction1.init("test 1", 1f, finishEvent1);
        testAction2.init("test 2", 1f, finishEvent2);
        testAction3.init("test 3", 1f, finishEvent3);
        fsm.Start("testState1");
    }
コード例 #8
0
 public static string OnTestAction1(string name, TestAction1 action) =>
 $"{name}+{nameof(TestAction1)}";
コード例 #9
0
 private static TestState OnTestAction1(TestState state, TestAction1 action) =>
 TestState.After;
コード例 #10
0
    public void Test_UIAndCharacterInteraction()
    {
        //Test_CharacterInteraction1();
        //Test_ListAllAbilitiesInDictionary();
        //Test_ActionInteraction();
        //Test_AffixInteraction();

        TestCharacter testChar = new TestCharacter();

        testChar.InitChar(true);

        TestCharacter testChar2 = new TestCharacter();

        testChar2.InitChar(false);


        TestAffix1 testAffix1 = new TestAffix1();

        testAffix1.InitAffix();

        ActionData.AFFIX_DICTIONARY.Add(ActionData.AFFIX_LIST_ID.TEST_AFFIX_1, testAffix1);

        TestAction1 testAction1 = new TestAction1();

        testAction1.SetInitPropertiesSelfTarget();

        ActionData.ABILITY_DICTIONARY.Add(ActionData.ACTION_LIST_ID.ATTACK_BASIC, testAction1);

        TestAction1 testAction2 = new TestAction1();

        testAction2.SetInitPropertiesSelfTarget();
        testAction2.SetName("Action 2 Test");
        ActionData.ABILITY_DICTIONARY.Add(ActionData.ACTION_LIST_ID.ATTACK_ONE, testAction2);

        TestAction1 testAction3 = new TestAction1();

        testAction3.SetInitPropertiesSelfTarget();
        testAction3.SetName("Action 3 Test");
        ActionData.ABILITY_DICTIONARY.Add(ActionData.ACTION_LIST_ID.ATTACK_TWO, testAction3);

        TestAction1 testAction4 = new TestAction1();

        testAction4.SetInitPropertiesSelfTarget();
        testAction4.SetName("Action 4 Test");
        ActionData.ABILITY_DICTIONARY.Add(ActionData.ACTION_LIST_ID.ATTACK_THREE, testAction4);

        TestAction1 testAction5 = new TestAction1();

        testAction5.SetInitPropertiesSelfTarget();
        testAction5.SetName("Action 5 Test");
        ActionData.ABILITY_DICTIONARY.Add(ActionData.ACTION_LIST_ID.ATTACK_FOUR, testAction5);

        GetPlayerManager.AddCharacterToList(testChar.m_Character);
        GetPlayerManager.AddCharacterToList(testChar2.m_Character);

        m_CombatManager.m_CurrentPlayer = testChar.m_Character;

        //PerformActionDataModel testDataModel = new PerformActionDataModel(ActionData.ACTION_LIST_ID.ATTACK_BASIC, GenericActionModel.ACTION_TARGET_AMOUNT.SINGLE_TARGET, testChar.m_Character, testChar2.m_Character);

        //GetCombatManager.ProcessAction(testDataModel);

        cbIntTest.CreateCharacterInformationDisplay(testChar.m_Character);
        cbIntTest.CreateCharacterInformationDisplay(testChar2.m_Character);
    }