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


C# IBehavior类代码示例

本文整理汇总了C#中IBehavior的典型用法代码示例。如果您正苦于以下问题:C# IBehavior类的具体用法?C# IBehavior怎么用?C# IBehavior使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: OnChildStatusChanged

        // OLD - use Default RP instead?
        ///// <summary>
        ///// If null, throw an exception when trying to run a child with no IHasStatusRecurranceParameters
        ///// </summary>
        //TimeSpan? DefaultInterval = null;

        protected override void OnChildStatusChanged(IBehavior child, BehaviorStatus oldStatus, BehaviorStatus newStatus)
        {
            if (child.IsFinished)
            {
                var finishedChildrenCopy = finishedChildren;
                if (finishedChildrenCopy != null)
                {
                    finishedChildrenCopy.Add(child);
                }
                this.children.Remove(child);

#if LOG_TASK_FINISHED
                l.Info("Task finished: " + child.ToString());
#endif
            }
            
            switch (newStatus)
            {
                case BehaviorStatus.Uninitialized:
                    break;
                case BehaviorStatus.Initialized:
                    break;
                case BehaviorStatus.Running:
                    break;
                case BehaviorStatus.Failed:
                    break;
                case BehaviorStatus.Succeeded:
                    break;
                case BehaviorStatus.Disposed:
                    break;
                default:
                    break;
            }
        }        
开发者ID:jaredthirsk,项目名称:LionFire.Behaviors,代码行数:40,代码来源:TaskRunner.cs

示例2: StartChild

        private void StartChild(IBehavior child)
        {
            child.Start();
            //IPolledStatus polledChild = child as IPolledStatus;

            //if (polledChild == null)
            //{
            //}
            //else
            //{
                
            //    RecurranceParameters rp = null;
            //    var hasRP = child as IHasStatusRecurranceParameters;
            //    if (hasRP != null)
            //    {
            //        rp = hasRP.StatusRecurranceParameters;
            //    }

            //    if (rp == null)
            //    {
            //        if (!DefaultInterval.HasValue)
            //        {
            //            throw new Exception("Children must have RecurranceParameters, or DefaultInterval must be set.");
            //        }
            //        else
            //        {
            //            rp = new RecurranceParameters() { Interval = DefaultInterval.Value };
            //        }
            //    }

            //    var poller = new StatusPoller(child, rp);
            //    poller.IsEnabled = true;
            //}
        }
开发者ID:jaredthirsk,项目名称:LionFire.Behaviors,代码行数:34,代码来源:TaskRunner.cs

示例3: OnSelectedStatusChangedForTo

        protected override void OnSelectedStatusChangedForTo(IBehavior child, BehaviorStatus oldStatus, BehaviorStatus status)
        {
#if SanityChecks
            if (child != SelectedChild)
            {
                l.Warn("child != SelectedChild");
                return;
            }
#endif

            switch (status)
            {
                //case BehaviorStatus.Uninitialized:
                //    break;
                //case BehaviorStatus.Initialized:
                //    break;
                case BehaviorStatus.Running:
                    // It is running as expected
                    break;
                case BehaviorStatus.Failed:
                    Fail(child.StatusMessage);
                    break;
                case BehaviorStatus.Succeeded:
                    if (Advance() == BehaviorStatus.Succeeded)
                    {
                        Succeed();
                    }
                    break;
                //case BehaviorStatus.Disposed:
                //    break;
                default:
                    l.Warn("UNEXPECTED Sequencer child state: " + child.ToString());
                    break;
            }
        }
开发者ID:jaredthirsk,项目名称:LionFire.Behaviors,代码行数:35,代码来源:Sequencer.cs

示例4: PauseDirective

 public PauseDirective(float duration, IBehavior caller)
 {
     Behavior = caller;
     this.duration = duration;
     this.pause_start = Time.time;
     Priority = 1;
 }
开发者ID:DavidMann10k,项目名称:Marionette,代码行数:7,代码来源:PauseDirective.cs

示例5: EnumerableBehavior

        public EnumerableBehavior(IBehavior behavior, IBehavior superclass, Machine machine)
            : base(behavior, superclass, machine, typeof(IEnumerable))
        {
            string dosource = @"
            do: aBlock
            | enumerator |

            enumerator := self !GetEnumerator.

            [enumerator !MoveNext] whileTrue:
            [ aBlock value: enumerator !Current ]
            ";
            string selectsource = @"
            select: aBlock
            | enumerator list |

            enumerator := self !GetEnumerator.
            list := @System.Collections.ArrayList !new.

            [enumerator !MoveNext] whileTrue:
            [ | item |
              item := enumerator !Current.
            (aBlock value: item) ifTrue:  [ list add: item ]
            ].
            ^list
            ";

            Parser parser = new Parser(dosource);
            this.DefineInstanceMethod(parser.CompileInstanceMethod(this));
            parser = new Parser(selectsource);
            this.DefineInstanceMethod(parser.CompileInstanceMethod(this));
            this.DefineInstanceMethod(new FunctionalMethod("includes:", this, this.IncludesMethod));
        }
