Beispiel #1
0
        /// <summary>
        /// Returns all States Associations that a certain Game Object Property is involved in.
        /// </summary>
        /// <param name="gameObjectPropertyName"></param>
        /// <returns></returns>
        public List <StatesAssociation> GetStatesAssociationsForPropertyName(string gameObjectPropertyName)
        {
            var ret = new List <StatesAssociation>();

            //Add all CommonStatesAssociations, if defined.
            if (CommonStatesAssociations != null)
            {
                ret.AddRange(CommonStatesAssociations);
            }
            //Add only those StatesAssociations that match the gameObjectPropertyName from StatesAssociationsPerPropertyName.
            if (StatesAssociationsPerPropertyName != null && StatesAssociationsPerPropertyName.ContainsKey(gameObjectPropertyName))
            {
                ret.AddRange(StatesAssociationsPerPropertyName[gameObjectPropertyName]);
            }
            return(ret);
        }
Beispiel #2
0
        /// <summary>
        /// Creates a Dictionary of DiagramMapping and ElementBase.
        /// The dictionary represents all MachinationsElements that are required to satisfy
        /// this GameObjectManifest, including their Diagram whereabouts (via DiagramMapping).
        /// </summary>
        /// <see cref="MachinationsUP.Integration.Inventory.DiagramMapping"/>
        public Dictionary <DiagramMapping, ElementBase> GetMachinationsDiagramTargets()
        {
            Dictionary <DiagramMapping, ElementBase> targets =
                new Dictionary <DiagramMapping, ElementBase>();

            foreach (DiagramMapping diagramMapping in DiagramMappings)
            {
                diagramMapping.ManifestName = Name;
                //If StatesAssociations were defined and this Property is found, create a separate
                //machinationsUniqueID *per* StateAssociation.
                if (StatesAssociationsPerPropertyName != null &&
                    StatesAssociationsPerPropertyName.ContainsKey(diagramMapping.PropertyName))
                {
                    foreach (StatesAssociation sa in StatesAssociationsPerPropertyName[diagramMapping.PropertyName])
                    {
                        diagramMapping.StatesAssoc = sa;
                        targets.Add(diagramMapping, null);
                    }
                }
                else
                {
                    //Only add "N/A" to Game Objects that don't have a CommonStatesAssociations.
                    if (CommonStatesAssociations == null)
                    {
                        targets.Add(diagramMapping, null);
                    }
                }

                //If any CommonStatesAssociations were defined, applying them to all elements.
                if (CommonStatesAssociations != null)
                {
                    foreach (StatesAssociation sa in CommonStatesAssociations)
                    {
                        diagramMapping.StatesAssoc = sa;
                        targets.Add(diagramMapping, null);
                    }
                }
            }

            return(targets);
        }