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; }
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++; } }