예제 #1
0
파일: Sea.cs 프로젝트: davidyu/Poisson
 public override void Render(GameTime gameTime, SpriteBatch batch, Camera cam)
 {
     batch.Draw(this.SpriteTexture, this.Pos,
         this.SpriteRect, Color.White,
         this.Orient, new Vector2(0f, 0f), 2.0f, SpriteEffects.None, this.depth);
     batch.Draw(this.SpriteTexture, this.Pos- cam.ScreenToWorld(new Vector2(this.SpriteRect.Width, 0.0f)),
        this.SpriteRect, Color.White,
        this.Orient, new Vector2(0f, 0f), 2.0f, SpriteEffects.None, this.depth);
 }
예제 #2
0
파일: Fish.cs 프로젝트: davidyu/Poisson
 private void PollInput(Camera cam)
 {
     TouchCollection tc = TouchPanel.GetState();
     foreach (TouchLocation tl in tc) {
         if (tl.State == TouchLocationState.Moved || tl.State == TouchLocationState.Pressed) {
             Vector2 touchPos = cam.ScreenToWorld(tl.Position); //converted to camera pos
             SteerToward(touchPos, 0.1f);
             Thrust();
         }
     }
 }
예제 #3
0
파일: Fish.cs 프로젝트: davidyu/Poisson
 private void FindNewTarget(Camera cam)
 {
     Random random = new Random();
     this.target = cam.ScreenToWorld(new Vector2((float)random.NextDouble() * 800.0f, (float)random.NextDouble() * 480.0f));
 }