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

            CharacterPhysicsComponent newComponent = new CharacterPhysicsComponent(parent, compDef);

            return(newComponent);
        }
예제 #2
0
        public CharacterPhysicsComponent(BaseEntity parent, CharacterPhysicsComponentDefinition compDef)
            : base(parent)
        {
            ActivateComponent();

            if (compDef.PhysicsModelPath.Length > 0)
            {
                this.physMesh = this.parentEntity.Game.ModelLoader.LoadStaticModel(compDef.PhysicsModelPath);
            }

            this.affectedByGravity = compDef.AffectedByGravity;
            this.shapeType         = ShapeType.Cylinder;
            this.mass = compDef.Mass;
            this.collisionGroupType = CollisionGroups.RigidBody;

            this.height   = compDef.Height;
            this.width    = compDef.Width;
            this.depth    = compDef.Depth;
            this.diameter = compDef.Diameter;

            InitializeActor();
        }