Esempio n. 1
0
    public void _10_2_AssumeSpanWithInfinity()
    {
        int frame    = 0;
        var context0 = PlayerContext.Copy(dummyContext);

        var auto0 = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "RunRoutine0",
            frame,
            context0,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutine0TL",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutine0Tack",
                    0,
                    AutomatineDefinitions.Tack.LIMIT_UNLIMITED,
                    AutoConditions.Act.P0,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                )
            );

        var assumeSpan = auto0.AssumedRestFrame();

        if (assumeSpan == AutomatineDefinitions.Tack.LIMIT_UNLIMITED)
        {
            return;
        }

        Debug.LogError("failed to assume span. assumeSpan:" + assumeSpan);
    }
Esempio n. 2
0
 public AutoForTest40_5(int frame, InitialParamType context) : base(
         "AutoForTest40_5 sample auto",
         frame,
         context,
         new List <IAutoChanger>(),
         new List <IAutoChanger> {
     new Changer_ChangerForTest40_5()
 },
         new Timeline <InitialParamType, UpdateParamType>(
             "timelineTitle",
             new Tack <InitialParamType, UpdateParamType>(
                 "tackTitle",
                 0,
                 3,
                 AutoConditions.Act.P2,
                 () =>
 {
     var c      = new RoutineContexts <InitialParamType, UpdateParamType>();
     c.rContext = c.StackChangerFromCoroutineLoopForAnotherChanger;
     return(c);
 }
                 )
             )
         )
 { }
Esempio n. 3
0
    public void _5_7_CancelAnotherRoutineByBreakAutoAndBreakTack()
    {
        int frame   = 0;
        var context = PlayerContext.Copy(dummyContext);

        var auto = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "5_7",
            frame,
            context,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "5_7TL",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "5_7R",
                    0,
                    100,
                    AutoConditions.Act.FIVEFRAME_SPAN,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._CancelRoutineByBreakAutoAndBreakTack;
            return(c);
        },
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._NeverRun;
            return(c);
        }
                    )
                )
            );

        auto.Update(frame, dummyContexts);
    }
Esempio n. 4
0
    public void _4_1_ContinuationWithBreakAllTimeline()
    {
        int frame   = 0;
        var context = PlayerContext.Copy(dummyContext);

        var auto = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "ContinuationWithBreakTimeline",
            frame,
            context,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "ContinuationWithBreakTimelineTL",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "ContinuationWithBreakTimelineRoutine",
                    0,
                    100,
                    AutoConditions.Act.FIVEFRAME_SPAN,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._BreakTimeline;
            return(c);
        }
                    )
                )
            );

        auto.Update(frame, dummyContexts);
        if (auto.ShouldFalldownInNextFrame(frame))
        {
            return;
        }

        Debug.LogError("failed to consume Auto:" + auto.autoInfo);
    }
Esempio n. 5
0
    public void _5_2_CancelThisRoutineByBreakAuto()
    {
        int frame   = 0;
        var context = PlayerContext.Copy(dummyContext);

        var auto = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "5_2",
            frame,
            context,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "5_2TL",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "5_2R",
                    0,
                    100,
                    AutoConditions.Act.FIVEFRAME_SPAN,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._CancelThisRoutineByBreakAuto;
            return(c);
        }
                    )
                )
            );

        auto.Update(frame, dummyContexts);
    }
Esempio n. 6
0
 public AutoForTest40_2(int frame, InitialParamType context) : base(
         "test40_2 sample auto",
         frame,
         context,
         new List <IAutoChanger> {
     new Changer_ChangerForTest40_1()
 },
         new List <IAutoChanger> {
     new Changer_ChangerForTest40_1()
 },
         new Timeline <InitialParamType, UpdateParamType>(
             "timelineTitle",
             new Tack <InitialParamType, UpdateParamType>(
                 "tackTitle",
                 0,
                 3,
                 AutoConditions.Act.P1,
                 () =>
 {
     var c      = new RoutineContexts <InitialParamType, UpdateParamType>();
     c.rContext = c.WalkReady;
     return(c);
 }
                 )
             )
         )
 { }
