Exemplo n.º 1
0
		public EventEntry GetEntry (IBehaviourContext context)
		{
			if (contextCahce == null)
				contextCahce = new Dictionary<IBehaviourContext, EventEntry> ();

			EventEntry foundEntry;

			bool result = contextCahce.TryGetValue (context, out foundEntry);

			if (!result)
			{
				foundEntry = new EventEntry ();

				contextCahce.Add (context, foundEntry);
			}

			return foundEntry;
		}
Exemplo n.º 2
0
        public EventEntry GetEntry(IBehaviourContext context)
        {
            if (SourceNode == null)
            {
                return(defaultEntry);
            }

            EventEntry foundEntry;

            if (ContextCahce == null)
            {
                ContextCahce = new Dictionary <IBehaviourContext, EventEntry> ();
            }

            bool result = ContextCahce.TryGetValue(context, out foundEntry);

            var sourceOutput = (EventOutput)SourceSocket;

            var connectionEntry = sourceOutput[context];

            if (!result)
            {
                foundEntry = new EventEntry();

                connectionEntry.OnEventFired += () =>
                {
                    if (foundEntry != null)
                    {
                        foundEntry.OnEventFired();
                    }
                };

                ContextCahce.Add(context, foundEntry);
            }

            return(foundEntry);
        }