public PrimitiveObject(string id, ObjectType objectType,
     Transform3D transform, IVertexData vertexData, Effect effect, Color color, float alpha)
     : base(id, objectType, transform, effect, color, alpha)
 {
     this.vertexData = vertexData;
     this.effect = effect;
 }
Example #2
0
 public Camera3D(string id, ObjectType objectType,
     Transform3D transform, ProjectionParameters projectionParameters, Viewport viewPort)
     : base(id, objectType, transform)
 {
     this.projectionParameters = projectionParameters;
     this.viewPort = viewPort;
 }
 public DrawnActor(string id, ObjectType objectType, Transform3D transform, Effect effect, Color color, float alpha)
     : base(id, objectType, transform)
 {
     this.Effect = effect;
     this.Color = color;
     this.Alpha = alpha;
 }
Example #4
0
 public TrackCamera3D(string id, ObjectType objectType,
     Transform3D transform, ProjectionParameters projectionParameters,
     Viewport viewPort, Camera3DTrack track)
     : base(id, objectType, transform, projectionParameters, viewPort)
 {
     this.track = track;
 }
 public void Set()
 {
     this.ParentActor.Transform3D.Look = new Vector3(
         this.targetActor.Transform3D.Translation.X - this.ParentActor.Transform3D.Translation.X,
         this.ParentActor.Transform3D.Look.Y,
         this.targetActor.Transform3D.Translation.Z - this.ParentActor.Transform3D.Translation.Z);
     offSet = this.ParentActor.Transform3D.Translation - this.targetActor.Transform3D.Translation;
     oldTransform = (Transform3D)this.targetActor.Transform3D.Clone();
     oldPTransform = (Transform3D)this.ParentActor.Transform3D.Clone();
 }
        public TriangleMeshObject(string id, ObjectType objectType, Transform3D transform, Effect effect, 
            Texture2D texture, Model model, Color color, float alpha, MaterialProperties materialProperties)
            : base(id, objectType, transform, effect, texture, model, color, alpha)
        {
            //get the primitive mesh which forms the skin
            TriangleMesh triangleMesh = GetTriangleMesh(model, transform);

            //add the primitive mesh to the collision skin
            this.Body.CollisionSkin.AddPrimitive(triangleMesh, materialProperties);
        }
        public CameraZoneObject(string id, ObjectType objectType, Transform3D transform,
           Effect effect, Color color, float alpha,
           bool isImpenetrable, string cameraLayout, string cameraID)
            : base(id, objectType, transform, effect, color, alpha, isImpenetrable)
        {
            this.cameraLayout = cameraLayout;
            this.cameraID = cameraID;

            this.Collision.callbackFn += Collision_callbackFn;
        }
Example #8
0
 public PrimitiveObject(string id, ObjectType objectType,
     Transform3D transform, VertexPositionColor[] vertices,
     BasicEffect effect, PrimitiveType primitiveType, int primitiveCount)
     : base(id, objectType, transform)
 {
     this.vertices = vertices;
     this.effect = effect;
     this.primitiveType = primitiveType;
     this.primitiveCount = primitiveCount;
 }
        public RailCamera3D(string id, ObjectType objectType,
            Transform3D transform, ProjectionParameters projectionParameters, 
            Viewport viewPort, RailParameters railParameters, Actor targetActor)
            : base(id, objectType, transform, projectionParameters, viewPort)
        {
            this.railParameters = railParameters;
            this.targetActor = targetActor;

            //put the camera on the rail mid point
            this.Transform3D.Translation = railParameters.MidPoint;
        }
 public ZoneObject(string id, ObjectType objectType,
     Transform3D transform, Effect effect, Color color, float alpha, bool isImpenetrable)
     : base(id, objectType, transform, effect, color, alpha)
 {
     //set body and skin for this zone
     this.body = new Body();
     this.body.ExternalData = this;
     this.collision = new CollisionSkin(this.body);
     this.body.CollisionSkin = this.collision;
     this.isImpenetrable = isImpenetrable; //we cant move through it
 }