Esempio n. 7
0
    public void _30_2_ChangerWithResultOfTest24_TestRoute2()
    {
        int frame    = 100;
        var context0 = PlayerContext.Copy(dummyContext);

        var auto0 = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "RunRoutine0",
            frame,
            context0,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutine0TL_0",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutine0Tack_0",
                    0,
                    1,
                    AutoConditions.Act.DEFAULT,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                )
            );

        auto0 = Changer_TestRoute2.TestRoute2(auto0, frame, context0);
        var conditions = auto0.Conditions();

        if (conditions.ContainsCondition(AutoConditions.Move.WALK_READY))
        {
            return;
        }
        Debug.LogError("failed to run behaviour");
    }
Esempio n. 8
0
 public AutoForTest6(int frame, T1 context) : base(
         "test40 sample auto",
         frame,
         context,
         new List <IAutoChanger> {
     new Changer_ChangerForTest40()
 },
         new List <IAutoChanger> {
     new Changer_ChangerForTest40()
 },
         new Timeline <T1, T2>(
             "timelineTitle",
             new Tack <T1, T2>(
                 "tackTitle",
                 0,
                 3,
                 AutoConditions.Act.P0,
                 () =>
 {
     var c      = new RoutineContexts <T1, T2>();
     c.rContext = c.WalkReady;
     return(c);
 }
                 )
             )
         )
 { }
Esempio n. 9
0
    public void _7_4_InheritTimelineFromBrokeAuto()
    {
        int frame   = 0;
        var context = PlayerContext.Copy(dummyContext);

        var auto0 = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "7_4_0",
            frame,
            context,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "7_4_0TL",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "7_4_0R",
                    0,
                    100,
                    AutoConditions.Act.FIVEFRAME_SPAN,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._BreakAuto;
            return(c);
        }
                    )
                )
            );

        auto0.Update(frame, dummyContexts);

        var inheritTimelines = auto0.ExportTimelines(typeof(AutoConditions.Act));

        if (inheritTimelines.Count != 1)
        {
            Debug.LogError("failed to inherit timeline");
        }
    }
Esempio n. 10
0
    public void _15_1_AutoWithSpace_Conditions_NextIs100Frame()
    {
        int frame    = 0;
        var context0 = PlayerContext.Copy(dummyContext);

        var auto0 = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "RunRoutine0",
            frame,
            context0,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutine0TL_0",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutine0Tack_0",
                    0,// from 0, 10frame -> 0 ~ 9
                    10,
                    AutoConditions.Act.P0
                    ),
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutine0Tack_0",
                    100,// from 100, 100frame -> 100 ~ 199
                    100,
                    AutoConditions.Act.P0
                    )
                ),
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutine0TL_1",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutine0Tack_1",
                    0,
                    5,
                    AutoConditions.Anim.DEFAULT,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                )
            );

        for (var i = 0; i <= 100; i++)
        {
            auto0.Update(frame, dummyContexts);
            frame++;
        }

        // frame is 100.
        auto0.Update(frame, dummyContexts);


        var cond0 = auto0.Conditions();

        if (ConditionGateway.Contains(cond0, AutoConditions.Act.P0))
        {
            return;
        }

        Debug.LogError("not match.");
    }
Esempio n. 11
0
 public Auto_Default2(int frame, InitialParamType initialParam) : base(
         "autoInfo",
         frame,
         initialParam
         ,
         new Timeline <InitialParamType, UpdateParamType>(
             "timelineInfo_0"
             ,
             new Tack <InitialParamType, UpdateParamType>(
                 "tackInfo_0",
                 0,
                 1
                 ),
             new Tack <InitialParamType, UpdateParamType>(
                 "tackInfo_1",
                 1,
                 10
                 ,
                 () => {
     var c      = new RoutineContexts <InitialParamType, UpdateParamType>();
     c.rContext =
         c.Default
     ;
     return(c);
 }
                 )
             )
         ) {}
