Exemplo n.º 1
0
 public TerrainPhysics(TerrainActor actor, IResourceDictionary resourceDictionary)
     : base(resourceDictionary)
 {
     this._actor = actor;
     this._bodies = new List<Body>();
 }
Exemplo n.º 2
0
        static void ProcessActors()
        {
            #region CharacterActor

            #region CubeAnimateCharacterActorModel [CubeAnimateCharacter]
            {
                var actor = new CharacterActor();
                actor.RigidBodyOrientationIgnored = true;
                var actorModel = new CubeAnimateCharacterActorModel();
                actorModel.ModelAssetName = "Models/Characters/CubeAnimateCharacter";
                actorModel.CastShadowEnabled = true;
                actorModel.NearTransparencyEnabled = true;
                actor.ActorModel = actorModel;
                actor.RigidBodyConfig.InertiaTensorEnabled = false;
                actor.ActionSounds[new ActionSoundKey("Footstep", null)] = "DefaultFootstep";
                actor.ActionSounds[new ActionSoundKey("Jump", null)] = "Jump";
                var shapeConfig = new CollisionShapeConfig();
                shapeConfig.Factory = typeof(BoxActorCollisionShapeFactory).FullName;
                actor.CollisionBoundsConfig = new CollisionBoundsConfig();
                actor.CollisionBoundsConfig.CollisionShapeConfigs.Add(shapeConfig);

                XmlContentHelper.Serialize<CharacterActor>(actor, "c:/Dev/Xna/Content/Actors/Characters/CubeAnimateCharacter.xml");
                actor = XmlContentHelper.Deserialize<CharacterActor>("c:/Dev/Xna/Content/Actors/Characters/CubeAnimateCharacter.xml");
            }
            #endregion

            #region CubeAssetModelActorModel [CubeBlock]
            {
                var actor = new CharacterActor();
                var actorModel = new CubeAssetModelActorModel();
                actorModel.ModelAssetName = "Tests/CubeBlock";
                actor.ActorModel = actorModel;
                var shapeConfig = new CollisionShapeConfig();
                shapeConfig.Factory = typeof(BoxActorCollisionShapeFactory).FullName;
                actor.CollisionBoundsConfig = new CollisionBoundsConfig();
                actor.CollisionBoundsConfig.CollisionShapeConfigs.Add(shapeConfig);

                XmlContentHelper.Serialize<CharacterActor>(actor, "c:/Dev/Xna/Content/Actors/StaticMeshes/CubeBlock.xml");
                actor = XmlContentHelper.Deserialize<CharacterActor>("c:/Dev/Xna/Content/Actors/StaticMeshes/CubeBlock.xml");
            }
            #endregion

            #endregion

            #region StaticMeshes

            #region CubeAssetModelActorModel [CubeStairs]
            {
                var actor = new StaticMeshActor();
                var actorModel = new CubeAssetModelActorModel();
                actorModel.ModelAssetName = "Tests/CubeStairs";
                actor.ActorModel = actorModel;
                var shapeConfig = new CollisionShapeConfig();
                shapeConfig.Factory = typeof(SlopeActorCollisionShapeFactory).FullName;
                actor.CollisionBoundsConfig = new CollisionBoundsConfig();
                actor.CollisionBoundsConfig.CollisionShapeConfigs.Add(shapeConfig);

                XmlContentHelper.Serialize<StaticMeshActor>(actor, "c:/Dev/Xna/Content/Actors/StaticMeshes/CubeStairs.xml");
                actor = XmlContentHelper.Deserialize<StaticMeshActor>("c:/Dev/Xna/Content/Actors/StaticMeshes/CubeStairs.xml");
            }
            #endregion

            #region CubeAssetModelActorModel [CubeTile]
            {
                var actor = new StaticMeshActor();
                var actorModel = new CubeAssetModelActorModel();
                actorModel.ModelAssetName = "Tests/CubeTile";
                actor.ActorModel = actorModel;
                var shapeConfig = new CollisionShapeConfig();
                shapeConfig.Factory = typeof(MeshActorCollisionShapeFactory).FullName;
                actor.CollisionBoundsConfig = new CollisionBoundsConfig();
                actor.CollisionBoundsConfig.CollisionShapeConfigs.Add(shapeConfig);

                XmlContentHelper.Serialize<StaticMeshActor>(actor, "c:/Dev/Xna/Content/Actors/StaticMeshes/CubeTile.xml");
                actor = XmlContentHelper.Deserialize<StaticMeshActor>("c:/Dev/Xna/Content/Actors/StaticMeshes/CubeTile.xml");
            }
            #endregion

            #endregion

            #region Terrain

            #region CubeTerrainActor
            {
                var actor = new TerrainActor();
                var actorModel = new CubeTerrainActorModel();
                actorModel.TerrainAssetName = "Tests/CubeTerrain";
                actor.ActorModel = actorModel;
                var shapeConfig = new CollisionShapeConfig();
                shapeConfig.Factory = typeof(CubeHeightmapActorCollisionShapeFactory).FullName;
                actor.CollisionBoundsConfig = new CollisionBoundsConfig();
                actor.CollisionBoundsConfig.CollisionShapeConfigs.Add(shapeConfig);

                XmlContentHelper.Serialize<TerrainActor>(actor, "c:/Dev/Xna/Content/Actors/Terrains/CubeTerrain.xml");
                actor = XmlContentHelper.Deserialize<TerrainActor>("c:/Dev/Xna/Content/Actors/Terrains/CubeTerrain.xml");
            }
            #endregion

            #endregion

            #region SkyDomeActor
            {
                var actor = new SkyDomeActor();
                var actorModel = new SkyDomeActorModel();
                actorModel.AdjustBlenderRadiusEnabled = true;
                actorModel.ModelAssetName = "Models/SkyDome";
                actorModel.SkyMapDefinitions["SkyDome"] = "Textures/SkyDome";
                actorModel.ActiveSkyMapName = "SkyDome";
                actor.ActorModel = actorModel;

                XmlContentHelper.Serialize<SkyDomeActor>(actor, "c:/Dev/Xna/Content/Actors/SkyDomes/SkyDome.xml");
                actor = XmlContentHelper.Deserialize<SkyDomeActor>("c:/Dev/Xna/Content/Actors/SkyDomes/SkyDome.xml");
            }
            #endregion

            #region FluidSurfaceActor
            {
                var actor = new FluidSurfaceActor();
                var actorModel = new FluidSurfaceActorModel();
                actorModel.ModelAssetName = "FluidSurfaces/FluidSurface";
                actor.ActorModel = actorModel;

                XmlContentHelper.Serialize<FluidSurfaceActor>(actor, "c:/Dev/Xna/Content/Actors/FluidSurfaces/FluidSurface.xml");
                actor = XmlContentHelper.Deserialize<FluidSurfaceActor>("c:/Dev/Xna/Content/Actors/FluidSurfaces/FluidSurface.xml");
            }
            #endregion

            #region VolumeFogActor
            //{
            //    var actor = new VolumeFogActor();
            //    actor.VolumeFogActorModel.ModelAssetName = "Models/SceneValley_Fog";
            //    actor.VolumeFogActorModel.FogColor = Color.LightBlue.ToVector3();
            //    actor.VolumeFogActorModel.FogScale = 0.05f;

            //    XmlContentLoader.Save<VolumeFogActor>(actor, "c:/Dev/Xna/Content/Actors/VolumeFog.xml");
            //    actor = XmlContentLoader.Load<VolumeFogActor>("c:/Dev/Xna/Content/Actors/VolumeFog.xml");
            //}
            #endregion
        }
Exemplo n.º 3
0
 public TerrainVisual(TerrainActor actor, SpriteBatch terrainSpriteBatch, IResourceDictionary resourceDictionary)
     : base(resourceDictionary)
 {
     this._actor = actor;
     this._terrainSpriteBatch = terrainSpriteBatch;
 }