Example #11
0
        public ModelObject(string id, ObjectType objectType, Transform3D transform, 
            Texture2D texture, Model model)
            : base(id, objectType, transform)
        {
            this.texture = texture;
            this.model = model;

            //load bone transforms and copy transfroms to transform array (transforms)
            this.transforms = new Matrix[model.Bones.Count];
            model.CopyAbsoluteBoneTransformsTo(this.transforms);
        }
        public PlayerObject(string id, ObjectType objectType, Transform3D transform, Effect effect, 
            Texture2D texture, Model model, Color color, float alpha, Keys[] keys,
         float radius, float height, float accelerationRate, float decelerationRate, Vector3 translationOffset)
            : base(id, objectType, transform, effect, texture, model, color, alpha,
                    radius, height, accelerationRate, decelerationRate)
        {
            this.keys = keys;
            this.translationOffset = translationOffset;

            this.Body.CollisionSkin.callbackFn += CollisionSkin_callbackFn;
            this.random = new Random();
        }
        public ModelObject(string id, ObjectType objectType, Transform3D transform, Effect effect, Texture2D texture, Model model, Color color, float alpha)
            : base(id, objectType, transform, effect, color, alpha)
        {
            this.texture = texture;
            this.model = model;

            if (this.model != null)
            {
                this.boneTransforms = new Matrix[model.Bones.Count];
                model.CopyAbsoluteBoneTransformsTo(this.boneTransforms);
            }
        }
        public CollidableObject(string id, ObjectType objectType, Transform3D transform, Effect effect,
            Texture2D texture, Model model, Color color, float alpha)
            : base(id, objectType, transform, effect, texture, model, color, alpha)
        {
            this.body = new Body();
            this.body.ExternalData = this;
            this.collision = new CollisionSkin(this.body);
            this.body.CollisionSkin = this.collision;

            //register for callback collision to see who just walked into the zone
            //we will only normally register for this event in a class that sub-classes CollidableObject e.g. PickupCollidableObject or PlayerCollidableObject
            this.Body.CollisionSkin.callbackFn += CollisionSkin_callbackFn;
        }
Example #15
0
        //camera to target vector, also provides access to distance from camera to target
        public static Vector3 GetCameraToTarget(Transform3D parent, Transform3D camera, out float distance)
        {
            //camera to target object vector
            Vector3 cameraToTarget = parent.Translation - camera.Translation;

            //distance from camera to target
            distance = cameraToTarget.Length();

            //camera to target object vector
            cameraToTarget.Normalize();

            return cameraToTarget;
        }
        public AnimatedPlayerObject(string id, ObjectType objectType, Transform3D transform,
            Effect effect, Texture2D texture, Model model, Color color, float alpha,
            Keys[] moveKeys, float radius, float height, float accelerationRate, float decelerationRate, 
            string takeName, Vector3 translationOffset)
            : base(id, objectType, transform, effect, texture, model, color, 
            alpha, moveKeys, radius, height, accelerationRate, decelerationRate, translationOffset)
        {
            //set initial animation played when player instanciated
            this.takeName = takeName;

            //load animation player with initial take e.g. idle
            SetAnimation(model, takeName);
        }
        public ThirdPersonCamera3D(string id, ObjectType objectType, Transform3D transform,
            ProjectionParameters projectionParameters,
            Viewport viewPort, Actor targetActor,
            int elevationAngle, int distance)
            : base(id, objectType, transform, projectionParameters, viewPort)
        {
            this.targetActor = targetActor;
            this.elevationAngle = elevationAngle;
            this.distance = distance;

            this.lerpSpeed = 0.05f;// med = 0.1f, fast = 0.2f
            this.oldTranslation = this.Transform3D.Translation;
            this.oldLook = this.Transform3D.Look;
            this.oldUp = this.Transform3D.Up;
        }
 public MoveableModelObject(string id, ObjectType objectType, Transform3D transform,
                            Texture2D texture, Model model)
     : base(id, objectType, transform, texture, model)
 {
 }
 public FreeLookCamera3D(string id, ObjectType objectType, Transform3D transform, 
     ProjectionParameters projectionParameters, Viewport viewPort, float speed)
     : base(id, objectType, transform, projectionParameters, viewPort)
 {
     this.speed = speed;
 }
 public PawnCamera3D(string id, ObjectType objectType,
     Transform3D transform, ProjectionParameters projectionParameters, Viewport viewPort)
     : base(id, objectType, transform, projectionParameters, viewPort)
 {
 }
Example #21
0
 public void Update(GameTime gameTime, Transform3D transform)
 {
     this.boundingBox.Max = originalBoundingBox.Max + transform.Translation;
     this.boundingBox.Min = originalBoundingBox.Min + transform.Translation;
 }
Example #22
0
 //camera to target vector
 public static Vector3 GetCameraToTarget(Transform3D parent, Transform3D camera)
 {
     //camera to target object vector
     return Vector3.Normalize(parent.Translation - camera.Translation);
 }