Esempio n. 12
0
    /**
     *          特定のconditionが特定のフレーム数存在している
     *          二つのTackにまたがる場合
     */
    public void _2_3_ConditionContinuesIn10FrameBetween2Tack()
    {
        int frame   = 0;
        var context = PlayerContext.Copy(dummyContext);

        var auto = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "5フレーム、特定のconditionを維持する",
            frame,
            context,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "5フレーム、特定のconditionを維持するTL",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "5フレーム、特定のconditionを維持するTack",
                    0,
                    5,
                    AutoConditions.Act.TENFRAME_SPAN,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    ),
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "さらに5フレーム、特定のconditionを維持するTack",
                    5,
                    5,
                    AutoConditions.Act.TENFRAME_SPAN,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                )
            );

        int count = 0;

        for (int i = 0; i < 10; i++)
        {
            auto.Update(frame, dummyContexts);
            var conditions = auto.Conditions();

            if (ConditionGateway.Contains(conditions, AutoConditions.Act.TENFRAME_SPAN))
            {
                count++;
            }
            frame = frame + 1;
        }

        if (count == 10)
        {
        }
        else
        {
            Debug.LogError("failed. not match count:" + count);
        }
    }
Esempio n. 13
0
 /**
  *      set new "spawn" auto to this player.
  */
 public SpawnAuto(int frame, InitialParamType context) : base(
         "spawn開始",
         frame,
         context,
         new Timeline <InitialParamType, UpdateParamType>(
             "Spawn処理",
             new Tack <InitialParamType, UpdateParamType>(
                 "spawning",
                 0,
                 AutomatineDefinitions.Tack.LIMIT_UNLIMITED,
                 AutoConditions.Act.SPAWN,
                 () => {
     var c      = new RoutineContexts <InitialParamType, UpdateParamType>();
     c.rContext = c.Spawn;
     return(c);
 }
                 )
             ),
         new Timeline <InitialParamType, UpdateParamType>(
             "Spawn時のモーション",
             new Tack <InitialParamType, UpdateParamType>(
                 "まだ真面目にセットしてない、Spawn時のモーション",
                 0,
                 10,
                 AutoConditions.Anim.SPAWN,
                 () => {
     var c      = new RoutineContexts <InitialParamType, UpdateParamType>();
     c.rContext = c.SpawnMotion;
     return(c);
 }
                 )
             )
         ) {}
Esempio n. 14
0
    public void _11_3_AutoReturnsUnUpdatedConditions()
    {
        int frame    = 100;
        var context0 = PlayerContext.Copy(dummyContext);

        var auto0 = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "RunRoutine0",
            frame,
            context0,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutine0TL",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutine0Tack_0",
                    0,
                    1,
                    AutoConditions.Act.P0,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                )
            );

        var conditions = auto0.Conditions();

        if (ConditionGateway.Contains(conditions, AutoConditions.Act.P0))
        {
            return;
        }

        Debug.LogError("failed to get conditions");
    }
Esempio n. 15
0
    public void _15_3_AutoWithSpace_Conditions_KeepCondition_Later()
    {
        int frame    = 0;
        var context0 = PlayerContext.Copy(dummyContext);

        var auto0 = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "RunRoutine0",
            frame,
            context0,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutine0TL_0",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutine0Tack_0",
                    0,// from 0, 10frame -> 0 ~ 9
                    10,
                    AutoConditions.Act.P0
                    ),
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutine0Tack_0",
                    100,// from 100, 100frame -> 100 ~ 199
                    100,
                    AutoConditions.Act.P0
                    )
                ),
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutine0TL_1",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutine0Tack_1",
                    0,
                    5,
                    AutoConditions.Move.WALK_READY,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                )
            );

        while (frame < 200)
        {
            auto0.Update(frame, dummyContexts);
            frame++;
        }

        // frame is 200.
        auto0.Update(frame, dummyContexts);

        var cond0 = auto0.Conditions();

        if (ConditionGateway.NotContains(cond0, AutoConditions.Act.P0))
        {
            return;
        }

        Debug.LogError("not match.");
    }
