public static TutorialAnimation loadTutorial(String filepath) { using (StreamReader reader = new StreamReader(filepath)) { String line; String[] values; char[] delimeter = { ' ' }; long timestamp; float x, y, z; long firstTimestamp = -1; TutorialAnimationCheckpoint tmp; List<TutorialAnimationCheckpoint> checkpoints = new List<TutorialAnimationCheckpoint>(); while ((line = reader.ReadLine()) != null) { //interpret line values = line.Split(delimeter); timestamp = long.Parse(values[0]); x = float.Parse(values[1]); y = float.Parse(values[2]); z = float.Parse(values[3]); if (firstTimestamp < 0) { firstTimestamp = timestamp; } tmp = new TutorialAnimationCheckpoint((timestamp - firstTimestamp), x, y, z); checkpoints.Add(tmp); } TutorialAnimation animation = new TutorialAnimation(checkpoints); return animation; } }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); Content.RootDirectory = "Content1"; tutorialFont = Content.Load<SpriteFont>("TutorialFont"); labelFont = Content.Load<SpriteFont>("LabelFont"); rightHandSprite = Content.Load<Texture2D>("rHand"); leftHandSprite = Content.Load<Texture2D>("lHand"); leftHandTutorialSprite = Content.Load<Texture2D>("lTutorialHand"); rightHandTutorialSprite = Content.Load<Texture2D>("rTutorialHand"); tutorialButtonSprite = Content.Load<Texture2D>("tutorialButton"); buttonLowSprite = Content.Load<Texture2D>("buttonLow"); buttonHighSprite = Content.Load<Texture2D>("buttonHigh"); guideAnimationRight = FileLoader.loadTutorial("tutorialFiles/guideRightHand.txt"); guideAnimationLeft = FileLoader.loadTutorial("tutorialFiles/guideLeftHand.txt"); this.setTutorialState(new GuideTutorial(this), TutorialType.GUIDE); spawnAnimationRight = FileLoader.loadTutorial("tutorialFiles/spawnRightHand.txt"); spawnAnimationLeft = FileLoader.loadTutorial("tutorialFiles/spawnLeftHand.txt"); despawnAnimationRight = FileLoader.loadTutorial("tutorialFiles/despawnRightHand.txt"); despawnAnimationLeft = FileLoader.loadTutorial("tutorialFiles/despawnLeftHand.txt"); instatiniateButtons(); kinectRGBVideo = new Texture2D(GraphicsDevice, 640, 480); basicEffect = new BasicEffect(GraphicsDevice); kinectController.addButton(tutorialButton); kinectController.addButton(cohesionButton); kinectController.addButton(alignmentButton); kinectController.addButton(separationButton); }
public void setRightAnimation(TutorialAnimation animation) { this.rightHandAnimator = animation; rightHandAnimator.restartAnimation(); }
public void setLeftAnimation(TutorialAnimation animation) { this.leftHandAnimator = animation; leftHandAnimator.restartAnimation(); }