开发者ID:ajlopez,项目名称:AjTalk,代码行数:33,代码来源:EnumerableBehavior.cs

示例6: NativeObjectBehavior

 public NativeObjectBehavior(IBehavior behavior, IBehavior superclass, Machine machine)
     : base(behavior, superclass, machine, typeof(object))
 {
     this.DefineInstanceMethod(new FunctionalMethod("isNil", this, this.IsNil));
     this.DefineInstanceMethod(new FunctionalMethod("isNotNil", this, this.IsNotNil));
     this.DefineInstanceMethod(new FunctionalMethod("ifNil:", this, this.IfNil));
     this.DefineInstanceMethod(new FunctionalMethod("ifNotNil:", this, this.IfNotNil));
 }
开发者ID:ajlopez,项目名称:AjTalk,代码行数:8,代码来源:NativeObjectBehavior.cs

示例7: AddBehavior

 public bool AddBehavior(int position, IBehavior behavior)
 {
     if (position < 0 || position > this.Behaviors.Length)
         return false;
     if (behavior == null)
         return false;
     return true;
 }
开发者ID:Kaitosos,项目名称:MazerOrOfficeGame,代码行数:8,代码来源:Splitt.cs

示例8: UnregisterBehavior

        /// <summary>
        /// Unregisters the behavior.
        /// </summary>
        /// <param name="behavior">The behavior.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="behavior"/> is <c>null</c>.</exception>
        public void UnregisterBehavior(IBehavior behavior)
        {
            Argument.IsNotNull("behavior", behavior);

            //_behaviors.Remove(behavior);

            BehaviorUnloaded.SafeInvoke(this, new BehaviorEventArgs(behavior));
        }
开发者ID:jensweller,项目名称:Catel,代码行数:13,代码来源:InteractivityManager.cs

示例9: BaseClassDescription

        public BaseClassDescription(IBehavior behavior, IBehavior superclass, Machine machine, string varnames)
            : base(behavior, superclass, machine)
        {
            IEnumerable<string> names = AsNames(varnames);

            foreach (string name in names)
                this.DefineInstanceVariable(name);
        }
开发者ID:ajlopez,项目名称:AjTalk,代码行数:8,代码来源:BaseClassDescription.cs

示例10: RegisterBehavior

        /// <summary>
        /// Registers the behavior.
        /// </summary>
        /// <param name="behavior">The behavior.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="behavior"/> is <c>null</c>.</exception>
        public void RegisterBehavior(IBehavior behavior)
        {
            Argument.IsNotNull("behavior", behavior);

            //_behaviors.Add(behavior);

            BehaviorLoaded.SafeInvoke(this, new BehaviorEventArgs(behavior));
        }
开发者ID:jensweller,项目名称:Catel,代码行数:13,代码来源:InteractivityManager.cs

示例11: CompileInstanceMethod

 public Method CompileInstanceMethod(string text, IBehavior cls)
 {
     ModelParser parser = new ModelParser(text);
     var methodmodel = parser.ParseMethod();
     Method method = new Method(cls, methodmodel.Selector, text);
     BytecodeCompiler compiler = new BytecodeCompiler(method);
     compiler.CompileMethod(methodmodel);
     return method;
 }
开发者ID:ajlopez,项目名称:AjTalk,代码行数:9,代码来源:VmCompiler.cs

示例12: CreateMetaClass

        public static IMetaClass CreateMetaClass(IBehavior superclass, Machine machine)
        {
            IMetaClass metasuperclass = null;

            if (superclass != null)
                metasuperclass = superclass.MetaClass;

            return new BaseMetaClass(machine.MetaClassClass, metasuperclass, machine, string.Empty);
        }
开发者ID:ajlopez,项目名称:AjTalk,代码行数:9,代码来源:BaseMetaClass.cs

示例13: Blob

 public Blob(string name, int health, int damage, IBehavior behaviorType, IAttack attackType)
 {
     this.Name = name;
     this.Health = health;
     this.Damage = damage;
     this.BehaviorType = behaviorType;
     this.AttackType = attackType;
     this.IsAlive = true;
 }
开发者ID:ToniDimitrov,项目名称:SoftUni-Homeworks-High-Quality-Code,代码行数:9,代码来源:Blob.cs

示例14: CopyInto

        public override void CopyInto(IBehavior newObject)
        {
            var projectileFiring = newObject as BasicProjectileFiringBehavior;

            Debug.Assert(projectileFiring != null, "BasicProjectileFiringBehavior is null in CopyInto");

            projectileFiring.TimeBetweenShots = TimeBetweenShots;

            base.CopyInto(newObject);
        }
开发者ID:shadercoder,项目名称:Icicle-Framework,代码行数:10,代码来源:BasicProjectileFiringBehavior.cs

示例15: CopyInto

        public override void CopyInto(IBehavior newObject)
        {
            var behavior = newObject as ParticleEffectDeathBehavior;

            Debug.Assert(behavior != null);

            behavior.ParticleEffectName = ParticleEffectName;

            base.CopyInto(newObject);
        }
开发者ID:shadercoder,项目名称:Icicle-Framework,代码行数:10,代码来源:ParticleEffectDeathBehavior.cs


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