Esempio n. 16
0
    public void _4_6_ContinuationWithAllTimelineConsumed()
    {
        int frame   = 0;
        var context = PlayerContext.Copy(dummyContext);

        var auto = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "ContinuationWithAllTimelineConsumed",
            frame,
            context,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "ContinuationWithAllTimelineConsumedTL",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "ContinuationWithAllTimelineConsumedRoutine",
                    0,
                    1,
                    AutoConditions.Act.FIVEFRAME_SPAN,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                ),
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "ContinuationWithAllTimelineConsumedTL",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "ContinuationWithAllTimelineConsumedRoutine",
                    1,
                    1,
                    AutoConditions.Act.FIVEFRAME_SPAN,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                )
            );

        auto.Update(frame, dummyContexts);

        frame++;

        // every timelines are consumed.
        auto.Update(frame, dummyContexts);

        frame++;

        if (auto.ShouldFalldown(frame))
        {
            return;
        }

        Debug.LogError("failed to check continue.");
    }
Esempio n. 17
0
    public void _6_13_AutoConditionWithConsumeOneTimelineByBreackTimeline()
    {
        int frame   = 0;
        var context = PlayerContext.Copy(dummyContext);

        var auto = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "6_2",
            frame,
            context,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "6_2TL_0",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "6_2R_0",
                    0,
                    100,
                    AutoConditions.Act.FIVEFRAME_SPAN,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._BreakTimeline;
            return(c);
        }
                    )
                ),
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "6_2TL_1",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "6_2R_1",
                    0,
                    100,
                    AutoConditions.Move.WALK_READY,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                )
            );

        auto.Update(frame, dummyContexts);

        // var conditions = auto.Conditions();

        // AutoConditions.Act.FIVEFRAME_SPAN Timeline is over.
        if (auto.NotContains(AutoConditions.Act.FIVEFRAME_SPAN))
        {
            if (auto.Contains(AutoConditions.Move.WALK_READY))
            {
                return;
            }
        }

        Debug.LogError("failed to break timeline");
    }
Esempio n. 18
0
    /**
     *          複数のTimelineでSampleRoutineをN回走らせる
     */
    public void _0_3_RunRoutine_2Timelines_NTimes()
    {
        var N = 100;

        int frame    = 0;
        var context1 = PlayerContext.Copy(dummyContext);

        var auto = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "RunRoutine",
            frame,
            context1,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutineTL",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutineTack",
                    0,
                    AutomatineDefinitions.Tack.LIMIT_UNLIMITED,
                    AutoConditions.Act.SAMPLEROUTINE,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c.SampleRoutine;
            return(c);
        }
                    )
                ),
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutineTL",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutineTack",
                    0,
                    AutomatineDefinitions.Tack.LIMIT_UNLIMITED,
                    AutoConditions.Act.SAMPLEROUTINE,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c.SampleRoutine;
            return(c);
        }
                    )
                )
            );

        for (int i = 0; i < N; i++)
        {
            auto.Update(frame + i, dummyContexts);
        }

        // if routine runs, life == N * 2.
        if (dummyContext.life == N * 2)
        {
            return;
        }

        Debug.LogError("failed, dummyContext.life:" + dummyContext.life);
    }
Esempio n. 19
0
    public void _0_4_RunRoutine_2Timelines_2ndTimelineFirst()
    {
        int frame    = 0;
        var context1 = PlayerContext.Copy(dummyContext);

        var auto = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "RunRoutine",
            frame,
            context1,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutineTL0",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutineTack",
                    1,
                    1,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c.Should2nd;
            return(c);
        }
                    )
                ),
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutineTL1",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutineTack",
                    0,
                    1,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c.Should1st;
            return(c);
        }
                    )
                )
            );


        auto.Update(frame, new Dictionary <string, PlayerContext>());
        frame++;

        auto.Update(frame, new Dictionary <string, PlayerContext>());
        frame++;

        var runMark = context1.runMark;

        if (runMark == "1st2nd")
        {
            return;
        }

        Debug.LogError("failed. runMark:" + runMark);
    }
