Beispiel #1
0
        public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            switch(this.behaviour)
              {
            case EvilFishBehaviour.Chase:
              break;
            case EvilFishBehaviour.Idle:

              this.destination = this.GetNewDestination();
              this.velocity = this.destination - this.Position;

              this.velocity = this.velocity * 0.05f;
              this.behaviour = EvilFishBehaviour.Swimming;
              break;
            case EvilFishBehaviour.Swimming:
              if((this.destination - this.Position).Length() <= 20)
              {
            this.behaviour = EvilFishBehaviour.Idle;
              }
              break;
            default:
              break;
              }

              this.Position = this.Position + this.velocity;
        }
Beispiel #2
0
        public EvilFish()
        {
            this.Sprite = GraphicsManager.GetSprite(NibblyFishGame.Textures.EvilFish);

              this.Sprite.Color = _colors[GameManager.Random.Next(0, _colors.Count)];

              this.destination = this.GetNewDestination();
              this.behaviour = EvilFishBehaviour.Idle;
        }