예제 #1
0
 public RuleAction(LambdaExpression expression, IndexMap factIndexMap, IndexMap dependencyIndexMap)
 {
     _expression         = expression;
     _factIndexMap       = factIndexMap;
     _dependencyIndexMap = dependencyIndexMap;
     _compiledAction     = FastDelegate.Create <Action <object[]> >(expression);
 }
예제 #2
0
 public UIGraph_BuildLabels()
 {
     try
     {
         pixelsToUnits = FastDelegate.Create <UIComponent, PixelsToUnitsDelegate>("PixelsToUnits");
         addSolidQuad  = FastDelegate.Create <UIGraph, AddSolidQuadDelegate>("AddSolidQuad");
     }
     catch (Exception ex)
     {
         Log.Error("The 'Real Time' mod failed to create delegates for the UIGraph. Error message: " + ex);
     }
 }
예제 #3
0
        /// <summary>Creates a game connection object for the tourist AI class.</summary>
        /// <returns>A new <see cref="TouristAIConnection{TouristAI, Citizen}"/> object.</returns>
        public static TouristAIConnection <TouristAI, Citizen> GetTouristAIConnection()
        {
            try
            {
                GetRandomTargetTypeDelegate getRandomTargetType
                    = FastDelegate.Create <TouristAI, GetRandomTargetTypeDelegate>("GetRandomTargetType");

                GetLeavingReasonDelegate getLeavingReason
                    = FastDelegate.Create <TouristAI, GetLeavingReasonDelegate>("GetLeavingReason");

                AddTouristVisitDelegate addTouristVisit
                    = FastDelegate.Create <TouristAI, AddTouristVisitDelegate>("AddTouristVisit");

                DoRandomMoveDelegate doRandomMove
                    = FastDelegate.Create <TouristAI, DoRandomMoveDelegate>("DoRandomMove");

                FindEvacuationPlaceDelegate findEvacuationPlace
                    = FastDelegate.Create <TouristAI, FindEvacuationPlaceDelegate>("FindEvacuationPlace");

                FindVisitPlaceDelegate findVisitPlace
                    = FastDelegate.Create <TouristAI, FindVisitPlaceDelegate>("FindVisitPlace");

                GetEntertainmentReasonDelegate getEntertainmentReason
                    = FastDelegate.Create <TouristAI, GetEntertainmentReasonDelegate>("GetEntertainmentReason");

                GetEvacuationReasonDelegate getEvacuationReason
                    = FastDelegate.Create <TouristAI, GetEvacuationReasonDelegate>("GetEvacuationReason");

                GetShoppingReasonDelegate getShoppingReason
                    = FastDelegate.Create <TouristAI, GetShoppingReasonDelegate>("GetShoppingReason");

                StartMovingDelegate startMoving
                    = FastDelegate.Create <TouristAI, StartMovingDelegate>("StartMoving");

                return(new TouristAIConnection <TouristAI, Citizen>(
                           getRandomTargetType,
                           getLeavingReason,
                           addTouristVisit,
                           doRandomMove,
                           findEvacuationPlace,
                           findVisitPlace,
                           getEntertainmentReason,
                           getEvacuationReason,
                           getShoppingReason,
                           startMoving));
            }
            catch (Exception e)
            {
                Log.Error("The 'Real Time' mod failed to create a delegate for type 'TouristAI', no method patching for the class: " + e);
                return(null);
            }
        }
예제 #4
0
        /// <summary>Creates a game connection object for the resident AI class.</summary>
        /// <returns>A new <see cref="ResidentAIConnection{ResidentAI, Citizen}"/> object.</returns>
        public static ResidentAIConnection <ResidentAI, Citizen> GetResidentAIConnection()
        {
            try
            {
                DoRandomMoveDelegate doRandomMove
                    = FastDelegate.Create <ResidentAI, DoRandomMoveDelegate>("DoRandomMove");

                FindEvacuationPlaceDelegate findEvacuationPlace
                    = FastDelegate.Create <ResidentAI, FindEvacuationPlaceDelegate>("FindEvacuationPlace");

                FindHospitalDelegate findHospital
                    = FastDelegate.Create <ResidentAI, FindHospitalDelegate>("FindHospital");

                FindVisitPlaceDelegate findVisitPlace
                    = FastDelegate.Create <ResidentAI, FindVisitPlaceDelegate>("FindVisitPlace");

                GetEntertainmentReasonDelegate getEntertainmentReason
                    = FastDelegate.Create <ResidentAI, GetEntertainmentReasonDelegate>("GetEntertainmentReason");

                GetEvacuationReasonDelegate getEvacuationReason
                    = FastDelegate.Create <ResidentAI, GetEvacuationReasonDelegate>("GetEvacuationReason");

                GetShoppingReasonDelegate getShoppingReason
                    = FastDelegate.Create <ResidentAI, GetShoppingReasonDelegate>("GetShoppingReason");

                StartMovingDelegate startMoving
                    = FastDelegate.Create <ResidentAI, StartMovingDelegate>("StartMoving");

                StartMovingWithOfferDelegate startMovingWithOffer
                    = FastDelegate.Create <ResidentAI, StartMovingWithOfferDelegate>("StartMoving");

                return(new ResidentAIConnection <ResidentAI, Citizen>(
                           doRandomMove,
                           findEvacuationPlace,
                           findHospital,
                           findVisitPlace,
                           getEntertainmentReason,
                           getEvacuationReason,
                           getShoppingReason,
                           startMoving,
                           startMovingWithOffer));
            }
            catch (Exception e)
            {
                Log.Error("The 'Real Time' mod failed to create a delegate for type 'ResidentAI', no method patching for the class: " + e);
                return(null);
            }
        }
예제 #5
0
 public RuleAction(LambdaExpression expression, FactIndexMap actionFactMap)
 {
     _expression     = expression;
     _actionFactMap  = actionFactMap;
     _compiledAction = FastDelegate.Create <Action <object[]> >(expression);
 }
예제 #6
0
 public AlphaCondition(LambdaExpression expression)
 {
     _expression         = expression;
     _compiledExpression = FastDelegate.Create <Func <object[], bool> >(expression);
 }
예제 #7
0
 public BetaCondition(LambdaExpression expression, FactIndexMap conditionFactMap)
 {
     _expression         = expression;
     _conditionFactMap   = conditionFactMap;
     _compiledExpression = FastDelegate.Create <Func <object[], bool> >(expression);
 }