Esempio n. 20
0
 public ConditionChangeAuto0(int frame, InitialParamType context) : base(
         "ConditionChangeAuto0",
         frame,
         context,
         new Timeline <InitialParamType, UpdateParamType>(
             "ConditionChangeAuto0TL0",
             new Tack <InitialParamType, UpdateParamType>(
                 "ConditionChangeAuto0Tack0",
                 0,
                 1,
                 AutoConditions.Act.P1,
                 () => {
     var c      = new RoutineContexts <InitialParamType, UpdateParamType>();
     c.rContext = c._Infinity;
     return(c);
 }
                 ),
             new Tack <InitialParamType, UpdateParamType>(
                 "ConditionChangeAuto0Tack1",
                 1,
                 1,
                 AutoConditions.Act.P2,
                 () => {
     var c      = new RoutineContexts <InitialParamType, UpdateParamType>();
     c.rContext = c._Infinity;
     return(c);
 }
                 )
             ),
         new Timeline <InitialParamType, UpdateParamType>(
             "ConditionChangeAuto0TL1",
             new Tack <InitialParamType, UpdateParamType>(
                 "ConditionChangeAuto0Tack2",
                 0,
                 1,
                 AutoConditions.Canc.WALK,
                 () => {
     var c      = new RoutineContexts <InitialParamType, UpdateParamType>();
     c.rContext = c._Infinity;
     return(c);
 }
                 ),
             new Tack <InitialParamType, UpdateParamType>(
                 "ConditionChangeAuto0Tack3",
                 1,
                 1,
                 AutoConditions.Canc.DASH,
                 () => {
     var c      = new RoutineContexts <InitialParamType, UpdateParamType>();
     c.rContext = c._Infinity;
     return(c);
 }
                 )
             )
         ) {}
Esempio n. 21
0
    public void _6_6_ConditionWithBreakTimelineSandwich()
    {
        int frame   = 0;
        var context = PlayerContext.Copy(dummyContext);

        var auto = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "auto",
            frame,
            context,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "tl_0",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "r_0",
                    0,
                    100,
                    AutoConditions.Act.P0,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._BreakTimelineThenGetConditionsAndBreakAutoIfConditionIsChanged;
            return(c);
        }
                    )
                ),
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "tl_1",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "r_1",
                    0,
                    100,
                    AutoConditions.Move.WALK_READY,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                )
            );

        dummyContext.auto = auto;

        auto.Update(frame, dummyContexts);
        frame++;

        if (auto.ShouldFalldown(frame))
        {
            return;
        }

        Debug.LogError("failed to break timeline");
    }
Esempio n. 22
0
 public TestAuto(int frame, InitialParamType initialParam) : base(
         "generated by automatine.",
         frame,
         initialParam
         ,
         new Timeline <InitialParamType, UpdateParamType>(
             "New Timeline"
             ,
             new Tack <InitialParamType, UpdateParamType>(
                 "",
                 14,
                 12
                 ,
                 AutoConditions.Damaged.CounterHit
                 ,
                 () => {
     var c      = new RoutineContexts <InitialParamType, UpdateParamType>();
     c.rContext =
         c.ShouldRun1st
     ;
     return(c);
 }
                 )
             ),
         new Timeline <InitialParamType, UpdateParamType>(
             "New Timeline"
             ,
             new Tack <InitialParamType, UpdateParamType>(
                 "",
                 7,
                 1
                 ,
                 AutoConditions.Damage.Lv1
                 ),
             new Tack <InitialParamType, UpdateParamType>(
                 "",
                 22,
                 1
                 ,
                 AutoConditions.Damage.Damagable
                 )
             ),
         new Timeline <InitialParamType, UpdateParamType>(
             "New Timeline"
             ,
             new Tack <InitialParamType, UpdateParamType>(
                 "",
                 0,
                 -1
                 )
             )
         ) {}
