Exemple #1
0
        public static BaseComponent LoadFromDefinition(ContentManager content, string definitionPath, BaseEntity parent)
        {
            CollisionTriggerComponentDefinition compDef = content.Load <CollisionTriggerComponentDefinition>(definitionPath);

            CollisionTriggerComponent newComponent = new CollisionTriggerComponent(parent, compDef);

            return(newComponent);
        }
Exemple #2
0
        public CollisionTriggerComponent(BaseEntity parent, CollisionTriggerComponentDefinition compDef)
            : base(parent)
        {
            ActivateComponent();

            collisionEffects = new Dictionary <int, CollisionEffect>();

            // If the CollisionTriggerComponentDefinition has a definition file path for
            // collision effects then we load that up and parse through, add, and initialize
            // add of those effects.
            if (compDef.EffectsDefinitionXML.Length > 0)
            {
                CollisionEffectDefinition[] effects = this.parentEntity.Game.Content.Load <CollisionEffectDefinition[]>(compDef.EffectsDefinitionXML);

                foreach (CollisionEffectDefinition effect in effects)
                {
                    AddEffect(effect.CollisionEffectType, effect.EffectUniqueID);
                    InitializeCollisionEffect(effect);
                }
            }
        }