private void CreateAndStartArcBallCamera() { BaseEntity entity; if (entities.TryGetValue(this.controlledEntity, out entity)) { MsgSetParent msgSetParent = ObjectPool.Aquire <MsgSetParent>(); msgSetParent.ParentEntity = entity; msgSetParent.UniqueTarget = this.sceneMgrRootEntity.UniqueID; this.Game.SendMessage(msgSetParent); } if (currentCameraInputType != null) { if (currentCameraInputType is ArcBallCameraInputComponent) { return; } this.sceneMgrRootEntity.RemoveComponent(currentCameraInputType); } ArcBallCameraInputComponent arcBallCam = new ArcBallCameraInputComponent(this.sceneMgrRootEntity); currentCameraInputType = arcBallCam; arcBallCam.TargetPosition = new Vector3(950, 400, 950); arcBallCam.LookAheadDistance = 10.0f; arcBallCam.LookAboveDistance = 5.0f; arcBallCam.HorizontalAngle = -1.3f; arcBallCam.VerticalAngle = 1.2f; }
static public BaseComponent LoadComponent(BaseEntity parent, ComponentType type, ContentManager contentManager, string XMLDefinitionPath) { // This is a factory for creating any component based on a ComponentType switch (type) { case ComponentType.RenderComponent: { BaseComponent newComponent = RenderComponent.LoadFromDefinition(contentManager, XMLDefinitionPath, parent); CheckComponentLoadedProperly(newComponent, type); return(newComponent); } case ComponentType.CameraComponent: { BaseComponent newComponent = CameraComponent.LoadFromDefinition(contentManager, XMLDefinitionPath, parent); CheckComponentLoadedProperly(newComponent, type); return(newComponent); } case ComponentType.ConstantMovementComponent: { BaseComponent newComponent = ConstantMovementComponent.LoadFromDefinition(contentManager, XMLDefinitionPath, parent); CheckComponentLoadedProperly(newComponent, type); return(newComponent); } case ComponentType.ConstantRotationComponent: { BaseComponent newComponent = ConstantRotationComponent.LoadFromDefinition(contentManager, XMLDefinitionPath, parent); CheckComponentLoadedProperly(newComponent, type); return(newComponent); } case ComponentType.FreeCameraInputComponent: { BaseComponent newComponent = FreeCameraInputComponent.LoadFromDefinition(contentManager, XMLDefinitionPath, parent); CheckComponentLoadedProperly(newComponent, type); return(newComponent); } case ComponentType.LightEmitterComponent: { BaseComponent newComponent = LightEmitterComponent.LoadFromDefinition(contentManager, XMLDefinitionPath, parent); CheckComponentLoadedProperly(newComponent, type); return(newComponent); } case ComponentType.PhysicsComponent: { BaseComponent newComponent = PhysicsComponent.LoadFromDefinition(contentManager, XMLDefinitionPath, parent); CheckComponentLoadedProperly(newComponent, type); return(newComponent); } case ComponentType.PhantomPhysicsComponent: { BaseComponent newComponent = PhantomPhysicsComponent.LoadFromDefinition(contentManager, XMLDefinitionPath, parent); CheckComponentLoadedProperly(newComponent, type); return(newComponent); } case ComponentType.CharacterPhysicsComponent: { BaseComponent newComponent = CharacterPhysicsComponent.LoadFromDefinition(contentManager, XMLDefinitionPath, parent); CheckComponentLoadedProperly(newComponent, type); return(newComponent); } case ComponentType.CharacterInputComponent: { BaseComponent newComponent = CharacterInputComponent.LoadFromDefinition(contentManager, XMLDefinitionPath, parent); CheckComponentLoadedProperly(newComponent, type); return(newComponent); } case ComponentType.WaterComponent: { BaseComponent newComponent = WaterComponent.LoadFromDefinition(contentManager, XMLDefinitionPath, parent); CheckComponentLoadedProperly(newComponent, type); return(newComponent); } case ComponentType.ArcBallCameraInputComponent: { BaseComponent newComponent = ArcBallCameraInputComponent.LoadFromDefinition(contentManager, XMLDefinitionPath, parent); CheckComponentLoadedProperly(newComponent, type); return(newComponent); } case ComponentType.ParticleEmitterComponent: { BaseComponent newComponent = ParticleEmitterComponent.LoadFromDefinition(contentManager, XMLDefinitionPath, parent); CheckComponentLoadedProperly(newComponent, type); return(newComponent); } case ComponentType.SkyDomeComponent: { BaseComponent newComponent = SkyDomeComponent.LoadFromDefinition(contentManager, XMLDefinitionPath, parent); CheckComponentLoadedProperly(newComponent, type); return(newComponent); } case ComponentType.CollisionTriggerComponent: { BaseComponent newComponent = CollisionTriggerComponent.LoadFromDefinition(contentManager, XMLDefinitionPath, parent); CheckComponentLoadedProperly(newComponent, type); return(newComponent); } case ComponentType.TerrainComponent: { BaseComponent newComponent = TerrainComponent.LoadFromDefinition(contentManager, XMLDefinitionPath, parent); CheckComponentLoadedProperly(newComponent, type); return(newComponent); } case ComponentType.TerrainPhysicsComponent: { BaseComponent newComponent = TerrainPhysicsComponent.LoadFromDefinition(contentManager, XMLDefinitionPath, parent); CheckComponentLoadedProperly(newComponent, type); return(newComponent); } case ComponentType.WaterVolumePhysicsComponent: { BaseComponent newComponent = WaterVolumePhysicsComponent.LoadFromDefinition(contentManager, XMLDefinitionPath, parent); CheckComponentLoadedProperly(newComponent, type); return(newComponent); } case ComponentType.Invalid: { throw new ArgumentException(String.Format("Invalid component type passed, type {0} is not valid", type)); } default: { throw new ArgumentException(String.Format("Invalid component type passed, type {0} is not valid", type)); } } }