Esempio n. 23
0
    public void _1_2_RunContainsAllSpecificConditionInTimelines()
    {
        int frame   = 0;
        var context = PlayerContext.Copy(dummyContext);

        var auto = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "spawn開始",
            frame,
            context,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "Spawn処理",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "spawning",
                    0,
                    AutomatineDefinitions.Tack.LIMIT_UNLIMITED,
                    AutoConditions.Act.SPAWN,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c.Spawn;
            return(c);
        }
                    )
                ),
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "Spawn時のモーション",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "まだ真面目にセットしてない、Spawn時のモーション",
                    0,
                    10,
                    AutoConditions.Anim.SPAWN,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c.SpawnMotion;
            return(c);
        }
                    )
                )
            );

        var conditions = auto.Conditions();

        if (ConditionGateway.ContainsAll(conditions, AutoConditions.Act.SPAWN, AutoConditions.Anim.SPAWN))
        {
            // no problem
        }
        else
        {
            Debug.LogError("not contains act & anim SPAWN");
        }
    }
Esempio n. 24
0
    public void _10_5_AssumeSpanInProgress()
    {
        int frame    = 0;
        var context0 = PlayerContext.Copy(dummyContext);

        var auto0 = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "RunRoutine0",
            frame,
            context0,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutine0TL_0",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutine0Tack_0",
                    0,
                    10,
                    AutoConditions.Act.P0,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                ),
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutine0TL_1",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutine0Tack_1",
                    0,
                    5,
                    AutoConditions.Act.P1,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                )
            );

        auto0.Update(frame, dummyContexts);

        var assumeSpan = auto0.AssumedRestFrame();

        if (assumeSpan == 8)
        {
            return;
        }

        Debug.LogError("failed to assume span. assumeSpan:" + assumeSpan);
    }
Esempio n. 25
0
    public void _1_4_RunNotContainsAllSpecificConditionInTimelines()
    {
        int frame   = 0;
        var context = PlayerContext.Copy(dummyContext);

        var auto = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "デフォルト状態",
            frame,
            context,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "基本モーション",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "基礎行動",
                    0,
                    AutomatineDefinitions.Tack.LIMIT_UNLIMITED,
                    AutoConditions.Act.DEFAULT,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c.Default;
            return(c);
        }
                    )
                ),
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "アニメーションTL",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "アニメーションTack",
                    0,
                    AutomatineDefinitions.Tack.LIMIT_UNLIMITED,
                    AutoConditions.Anim.DEFAULT,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                )
            );

        var conditions = auto.Conditions();

        if (ConditionGateway.NotContainsAll(conditions, AutoConditions.Act.SPAWN, AutoConditions.Anim.SPAWN))
        {
            // no problem
        }
        else
        {
            Debug.LogError("not contains act & anim SPAWN");
        }
    }
Esempio n. 26
0
    public void _6_0_ConditionWithSkipTackByBreackTack()
    {
        int frame   = 0;
        var context = PlayerContext.Copy(dummyContext);

        var auto = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "6_0",
            frame,
            context,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "6_0TL",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "6_0R_0",
                    0,
                    100,
                    AutoConditions.Act.FIVEFRAME_SPAN,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._BreakTack;
            return(c);
        }
                    ),
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "6_0R_1",
                    100,
                    100,
                    AutoConditions.Act.TENFRAME_SPAN,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                )
            );

        auto.Update(frame, dummyContexts);

        // breakTackしたら何を証明したいか。


        var conditions = auto.Conditions();

        if (ConditionGateway.NotContains(conditions, AutoConditions.Act.FIVEFRAME_SPAN))
        {
            return;
        }

        Debug.LogError("failed to break tack");
    }