Example #23
0
 public PrimitiveObject(string id, ActorType actorType, StatusType statusType, Transform3D transform3D,
                        EffectParameters effectParameters, IVertexData vertexData)
     : base(id, actorType, statusType, transform3D, effectParameters)
 {
     this.vertexData = vertexData;
 }
 public void Update(GameTime gameTime, Transform3D transform)
 {
     this.boundingSphere = new BoundingSphere(transform.Translation, this.radius);
 }
Example #25
0
 //used when we don't want to specify status type
 public DrawnActor3D(string id, ActorType actorType, Transform3D transform, EffectParameters effectParameters)
     : this(id, actorType, transform, effectParameters, StatusType.Drawn | StatusType.Update)
 {
 }
 //forward compatibility (since v3.4) for existing code with no drawDepth
 public Camera3D(string id, ActorType actorType,
                 Transform3D transform, ProjectionParameters projectionParameters, Viewport viewPort)
     : this(id, actorType, transform, projectionParameters,
            viewPort, 0, StatusType.Updated)
 {
 }
Example #27
0
 //default draw and update settings for statusType
 public ModelObject(string id, ActorType actorType,
                    Transform3D transform, EffectParameters effectParameters, Model model)
     : this(id, actorType, transform, effectParameters, model, StatusType.Update | StatusType.Drawn)
 {
 }
Example #28
0
 public DrawnActor3D(string id, ActorType actorType, Transform3D transform,
                     ColorParameters colorParameters, Effect effect) : base(id, actorType, transform)
 {
     this.colorParameters = colorParameters;
     this.effect          = effect;
 }
 public TriangleMeshObject(string id, ActorType actorType, Transform3D transform,
                           EffectParameters effectParameters, Model model, MaterialProperties materialProperties)
     : this(id, actorType, transform, effectParameters, model, null, materialProperties)
 {
 }
Example #30
0
 public Actor3D(string id, ActorType actorType, Transform3D transform)
     : base(id, actorType)
 {
     this.transform = transform;
 }
Example #31
0
        public new object Clone()
        {
            CollidablePlayerObject player = new CollidablePlayerObject(ID, ActorType, StatusType, Transform3D.Clone() as Transform3D,
                                                                       EffectParameters.Clone() as EffectParameters, IVertexData.Clone() as IVertexData, CollisionPrimitive.Clone() as ICollisionPrimitive,
                                                                       ObjectManager, moveKeys, keyboardManager);

            player.ControllerList.AddRange(GetControllerListClone());
            return(player);
        }
Example #32
0
        private void InitCameras3D()
        {
            Transform3D transform3D = null;
            Camera3D    camera3D    = null;

            #region Camera - First Person
            transform3D = new Transform3D(new Vector3(10, 10, 20),
                                          new Vector3(0, 0, -1), Vector3.UnitY);

            camera3D = new Camera3D("1st person",
                                    ActorType.Camera3D, StatusType.Update, transform3D,
                                    ProjectionParameters.StandardDeepSixteenTen);

            //attach a controller
            camera3D.ControllerList.Add(new FirstPersonCameraController(
                                            this.keyboardManager, this.mouseManager,
                                            GDConstants.moveSpeed, GDConstants.strafeSpeed, GDConstants.rotateSpeed));
            this.cameraManager.Add(camera3D);
            #endregion

            #region Camera - Flight
            transform3D = new Transform3D(new Vector3(0, 10, 10),
                                          new Vector3(0, 0, -1),
                                          Vector3.UnitY);

            camera3D = new Camera3D("flight person",
                                    ActorType.Camera3D, StatusType.Update, transform3D,
                                    ProjectionParameters.StandardDeepSixteenTen);

            //attach a controller
            camera3D.ControllerList.Add(new FlightCameraController(
                                            this.keyboardManager, this.mouseManager,
                                            GDConstants.moveSpeed, GDConstants.strafeSpeed, GDConstants.rotateSpeed));
            this.cameraManager.Add(camera3D);
            #endregion

            #region Camera - Security
            transform3D = new Transform3D(new Vector3(10, 10, 50),
                                          new Vector3(0, 0, -1),
                                          Vector3.UnitY);

            camera3D = new Camera3D("security",
                                    ActorType.Camera3D, StatusType.Update, transform3D,
                                    ProjectionParameters.StandardDeepSixteenTen);

            camera3D.ControllerList.Add(new PanController(new Vector3(1, 1, 0),
                                                          30, GDConstants.mediumAngularSpeed, 0));
            this.cameraManager.Add(camera3D);
            #endregion

            #region Camera - Giant
            transform3D = new Transform3D(new Vector3(0, 250, 100),
                                          new Vector3(0, -1, -1), //look
                                          new Vector3(0, 1, -1)); //up

            this.cameraManager.Add(new Camera3D("giant looking down 1st person",
                                                ActorType.Camera3D, StatusType.Update, transform3D,
                                                ProjectionParameters.StandardDeepSixteenTen));
            this.cameraManager.Add(camera3D);
            #endregion

            this.cameraManager.ActiveCameraIndex = 0; //0, 1, 2, 3
        }
