Пример #1
0
        //allows developer to specify the type of collidable object to be used as basis for the camera
        public CollidableFirstPersonCameraController(string id, ControllerType controllerType, Keys[] moveKeys, float moveSpeed, float strafeSpeed, float rotationSpeed,
                                                     ManagerParameters managerParameters,
                                                     IActor parentActor, float radius, float height, float accelerationRate, float decelerationRate,
                                                     float mass, float jumpHeight, Vector3 translationOffset, PlayerObject collidableObject)
            : base(id, controllerType, moveKeys, moveSpeed, strafeSpeed, rotationSpeed, managerParameters)
        {
            this.Radius           = radius;
            this.height           = height;
            this.AccelerationRate = accelerationRate;
            this.DecelerationRate = decelerationRate;
            this.Mass             = mass;
            this.JumpHeight       = jumpHeight;

            //allows us to tweak the camera position within the player object
            this.translationOffset = translationOffset;

            /* Create the collidable player object which comes with a collision skin and position the parentActor (i.e. the camera) inside the player object.
             * notice that we don't pass any effect, model or texture information, since in 1st person perspective we dont want to look from inside a model.
             * Therefore, we wont actually render any drawn object - the effect, texture, model (and also Color) information are unused.
             *
             * This code allows the user to pass in their own PlayerObject (e.g. HeroPlayerObject) to be used for the collidable object basis for the camera.
             */
            if (collidableObject != null)
            {
                this.playerObject = collidableObject;
            }
            else
            {
                this.playerObject = new PlayerObject(this.ID + " - player object", ActorType.CollidableCamera, (parentActor as Actor3D).Transform,
                                                     null, null, this.MoveKeys, radius, height, accelerationRate, decelerationRate, jumpHeight,
                                                     translationOffset, this.ManagerParameters.KeyboardManager);
            }

            playerObject.Enable(false, mass);
        }
Пример #2
0
 public PrimitiveDebugDrawer(Game game, EventDispatcher eventDispatcher, StatusType statusType,
                             ManagerParameters managerParameters, bool bShowCDCRSurfaces, bool bShowZones)
     : base(game, eventDispatcher, statusType)
 {
     this.managerParameters = managerParameters;
     this.bShowCDCRSurfaces = bShowCDCRSurfaces;
     this.bShowZones        = bShowZones;
 }
Пример #3
0
 //uses the default PlayerObject as the collidable object for the camera
 public CollidableFirstPersonCameraController(string id, ControllerType controllerType, Keys[] moveKeys, float moveSpeed, float strafeSpeed, float rotationSpeed,
                                              ManagerParameters managerParameters,
                                              IActor parentActor, float radius, float height, float accelerationRate, float decelerationRate,
                                              float mass, float jumpHeight, Vector3 translationOffset)
     : this(id, controllerType, moveKeys, moveSpeed, strafeSpeed, rotationSpeed,
            managerParameters,
            parentActor, radius, height, accelerationRate, decelerationRate,
            mass, jumpHeight, translationOffset, null)
 {
 }
        //used to make a player collidable primitives from an existing PrimitiveObject (i.e. the type returned by the PrimitiveFactory
        public PlayerCollidablePrimitiveObject(PrimitiveObject primitiveObject, ICollisionPrimitive collisionPrimitive,
                                               ManagerParameters managerParameters, Keys[] moveKeys, float moveSpeed, float rotationSpeed)
            : base(primitiveObject, collisionPrimitive, managerParameters.ObjectManager)
        {
            this.moveKeys      = moveKeys;
            this.moveSpeed     = moveSpeed;
            this.rotationSpeed = rotationSpeed;

            //for input
            this.managerParameters = managerParameters;
        }
        public PickingManager(Game game, EventDispatcher eventDispatcher, StatusType statusType,
                              ManagerParameters managerParameters, PickingBehaviourType pickingBehaviourType, float pickStartDistance, float pickEndDistance, Predicate <CollidableObject> collisionPredicate)
            : base(game, eventDispatcher, statusType)
        {
            this.managerParameters = managerParameters;

            this.pickingBehaviourType = pickingBehaviourType;
            this.pickStartDistance    = pickStartDistance;
            this.pickEndDistance      = pickEndDistance;
            this.collisionPredicate   = collisionPredicate;
        }
Пример #6
0
        public UserInputController(string id,
                                   ControllerType controllerType, Keys[] moveKeys,
                                   float moveSpeed, float strafeSpeed, float rotationSpeed, ManagerParameters managerParameters)
            : base(id, controllerType)
        {
            this.moveKeys      = moveKeys;
            this.moveSpeed     = moveSpeed;
            this.strafeSpeed   = strafeSpeed;
            this.rotationSpeed = rotationSpeed;

            this.managerParameters = managerParameters;
        }
        public PlayerCollidablePrimitiveObject(string id, ActorType actorType, Transform3D transform, EffectParameters effectParameters,
                                               StatusType statusType, IVertexData vertexData, ICollisionPrimitive collisionPrimitive,
                                               ManagerParameters managerParameters,
                                               Keys[] moveKeys, float moveSpeed, float rotationSpeed)
            : base(id, actorType, transform, effectParameters, statusType, vertexData, collisionPrimitive, managerParameters.ObjectManager)
        {
            this.moveKeys      = moveKeys;
            this.moveSpeed     = moveSpeed;
            this.rotationSpeed = rotationSpeed;

            //for input
            this.managerParameters = managerParameters;
        }
Пример #8
0
        public PrimitiveDebugDrawer(Game game, EventDispatcher eventDispatcher, StatusType statusType,
                                    ManagerParameters managerParameters, bool bShowCollisionSkins, bool bShowFrustumCullingSphere, bool bShowZones,
                                    IVertexData sphereVertexData)
            : base(game, eventDispatcher, statusType)
        {
            this.managerParameters         = managerParameters;
            this.bShowCollisionSkins       = bShowCollisionSkins;
            this.bShowFrustumCullingSphere = bShowFrustumCullingSphere;
            this.bShowZones = bShowZones;

            //used to draw the default BoundingSphere for any primitive and the collision skin for any primitive with a sphere collision primitive
            this.sphereVertexData = sphereVertexData;
        }
        public DebugDrawer(Game game, ManagerParameters managerParameters,
                           SpriteBatch spriteBatch, SpriteFont spriteFont, Color textColor, Vector2 textHoriVertOffset,
                           EventDispatcher eventDispatcher,
                           StatusType statusType)
            : base(game, eventDispatcher, statusType)
        {
            this.managerParameters  = managerParameters;
            this.spriteBatch        = spriteBatch;
            this.spriteFont         = spriteFont;
            this.textColor          = textColor;
            this.textHoriVertOffset = textHoriVertOffset;

            this.fpsText = new StringBuilder("FPS:N/A");
            //measure string height so we know how much vertical spacing is needed for multi-line debug info
            this.textHeight = this.spriteFont.MeasureString(this.fpsText).Y;
        }
 public DriveController(string id, ControllerType controllerType, Keys[] moveKeys, float moveSpeed, float strafeSpeed, float rotationSpeed,
                        ManagerParameters managerParameters)
     : base(id, controllerType, moveKeys, moveSpeed, strafeSpeed, rotationSpeed, managerParameters)
 {
 }
Пример #11
0
 public SimplePickingManager(Game game, EventDispatcher eventDispatcher, StatusType statusType, ManagerParameters managerParameters)
     : base(game, eventDispatcher, statusType)
 {
     this.managerParameters = managerParameters;
 }