Пример #1
0
    private void Test1_2()
    {
        //On Pressed Z, test1 will (move right + move down) for 0.5 secs after moving up for 0.5 secs.
        EventPromise p = new KeyDownEvent(Params.Empty.Add("KeyCode", "Z"));

        p.StartPollUpdateGlobal();
        p.Handler.SetNewAfter((ps) =>
        {
            Params newParams = Params.Empty
                               .Add("Target", "test1")
                               .Add("Velocity", new Vector3(0.0f, 0.01f, 0.0f).GetSerialized())
                               .Add("Duration", "0.5");
            HandlerFuture hf   = new MoveConstant(newParams);
            Params rightParams = Params.Empty
                                 .Add("Target", "test1")
                                 .Add("Velocity", new Vector3(0.01f, 0.0f, 0.0f).GetSerialized())
                                 .Add("Duration", "0.5");
            Params downParams = Params.Empty
                                .Add("Target", "test1")
                                .Add("Velocity", new Vector3(0.0f, -0.01f, 0.0f).GetSerialized())
                                .Add("Duration", "0.5");
            Params leftParams = Params.Empty
                                .Add("Target", "test1")
                                .Add("Velocity", new Vector3(-0.01f, 0.0f, 0.0f).GetSerialized())
                                .Add("Duration", "0.5");
            EventPromise px = new KeyDownEvent(Params.Empty.Add("KeyCode", "X"));
            EventPromise pc = new KeyDownEvent(Params.Empty.Add("KeyCode", "C"));
            var right       = new MoveConstant(rightParams);
            var down        = new MoveConstant(downParams);
            right.AddExternalCondition(pc, (_) => down, true);
            right.AddExternalCondition(px, (_) => down, true);
            right.AddAfter((_) => right);

            return(right);
        }
                              );
        p.Handler.Begin();
    }