Example #33
0
 public CollidablePlayerObject(string id, ActorType actorType, StatusType statusType, Transform3D transform,
                               EffectParameters effectParameters, IVertexData vertexData, ICollisionPrimitive collisionPrimitive,
                               ObjectManager objectManager, Keys[] moveKeys, KeyboardManager keyboardManager)
     : base(id, actorType, statusType, transform, effectParameters, vertexData, collisionPrimitive, objectManager)
 {
     this.moveKeys        = moveKeys;
     this.keyboardManager = keyboardManager;
 }
 public CharacterModelObject(string id, ObjectType objectType, Transform3D transform, Effect effect, 
     Model model, Color color, float alpha)
     : base(id, objectType, transform, effect, null, model, color, alpha)
 {
     this.camera = null;
 }
Example #35
0
 public DrawnActor3D(string id, ActorType actorType, Transform3D transform, EffectParameters effectParameters, StatusType statusType)
     : base(id, actorType, transform, statusType)
 {
     this.effectParameters = effectParameters;
 }
Example #36
0
 //used by ZoneObjects
 public DrawnActor3D(string id, ActorType actorType,
                     Transform3D transform, Color color, float alpha)
     : this(id, actorType, transform, null, color, alpha,
            StatusType.Drawn | StatusType.Updated) //when we bitwise OR we saw drawn AND updated
 {
 }
 public SimpleZoneObject(string id, ActorType actorType, Transform3D transform, StatusType statusType, ICollisionPrimitive collisionPrimitive)
     : base(id, actorType, transform, statusType)
 {
     this.collisionPrimitive = collisionPrimitive;
 }
 public MoveableModelObject(string id, ObjectType objectType, Transform3D transform, Effect effect,
     Texture2D texture, Model model, Color color, float alpha)
     : base(id, objectType, transform, effect, texture, model, color, alpha)
 {
 }
 public CharacterModelObject(string id, ObjectType objectType, Transform3D transform, Effect effect,
     Texture2D texture, Model model, Camera3D camera, Color color, float alpha)
     : base(id, objectType, transform, effect, texture, model, color, alpha)
 {
     this.camera = camera;
 }
Example #40
0
 public Actor(string id, ObjectType objectType, Transform3D transform)
 {
     this.id         = id;
     this.objectType = objectType;
     this.transform  = transform;
 }
Example #41
0
 public Camera3D(string id, ActorType actorType,
                 Transform3D transform, ProjectionParameters projectionParameters,
                 Viewport viewport)
     : this(id, actorType, transform, projectionParameters, viewport, 1)
 {
 }
Example #42
0
 public Actor3D(string id, ActorType actorType, StatusType statusType, Transform3D transform3D) : base(id, actorType, statusType)
 {
     this.transform3D = transform3D;
 }
 public CharacterObject(string id, ObjectType objectType, Transform3D transform, Effect effect, 
     Texture2D texture, Model model, Color color, float alpha,
     float radius, float height, float accelerationRate, float decelerationRate)
     : base(id, objectType, transform, effect, texture, model, color, alpha)
 {
     this.Body = new Character(accelerationRate, decelerationRate);
     this.Collision = new CollisionSkin(Body);
     this.Body.ExternalData = this;
     this.Body.CollisionSkin = this.Collision;
     Capsule capsule = new Capsule(Vector3.Zero, Matrix.CreateRotationX(MathHelper.PiOver2), radius, height);
     this.Collision.AddPrimitive(capsule, (int)MaterialTable.MaterialID.NormalSmooth);
 }
 //used to draw billboards that have a texture
 public BillboardPrimitiveObject(string id, ObjectType objectType,
     Transform3D transform, IVertexData vertexData, Effect effect, Color color, float alpha, Texture2D texture, BillboardType billBoardType)
     : base(id, objectType, transform, vertexData, effect, color, alpha, texture)
 {
     this.billBoardType = billBoardType;
     this.billboardParameters = new BillboardParameters();
     if (billBoardType == BillboardType.Normal)
     {
         this.billboardParameters.Technique = "Normal";
         this.billboardParameters.BillboardType = BillboardType.Normal;
     }
     else if (billBoardType == BillboardType.Cylindrical)
     {
         this.billboardParameters.Technique = "Cylindrical";
         this.billboardParameters.BillboardType = BillboardType.Cylindrical;
         this.billboardParameters.Up = this.Transform3D.Up;
     }
     else
     {
         this.billboardParameters.Technique = "Spherical";
         this.billboardParameters.BillboardType = BillboardType.Spherical;
     }
 }
