示例#1
0
        public FishEnemy(Vector2 pos, PlayerCreature player)
        {
            enemyHabitat = Enemy.EnemyHabitat.ENEMY_HABITAT_SEA;
            enemyType = Enemy.EnemyType.ENEMY_TYPE_FISH;
            sprite = new SpriteTile();
            this.player = player;

            if (texInfo == null)
            {
                //texInfo = new TextureInfo ("/Application/assets/stingray_float.png");
                texInfo = new TextureInfo(AssetManager.GetTexture("stingray_float"), new Vector2i(4,1),TRS.Quad0_1);
            }

            if (spriteList == null)
            {
                spriteList = new SpriteList(texInfo);
            }

            spriteList.Position = new Vector2(0.0f,0.0f);
            spriteList.AddChild(sprite);

            Animations = new Dictionary<string, Animation>();
            //texInfo = new TextureInfo(AssetManager.GetTexture("stingray_float"), new Vector2i(4,1),TRS.Quad0_1);
            Animations.Add("idle" , new Animation(0, 3, 0.3f, false));
            CurrentAnimation = Animations["idle"];
            CurrentAnimation.Play();

            sprite.GetContentWorldBounds(ref boundingBox);
            sprite.Quad.S = new Vector2(321, 270);// map 1:1 on screen -- necessary? !!!\
            sprite.CenterSprite();
            sprite.Position = pos;
            sprite.Schedule((dt) => UpdateEnemyState(dt));
        }