fBaseXtensions.XML.UseItemTag.CreateBehavior C# (CSharp) Method

CreateBehavior() protected method

protected CreateBehavior ( ) : Composite
return Composite
        protected override Composite CreateBehavior()
        {
            return new PrioritySelector
            (
                new Decorator(ret => FunkyGame.GameIsInvalid,
                    new Action(ret => m_IsDone = true)),

                new Decorator(ret => !intWait,
                    new Sequence
                    (
                        new Sleep(2000),
                        new Action(ret => intWait = true)
                    )
                ),
                new Decorator(ret => !UIElements.InventoryWindow.IsVisible,
                    new Action(ret => UIManager.ToggleInventoryMenu())),

                //Update Item List
                new Decorator(ret => !updatedItemList,
                    new Sequence(
                        new Action(ret => UsableItemList=GetItemList()),
                        new Action(ret => updatedItemList=true))),

                new Decorator(ret => UsableItemList.Count == 0,
                    new Sequence
                    (
                        new Sleep(2000),
                        new Action(ret => m_IsDone = true)
                    )
                ),

                new Decorator(ret => UsableItemList.Count > 0,
                    new Sequence(
                        new Action(ret => AttemptUseItem(UsableItemList)),
                        new Action(ret => m_IsDone=true)))

            );
        }