当前位置: 首页>>代码示例>>C#>>正文


C# FSM.Move方法代码示例

本文整理汇总了C#中FSM.Move方法的典型用法代码示例。如果您正苦于以下问题:C# FSM.Move方法的具体用法?C# FSM.Move怎么用?C# FSM.Move使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FSM的用法示例。


在下文中一共展示了FSM.Move方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Awake

 void Awake()
 {
     t = new FSM();
     
     t.OnMove(string.Empty, "Start", OnStarted);
     
     t.OnEvent("Start.FixedUpdate, Start2.FixedUpdate", (s, e, args) => {
        Debug.LogFormat("State: {0}, Event: {1}, Args[0]= {2}, t = {3}", s, e, args[0], time); 
        if (s == "Start") 
        {
         time += (float) args[0];
         if (time > 10.0f) {
             time = 0.0f;
             t.Move("Start2");
         }
        }
     });
     
     t.OnEvent("Start2.FixedUpdate", Start2FixedUpdate);
     
 }
开发者ID:r57s,项目名称:fsm,代码行数:21,代码来源:FSMTests.cs

示例2: Init

        static void Init()
        {
            c = new FSM();

            c.OnTrigger("NULL.connect", args =>
            {
                if (args.Length != 0 && args[0] is Library.SerialNumber)
                {
                    Target = Z.CopySerialNumber((Library.SerialNumber) args[0]);
                }
                else
                {
                    Target = new Library.SerialNumber();
                    Target.Part = new byte[8];
                }

                V.Navigate("Connect");
                V.ConnectTrigger("connecting", Target);
                Z.Connect();
                c.Move("connect");
            });

            c.OnTrigger("connect.connect", args =>
            {
                V.ConnectTrigger("connecting", Target);
                Z.Connect();
            });

            c.OnTrigger("connect.connected", args =>
            {
                if (Target.Part != null && Z.IsNullSerialNumber(Target) == false && Z.IsSerialNumber(Target) == false)
                {
                    V.ConnectTrigger("unexpected_serial", Target);
                    Library.Disconnect(Z.Handle);
                    return;
                }

                V.ConnectTrigger("connected");
                T.Trigger("connected");
            });

            c.OnTrigger("connect.booted", args =>
            {
                V.ConnectTrigger("booted");
            });

            c.OnTrigger("connect.not_connected", args =>
            {
                V.ConnectTrigger("not_connected");
                T.Trigger("not_connected");
            });

            c.OnTrigger("connect.not_still", args =>
            {
                V.ConnectTrigger("not_still");
                T.Trigger("not_still");
            });

            c.OnTrigger("connect.need_to_update", args =>
            {
                V.ConnectTrigger("need_to_update");
                T.Trigger("need_to_update");
            });

            c.OnTrigger("connect.drone_not_associated", args =>
            {
                V.ConnectTrigger("drone_not_associated");
                T.Trigger("drone_not_associated");
            });

            c.OnTrigger("connect.bad_update", args =>
            {
                V.ConnectTrigger("bad_update");
                T.Trigger("bad_update");
            });

            c.OnTrigger("connect.firmware_upgrade_start", args =>
            {
                if (Z.IgnoreConnecting == false)
                    V.ConnectTrigger("firmware_upgrade_start");
                T.Trigger("firmware_upgrade_start");
            });

            c.OnTrigger("connect.firmware_upgrade_in_progress", args =>
            {
                int percentage = LibZano.Library.GetFirmwareUploadProgress(Z.Handle);
                if (Z.IgnoreConnecting == false)
                V.ConnectTrigger("firmware_upgrade_in_progress", percentage);
                T.Trigger("firmware_upgrade_in_progress", percentage);
            });

            c.OnTrigger("connect.firmware_upgrade_start_complete", args =>
            {
                if (Z.IgnoreConnecting == false)
                    V.ConnectTrigger("firmware_upgrade_start_complete");
                T.Trigger("firmware_upgrade_start_complete");
            });

            c.OnTrigger("connect.firmware_upgrade_start_failed", args =>
            {
//.........这里部分代码省略.........
开发者ID:torquing,项目名称:ZanoFineTuning,代码行数:101,代码来源:Connect.cs


注:本文中的FSM.Move方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。