Esempio n. 1
0
        public NpcTank(Model model, GraphicsDevice device, Camera camera, int[,] map, int r, int c, Vector3 Position,
            Vector3 Direction)
            : base(model)
        {
            pickPosition = Tank.tankPosition;
            tankPosition = Position;
            v = new Velocity();
            array = map;
            row = r;
            col = c;

            isNavigate = false;
            bCollision = false;

            leftBackWheelBone = model.Bones["l_back_wheel_geo"];
            rightBackWheelBone = model.Bones["r_back_wheel_geo"];
            leftFrontWheelBone = model.Bones["l_front_wheel_geo"];
            rightFrontWheelBone = model.Bones["r_front_wheel_geo"];
            leftSteerBone = model.Bones["l_steer_geo"];
            rightSteerBone = model.Bones["r_steer_geo"];
            turretBone = model.Bones["turret_geo"];
            cannonBone = model.Bones["canon_geo"];
            hatchBone = model.Bones["hatch_geo"];

            leftBackWheelTransform = leftBackWheelBone.Transform;
            rightBackWheelTransform = rightBackWheelBone.Transform;
            leftFrontWheelTransform = leftFrontWheelBone.Transform;
            rightFrontWheelTransform = rightFrontWheelBone.Transform;
            leftSteerTransform = leftSteerBone.Transform;
            rightSteerTransform = rightSteerBone.Transform;
            turretTransform = turretBone.Transform;
            cannonTransform = cannonBone.Transform;
            hatchTransform = hatchBone.Transform;

            XElement xml = XElement.Load(@"Content/fsm_npc1.xml");
            listtankstate = new List<TankState>();

            int i = 0;
            foreach (XElement state in xml.Elements())
            {
                listtankstate.Add(new TankState());
                listtankstate[i].fromState = state.Attribute("fromState").Value.ToString();
                listtankstate[i].condition = new List<string>();
                listtankstate[i].toState = new List<string>();
                foreach (XElement transition in state.Elements())
                {
                    listtankstate[i].condition.Add(transition.Attribute("condition").Value.ToString());
                    listtankstate[i].toState.Add(transition.Attribute("toState").Value.ToString());
                }
                i++;

            }
        }
Esempio n. 2
0
        public Tank(Model model, GraphicsDevice device, Camera camera, int[,] map, int r, int c)
            : base(model)
        {
            pickPosition = Vector3.Zero;
            tankPosition = Vector3.Zero;
            mousePick = new MousePick(device, camera);
            v = new Velocity();
            preMousePick = Vector3.Zero;
            array = map;
            row = r;
            col = c;

            isNavigate = false;

            leftBackWheelBone = model.Bones["l_back_wheel_geo"];
            rightBackWheelBone = model.Bones["r_back_wheel_geo"];
            leftFrontWheelBone = model.Bones["l_front_wheel_geo"];
            rightFrontWheelBone = model.Bones["r_front_wheel_geo"];
            leftSteerBone = model.Bones["l_steer_geo"];
            rightSteerBone = model.Bones["r_steer_geo"];
            turretBone = model.Bones["turret_geo"];
            cannonBone = model.Bones["canon_geo"];
            hatchBone = model.Bones["hatch_geo"];

            leftBackWheelTransform = leftBackWheelBone.Transform;
            rightBackWheelTransform = rightBackWheelBone.Transform;
            leftFrontWheelTransform = leftFrontWheelBone.Transform;
            rightFrontWheelTransform = rightFrontWheelBone.Transform;
            leftSteerTransform = leftSteerBone.Transform;
            rightSteerTransform = rightSteerBone.Transform;
            turretTransform = turretBone.Transform;
            cannonTransform = cannonBone.Transform;
            hatchTransform = hatchBone.Transform;
        }
Esempio n. 3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            //camera = new Camera(this, cameraPosition, new Vector3(0, 25, 0), Vector3.Up);
            //camera = new Camera(this, new Vector3(0, 2500, 500), new Vector3(500, 200, 500), Vector3.Up);

            //camera = new Camera(this, new Vector3(0, 1500, 4000),new Vector3(0, 0, 3000), Vector3.Up);
            camera = new Camera(this, new Vector3(-200, 3200, -3000), new Vector3(-200, 0, 500), Vector3.Up);

            Components.Add(camera);

            modelManager = new ModelManager(this);
            Components.Add(modelManager);

            this.IsMouseVisible = true;
            base.Initialize();
        }
Esempio n. 4
0
 public override void Draw(GraphicsDevice device, Camera camera)
 {
     device.SamplerStates[0] = SamplerState.LinearClamp;
     base.Draw(device, camera);
 }
Esempio n. 5
0
 public override void Draw(GraphicsDevice device, Camera camera)
 {
     base.Draw(device, camera);
 }
Esempio n. 6
0
 public Boundary(Model model, GraphicsDevice device, Camera camera, Vector3 postions)
     : base(model)
 {
     translation = Matrix.CreateTranslation(postions);
 }
Esempio n. 7
0
 public MousePick(GraphicsDevice device, Camera camera)
 {
     this.device = device;
     this.camera = camera;
 }