Esempio n. 27
0
    public void _12_1_TimelineExportError()
    {
        int frame    = 100;
        var context0 = PlayerContext.Copy(dummyContext);

        var auto0 = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "RunRoutine0",
            frame,
            context0,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutine0TL_0",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutine0Tack_0",
                    0,
                    1,
                    AutoConditions.Act.P0,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                ),
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutine0TL_1",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutine0Tack_1",
                    0,
                    1,
                    AutoConditions.Act.P0,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                )
            );

        var inheritTimelines = auto0.ExportTimelines(typeof(AutoConditions.Act));

        if (inheritTimelines.Count == 1)
        {
            return;
        }


        Debug.LogError("failed to export invalid conditions");
    }
Esempio n. 28
0
    public void _11_8_AutoWillChangeByAutoDotBreakTimelinesThenAutoIsBroken2()
    {
        int frame    = 100;
        var context0 = PlayerContext.Copy(dummyContext);

        var auto0 = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "RunRoutine0",
            frame,
            context0,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutine0TL_0",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutine0Tack_0",
                    0,
                    10,
                    AutoConditions.Act.P0,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                ),
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutine0TL_1",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutine0Tack_1",
                    10,
                    10,
                    AutoConditions.Anim.DEFAULT,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                )
            );

        auto0.Update(frame, dummyContexts);
        auto0.BreakTimelines(typeof(AutoConditions.Act), typeof(AutoConditions.Anim));

        if (auto0.ShouldFalldownInNextFrame(frame))
        {
            return;
        }

        Debug.LogError("failed to break timeline");
    }
Esempio n. 29
0
    public void _10_11_RoutineRetrieveConditions()
    {
        int frame    = 0;
        var context0 = PlayerContext.Copy(dummyContext);

        var auto0 = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "RunRoutine0",
            frame,
            context0,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutine0TL_0",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutine0Tack_0",
                    0,
                    1,
                    AutoConditions.Anim.DEFAULT,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._BreakAutoIfConditionsContainsSpecific;
            return(c);
        }
                    )
                ),
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutine0TL_1",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutine0Tack_1",
                    0,
                    10,
                    AutoConditions.Act.P0,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                )
            );

        auto0.Update(frame, dummyContexts);
        frame++;

        if (auto0.ShouldFalldown(frame))
        {
            return;
        }

        Debug.LogError("failed to retrieve conditions");
    }
Esempio n. 30
0
    public void _13_1_DirectionChangeAutoTwice()
    {
        int frame    = 100;
        var context0 = PlayerContext.Copy(dummyContext);

        var auto = new Auto <PlayerContext, Dictionary <string, PlayerContext> >(
            "RunRoutine0",
            frame,
            context0,
            new Timeline <PlayerContext, Dictionary <string, PlayerContext> >(
                "RunRoutine0TL_0",
                new Tack <PlayerContext, Dictionary <string, PlayerContext> >(
                    "RunRoutine0Tack_0",
                    0,
                    1,
                    AutoConditions.Act.P0,
                    () =>
        {
            var c      = new RoutineContexts <PlayerContext, Dictionary <string, PlayerContext> >();
            c.rContext = c._Infinity;
            return(c);
        }
                    )
                )
            );

        auto = auto.Changer_ConditionChange0(frame, context0);
        auto = auto.Changer_ConditionChange1(frame, context0);

        var conditions = auto.Conditions();

        if (conditions.ContainsCondition(AutoConditions.Act.P0))
        {
            Debug.LogError("failed to change");
            return;
        }

        if (conditions.ContainsCondition(AutoConditions.Act.P1) &&
            conditions.ContainsCondition(AutoConditions.Canc.WALK))
        {
            Debug.LogError("failed to change");
            return;
        }

        if (conditions.ContainsAllConditions(AutoConditions.Act.P3, AutoConditions.Canc.DASH))
        {
            return;
        }

        Debug.LogError("failed to change");
    }