示例#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;
 }
        public static Controller GetController()
        {
            sController = new Controller(UserIndex.One);
            if (sController.IsConnected)
                return sController;

            sController = new Controller(UserIndex.Two);
            if (sController.IsConnected)
                return sController;

            sController = new Controller(UserIndex.Three);
            if (sController.IsConnected)
                return sController;

            sController = new Controller(UserIndex.Four);
            if (sController.IsConnected)
                return sController;

            return null;
        }
 public static Controller GetController(UserIndex index)
 {
     sController = new Controller(index);
     return sController.IsConnected ? sController : null;
 }
示例#4
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);
        }