Beispiel #1
0
 public NonPlayerCreature(
     Vector3 position,
     float height,
     float radius,
     float mass,
     float sensitivityRadius,
     Controller controller,
     Renderable renderable,
     float visionAngle,
     int listeningSensitivity,
     int sneak,
     int intimidation,
     Part part,
     Spawner spawn
     )
     : base(position, height, radius, mass, renderable, new ListeningSensor(sensitivityRadius, visionAngle, listeningSensitivity), controller, 1)
 {
     mIncapacitated = false;
     Sneak = sneak;
     Intimidation = intimidation;
     Controller = controller;
     AddPart(part, 0);
     Spawner = spawn;
     CharacterController.HorizontalMotionConstraint.Speed = 9.0f;
 }
Beispiel #2
0
 public PhysicsObject(Renderable renderable, Entity entity)
 {
     mRenderable = renderable;
     Scale = new Vector3(1.0f);
     Entity = entity;
     Entity.Tag = this;
     Entity.CollisionInformation.Tag = this;
     CollidingObjects = new List<IGameObject>();
     Entity.CollisionInformation.Events.InitialCollisionDetected += InitialCollisionDetected;
     Entity.CollisionInformation.Events.CollisionEnded += CollisionEnded;
 }
Beispiel #3
0
 /// <summary>
 /// Construct a new immovable Prop.
 /// </summary>
 /// <param name="modelName">Name of the model.</param>
 /// <param name="translation">The position.</param>
 /// <param name="orientation">The orientation.</param>
 /// <param name="scale">The amount to scale by.</param>
 public Prop(String modelName, Vector3 translation, Quaternion orientation, Vector3 scale)
 {
     mRenderable = new InanimateModel(modelName);
     StaticCollidable = new InstancedMesh(
         CollisionMeshManager.LookupStaticMesh(modelName),
         new AffineTransform(scale, orientation, translation)
     );
     Position = translation;
     XNAOrientationMatrix = Matrix.CreateFromQuaternion(orientation);
     Scale = scale;
 }
Beispiel #4
0
        public Projectile(Renderable renderable, Entity entity, Actor owner, Vector3 direction, float speed, Vector3 scale)
            : base(renderable, entity)
        {
            if (direction.Length() != 0.0f)
            {
                direction.Normalize();
            }

            mOwner = owner;
            mProjectileImpulse = new Vector3(direction.X * speed, direction.Y * speed, direction.Z * speed);
            mSpeed = speed;

            Entity.Position = owner.Position;
            XNAOrientationMatrix = Matrix.CreateLookAt(owner.Position, direction, owner.Up);
            Scale = scale;

            CollisionRules.AddRule(Entity, owner.Entity, CollisionRule.NoBroadPhase);
            Entity.CollisionInformation.CollisionRules.Group = ProjectileGroup;

            Entity.PositionUpdateMode = BEPUphysics.PositionUpdating.PositionUpdateMode.Continuous;

            Entity.ApplyLinearImpulse(ref mProjectileImpulse);
        }
Beispiel #5
0
 public Actor(Renderable renderable, Entity entity)
     : base(renderable, entity)
 {
 }
Beispiel #6
0
 /// <summary>
 /// Construct a SubPart for the construction of a Part.
 /// </summary>
 /// <param name="renderable">Renderable which will be drawn attached to the Creature owning this part.</param>
 /// <param name="preferredBones">Array of PartBones in order of preference on which the renderable will be drawn.</param>
 /// <param name="position">Position offset from the bone.</param>
 /// <param name="orientation">Orientation offset from the bone.</param>
 /// <param name="scale">Scale offset from the Creature.</param>
 public SubPart(Renderable renderable, Creature.PartBone[] preferredBones, Vector3 position, Matrix orientation, Vector3 scale)
 {
     Renderable = renderable;
     PreferredBones = preferredBones;
     Position = position;
     Orientation = orientation;
     Scale = scale;
 }
Beispiel #7
0
        /// <summary>
        /// Construct a new Creature.
        /// </summary>
        /// <param name="position">The position of the Creature.</param>
        /// <param name="height">The height of the collision object.</param>
        /// <param name="radius">The radius of the collision object.</param>
        /// <param name="mass">The mass of the Creature.</param>
        /// <param name="renderable">The Creaure's renderable.</param>
        /// <param name="visionSensor">A sensor defining the Creature's field of view.</param>
        /// <param name="controller">The controller for this Creature, its brain.</param>
        /// <param name="numParts">The number of parts this Creature supports.</param>
        public Creature(Vector3 position, float height, float radius, float mass, Renderable renderable, VisionSensor visionSensor, Controller controller, int numParts)
            : base(renderable, new Cylinder(position, height, radius, mass))
        {
            mHeight = height;

            Sensor = visionSensor;
            CollisionRules.AddRule(Entity, Sensor.Entity, CollisionRule.NoBroadPhase);
            Forward = new Vector3(0.0f, 0.0f, -1.0f);
            mPartAttachments = new List<PartAttachment>(numParts);
            for (int i = 0; i < numParts; ++i)
            {
                mPartAttachments.Add(null);
            }

            mUnusedPartBones = GetUsablePartBones();

            CharacterController = new CharacterController(Entity, 1.0f);
            SlideSlope = CharacterController.SupportFinder.MaximumSlope;

            Controller = controller;
            controller.SetCreature(this);

            mBoneIndex = 0;

            //mTrailParticles = new ParticleSystem("puff", Position);
        }