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

CreateBehavior() protected method

protected CreateBehavior ( ) : Composite
return Composite
        protected override Composite CreateBehavior()
        {
            return new PrioritySelector(
                //Init: Current Position / Current Level ID / Navigator Cleared
                 new Decorator(ret => !InitDone,
                      new Action(ret => Init())
                 ),
                 new Decorator(ret => FunkyGame.Targeting.Cache.ShouldRefreshObjectList && !ShouldAttemptInteraction(),
                      new Action(ret => FunkyGame.Targeting.Cache.Refresh())
                 ),
                 new Decorator(ret => FunkyGame.Targeting.Cache.CurrentTarget != null,
                      new Action(ret => Combat())
                 ),
                 //Check Interactive Cache for nearby waypoint..
                 new Decorator(ret => (SNOLevelArea)FunkyGame.Hero.iCurrentLevelID == DestinationLevelArea &&
                                    ObjectCache.InteractableObjectCache.Values.Any(g => g.Gizmotype.Value== GizmoType.Waypoint && g.CentreDistance<=75f),
                     new Action(ret => m_IsDone=true)),
                //Check if nearby any waypoint
                //new Decorator(ret => !FunkyGame.Hero.bIsInTown && ObjectCache.InteractableObjectCache.Values.Any(g => g.Gizmotype.Value == GizmoType.Waypoint && g.CentreDistance<40f),
                    //new Action(ret => m_IsDone=true)),

                //Attempt to Update Actor, Failure == DONE! -- Check if level area has changed already!
                 new Decorator(ret => LevelAreaChanged(),
                      new PrioritySelector(
                            new Decorator(ret => ZetaDia.IsLoadingWorld,
                                 new Sleep(1000)),
                            new Decorator(ret => !ZetaDia.IsLoadingWorld,
                                 new Action(ret => m_IsDone = true)))
                 ),
                 //Toggle Waypoint Map!
                 new Decorator(ret => !UIElements.WaypointMap.IsVisible,
                     new Action(ret => UIManager.ToggleWaypointMap())),
                //Check if Correct UI is showing!
                new Decorator(ret => !UI.ValidateUIElement(UI.WaypointMap.GetWaypointUIByWaypointID(waypointID)),
                    new PrioritySelector(
                        new Decorator(ret => !UI.ValidateUIElement(UI.WaypointMap.WaypointMap_ActOne),
                            new Action(ret => UI.WaypointMap.WaypointMap_ZoomOut.Click())),
                        new Decorator(ret => UI.WaypointMap.GetWaypointActUIByWaypointID(waypointID).IsVisible,
                            new Action(ret => UI.WaypointMap.GetWaypointActUIByWaypointID(waypointID).Click()))
                            )),
                //Check if in range and interaction should occur again!
                 new Decorator(ret => ShouldAttemptInteraction() && !LevelAreaChanged(),
                      new Action(ret => UseWaypoint())
                 )
            );
        }