Example #45
0
 public DrawnActor(string id, ObjectType objectType, Transform3D transform)
     : base(id, objectType, transform)
 {
 }
Example #46
0
 //object to target vector, no distance
 public static Vector3 GetNormalizedObjectToTargetVector(Transform3D start, Transform3D target)
 {
     //camera to target object vector
     return(Vector3.Normalize(target.Translation - start.Translation));
 }
Example #47
0
 public DrawnActor(string id, ObjectType objectType, Transform3D transform)
     : base(id, objectType, transform)
 {
 }
Example #48
0
 public override bool Remove()
 {
     //tag for garbage collection
     this.transform = null;
     return(base.Remove());
 }
        public void Set()
        {
            this.offSet = this.Transform3D.Translation - game.rotator.Transform3D.Translation;
            this.oldTransform = (Transform3D)game.rotator.Transform3D.Clone();
            this.oldPTransform = (Transform3D)this.Transform3D.Clone();

            this.Enable(true, 1);

            bSet = true;
        }
 public MoveableModelObject(string id, ObjectType objectType, Transform3D transform, 
     Texture2D texture, Model model)
     : base(id, objectType, transform, texture, model)
 {
 }
        private void InitializeModels()
        {
            Texture2D texture = null;
            //MoveableModelObject playerActor = null;
            Transform3D transform = null;
            Model model = null;
            ModelObject modelObject = null;
            CollidableObject collidableObj = null;
            PawnCollidableObject collObj = null;
            ZoneObject zoneObj = null;
            CameraZoneObject camObj = null;

            #region Player Model
            model = this.modelDictionary["player"];
            transform = new Transform3D(new Vector3(-100, 10, 0),
                new Vector3(-90, 0, 0), 0.15f * Vector3.One,
                Vector3.UnitX, Vector3.UnitY);
            this.playerActor = new PlayerObject("player",
                ObjectType.Player, transform, this.animatedModelEffect, null, model, Color.White, 1f, KeyData.Player_Keys, 3.75f, 11.5f, 1f, 1f, new Vector3(0, 0, 0));
            this.playerActor.Enable(false, 100);
            this.objectManager.Add(this.playerActor);
            #endregion

            #region ExitDoor Model
            model = this.modelDictionary["door"];
            transform = new Transform3D(new Vector3(140, 0, 0), Vector3.Zero, 1f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            this.doorActor = new PawnCollidableObject("door", ObjectType.Door, transform, this.texturedModelEffect, null, model, Color.White, 1f);
            Vector3 scales = new Vector3(12, 250, 25);
            this.doorActor.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), new MaterialProperties());
            this.doorActor.Enable(true, 2000);

            this.objectManager.Add(this.doorActor);
            #endregion
            #region EntranceDoor Model
            model = this.modelDictionary["door"];
            transform = new Transform3D(new Vector3(-300, 0, 0), Vector3.Zero, 1f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            collObj = new PawnCollidableObject("door", ObjectType.Entrance, transform, this.texturedModelEffect, null, model, Color.White, 1f);
            collObj.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), new MaterialProperties());
            collObj.Enable(true, 2000);

            this.objectManager.Add(collObj);
            #endregion
            texture = Content.Load<Texture2D>("Assets\\Textures\\Game\\white");
            #region Room Model
            model = this.modelDictionary["room"];
            transform = new Transform3D(new Vector3(0, 0, 0), new Vector3(0,180,0), 1f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            MaterialProperties material = new MaterialProperties(1f, 0.1f, 0.05f);
            collidableObj = new CollidableObject("room", ObjectType.Room, transform, this.texturedModelEffect, null, model, Color.White, 1);
            //floor
            scales = new Vector3(300, 1, 300);
            collidableObj.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), material);
            collidableObj.Enable(true, 2000);

            this.objectManager.Add(collidableObj);

            scales = new Vector3(10, 100, 300);
            transform = new Transform3D(new Vector3(152, 0, 0), Vector3.Zero, scales, -Vector3.UnitZ, Vector3.UnitY);
            zoneObj = new ZoneObject("roomwallback", ObjectType.Room, transform, this.primitiveEffect, Color.Red, 1, true);
            zoneObj.AddPrimitive(new Box(transform.Translation, Matrix.Identity, transform.Scale));
            zoneObj.Enable();

            this.objectManager.Add(zoneObj);

            transform = new Transform3D(new Vector3(-152, 0, 0), Vector3.Zero, scales, -Vector3.UnitZ, Vector3.UnitY);
            zoneObj = new ZoneObject("roomwallfront", ObjectType.Room, transform, this.primitiveEffect, Color.Red, 1, true);
            zoneObj.AddPrimitive(new Box(transform.Translation, Matrix.Identity, transform.Scale));
            zoneObj.Enable();

            this.objectManager.Add(zoneObj);

            scales = new Vector3(300, 100, 5);
            transform = new Transform3D(new Vector3(0, 0, 130), Vector3.Zero, scales, -Vector3.UnitZ, Vector3.UnitY);
            zoneObj = new ZoneObject("roomwallright", ObjectType.Room, transform, this.primitiveEffect, Color.Red, 1, true);
            zoneObj.AddPrimitive(new Box(transform.Translation, Matrix.Identity, transform.Scale));
            zoneObj.Enable();

            this.objectManager.Add(zoneObj);

            transform = new Transform3D(new Vector3(0, 0, -130), Vector3.Zero, scales, -Vector3.UnitZ, Vector3.UnitY);
            zoneObj = new ZoneObject("roomwallleft", ObjectType.Room, transform, this.primitiveEffect, Color.Red, 1, true);
            zoneObj.AddPrimitive(new Box(transform.Translation, Matrix.Identity, transform.Scale));
            zoneObj.Enable();

            this.objectManager.Add(zoneObj);
            #endregion

            #region Rotationthingy Model
            model = this.modelDictionary["rotation"];
            transform = new Transform3D(new Vector3(0, -57, 0), Vector3.Zero, 0.6f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            this.rotator = new PawnCollidableObject("RotationThingy", ObjectType.Rotation, transform, this.texturedModelEffect, null, model, Color.White, 1);
            Matrix rot;
            this.rotator.AddPrimitive(new Capsule(transform.Translation - new Vector3(0, 0, 20 * 0.6f), Matrix.Identity, 2.5f * 0.6f, 40 * 0.6f), new MaterialProperties());
            Matrix.CreateRotationY(MathHelper.ToRadians(90), out rot);
            this.rotator.AddPrimitive(new Capsule(transform.Translation - new Vector3(20 *0.6f, 0, 0), rot, 2.5f * 0.6f, 40 * 0.6f), new MaterialProperties());
            this.rotator.Enable(true, 200);

            this.objectManager.Add(this.rotator);
            #endregion

            //Walls are initialized after Rotator because of their dependancy on Rotator (see RotatorController)
            //Maybe we should rather go for a more active approach meaning Rotator gets everything which is gonna rotate around it and rotates it
            #region Wall right Model
            model = this.modelDictionary["wall"];
            transform = new Transform3D(new Vector3(-4f, -1.8f, -69.8f), new Vector3(0, 90, 0), 1f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            wall1 = new PawnCollidableObject("Wall1", ObjectType.Wall, transform, this.texturedModelEffect, null, model, Color.Gray, 1);
            wall1.Add(new RotatorController("wall1Rotator", wall1, true, this.rotator));
            scales = new Vector3(300, 100, 12);
            wall1.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), material);
            wall1.Enable(true, 2000);

            this.objectManager.Add(wall1);
            #endregion
            #region Wall left Model
            model = this.modelDictionary["wall"];
            transform = new Transform3D(new Vector3(-4f, -1.8f, 69.8f), new Vector3(0,90,0), 1f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            wall2 = new PawnCollidableObject("Wall2", ObjectType.Wall, transform, this.texturedModelEffect, null, model, Color.White, 1);
            wall2.Add(new RotatorController("wall2Rotator", wall2, true, this.rotator));
            wall2.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), material);
            wall2.Enable(true, 2000);

            this.objectManager.Add(wall2);
            #endregion
            texture = Content.Load<Texture2D>("Assets/skin/Brick_Tut_35");
            #region Pressure Plate Exit Model
            model = this.modelDictionary["plate"];
            scales = new Vector3(12.5f, 2.5f, 12.5f);
            transform = new Transform3D(new Vector3(125, 0, 0), new Vector3(0, 90, 0), Vector3.One * 0.5f, -Vector3.UnitZ, Vector3.UnitY);
            step1 = new PawnCollidableObject("PressurePlate1", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            step1.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), new MaterialProperties());
            step1.Enable(true, 2000);

            this.objectManager.Add(step1);
            #endregion
            #region Pressure Plate Right Up Model
            transform = new Transform3D(new Vector3(26, 0, 110), Vector3.Zero, Vector3.One * 0.5f, -Vector3.UnitZ, Vector3.UnitY);
            step4 = new PawnCollidableObject("PressurePlate4", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            step4.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), new MaterialProperties());
            step4.Enable(true, 2000);

            this.objectManager.Add(step4);
            #endregion
            #region Pressure Plate Right Down Model
            transform = new Transform3D(new Vector3(-36, 0, 110), Vector3.Zero, Vector3.One * 0.5f, -Vector3.UnitZ, Vector3.UnitY);
            step5 = new PawnCollidableObject("PressurePlate5", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            step5.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), new MaterialProperties());
            step5.Enable(true, 2000);

            this.objectManager.Add(step5);
            #endregion
            #region Pressure Plate Left Up Model
            transform = new Transform3D(new Vector3(26, 0, -110), Vector3.Zero, Vector3.One*0.5f, -Vector3.UnitZ, Vector3.UnitY);
            step2 = new PawnCollidableObject("PressurePlate2", ObjectType.Plate, transform, this.texturedModelEffect, null, model, Color.White, 1);
            step2.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), new MaterialProperties());
            step2.Enable(true, 2000);

            this.objectManager.Add(step2);
            #endregion
            #region Pressure Plate Left Down Model
            transform = new Transform3D(new Vector3(-36, 0, -110), Vector3.Zero, Vector3.One * 0.5f, -Vector3.UnitZ, Vector3.UnitY);
            step3 = new PawnCollidableObject("PressurePlate3", ObjectType.Plate, transform, this.texturedModelEffect, null, model, Color.White, 1);
            step3.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), new MaterialProperties());
            step3.Enable(true, 2000);

            this.objectManager.Add(step3);
            #endregion

            #region Traps
            model = this.modelDictionary["trap"];
            transform = new Transform3D(new Vector3(80, 20f, 105), Vector3.UnitZ * 90, 0.5f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            trap1 = new PawnModelObject("PressurePlate1", ObjectType.Plate, transform, this.texturedModelEffect,texture, model, Color.White, 1);
            this.objectManager.Add(trap1);

            transform = new Transform3D(new Vector3(80, 20f, 115), Vector3.UnitZ * 90, 0.5f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            trap2 = new PawnModelObject("PressurePlate1", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(trap2);

            transform = new Transform3D(new Vector3(80, 20f, -105), Vector3.UnitZ * 90, 0.5f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            trap3 = new PawnModelObject("PressurePlate1", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(trap3);

            transform = new Transform3D(new Vector3(80, 20f, -115), Vector3.UnitZ * 90, 0.5f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            trap4 = new PawnModelObject("PressurePlate1", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(trap4);

            transform = new Transform3D(new Vector3(-90, 20f, 105), -Vector3.UnitZ * 90, 0.5f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            trap5 = new PawnModelObject("PressurePlate1", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(trap5);

            transform = new Transform3D(new Vector3(-90, 20f, 115), -Vector3.UnitZ * 90, 0.5f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            trap6 = new PawnModelObject("PressurePlate1", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(trap6);

            transform = new Transform3D(new Vector3(-90, 20f, -105), -Vector3.UnitZ * 90, 0.5f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            trap7 = new PawnModelObject("PressurePlate1", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(trap7);

            transform = new Transform3D(new Vector3(-90, 20f, -115), -Vector3.UnitZ * 90, 0.5f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            trap8 = new PawnModelObject("PressurePlate1", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(trap8);
            #endregion
            #region Arrow
            model = this.modelDictionary["arrow"];
            transform = new Transform3D(new Vector3(80, 20f, 105), Vector3.UnitZ * 90,  Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            arrow1 = new PawnModelObject("Arrow1", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(arrow1);

            transform = new Transform3D(new Vector3(80, 20f, 115), Vector3.UnitZ * 90,  Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            arrow2 = new PawnModelObject("Arrow2", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(arrow2);

            transform = new Transform3D(new Vector3(80, 20f, -105), Vector3.UnitZ * 90,  Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            arrow3 = new PawnModelObject("Arrow3", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(arrow3);

            transform = new Transform3D(new Vector3(80, 20f, -115), Vector3.UnitZ * 90,  Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            arrow4 = new PawnModelObject("Arrow4", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(arrow4);

            transform = new Transform3D(new Vector3(-90, 20f, 105), -Vector3.UnitZ * 90,  Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            arrow5 = new PawnModelObject("Arrow5", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(arrow5);

            transform = new Transform3D(new Vector3(-90, 20f, 115), -Vector3.UnitZ * 90,  Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            arrow6 = new PawnModelObject("Arrow6", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(arrow6);

            transform = new Transform3D(new Vector3(-90, 20f, -105), -Vector3.UnitZ * 90,  Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            arrow7 = new PawnModelObject("Arrow7", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(arrow7);

            transform = new Transform3D(new Vector3(-90, 20f, -115), -Vector3.UnitZ * 90, Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            arrow8 = new PawnModelObject("Arrow8", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(arrow8);

            scales = new Vector3(300, 100, 20);
            #endregion

            rotator.Add(new OffsetController("offset controller 2", rotator, true, new Vector3(0, 50, 0)));
            rotator.Add(new RotorController("rotor Controller", this.rotator, true));
            doorActor.Add(new OffsetController("offset vontroller 7", doorActor, true, new Vector3(0, -110, 0)));
            step1.Add(new OffsetController("offset controller 1", step1, true, new Vector3(0, -3, 0)));
            step2.Add(new OffsetController("offset controller 3", step2, true, new Vector3(0, -3, 0)));
            step3.Add(new OffsetController("offset controller 4", step3, true, new Vector3(0, -3, 0)));
            step4.Add(new OffsetController("offset controller 5", step4, true, new Vector3(0, -3, 0)));
            step5.Add(new OffsetController("offset controller 6", step5, true, new Vector3(0, -3, 0)));
            trap1.Add(new OffsetController("offset controller 7", trap1, true, new Vector3(-20, 0, 0)));
            trap2.Add(new OffsetController("offset controller 8", trap2, true, new Vector3(-20, 0, 0)));
            trap3.Add(new OffsetController("offset controller 9", trap3, true, new Vector3(-20, 0, 0)));
            trap4.Add(new OffsetController("offset controller 10", trap4, true, new Vector3(-20, 0, 0)));
            trap5.Add(new OffsetController("offset controller 11", trap5, true, new Vector3(20, 0, 0)));
            trap6.Add(new OffsetController("offset controller 12", trap6, true, new Vector3(20, 0, 0)));
            trap7.Add(new OffsetController("offset controller 13", trap7, true, new Vector3(20, 0, 0)));
            trap8.Add(new OffsetController("offset controller 14", trap8, true, new Vector3(20, 0, 0)));
            arrow1.Add(new OffsetController("offset controller 7", arrow1, true, new Vector3(-200, 0, 0), 0.2f));
            arrow2.Add(new OffsetController("offset controller 8", arrow2, true, new Vector3(-200, 0, 0), 0.2f));
            arrow3.Add(new OffsetController("offset controller 9", arrow3, true, new Vector3(-200, 0, 0), 0.2f));
            arrow4.Add(new OffsetController("offset controller 10", arrow4, true, new Vector3(-200, 0, 0), 0.2f));
            arrow5.Add(new OffsetController("offset controller 11", arrow5, true, new Vector3(200, 0, 0), 0.2f));
            arrow6.Add(new OffsetController("offset controller 12", arrow6, true, new Vector3(200, 0, 0), 0.2f));
            arrow7.Add(new OffsetController("offset controller 13", arrow7, true, new Vector3(200, 0, 0), 0.2f));
            arrow8.Add(new OffsetController("offset controller 14", arrow8, true, new Vector3(200, 0, 0), 0.2f));
        }
 public PickupCollidableObject(string id, ActorType actorType, Transform3D transform, BasicEffect effect,
                               Color color, float alpha, Texture2D texture, Model model, EventParameters eventParameters)
     : base(id, actorType, transform, effect, color, alpha, texture, model)
 {
     this.eventParameters = eventParameters;
 }
Example #53
0
 public Actor(string id, ObjectType objectType, Transform3D transform)
 {
     this.id = id;
     this.objectType = objectType;
     this.transform = transform;
 }
Example #54
0
 //no target specified e.g. we detect by object type not specific target address
 public ZoneObject(string id, ActorType actorType,
                   Transform3D transform, bool isImpenetrable, EventParameters eventParameters)
     : this(id, actorType, transform, isImpenetrable, eventParameters, null)
 {
 }