示例#1
0
        public override void CleanUp()
        {
            base.CleanUp();

            _tortugaStateMachine.CleanUp();
            _tortugaStateMachine = null;
        }
示例#2
0
        public Tortuga(Vector2 position, int spriteIndex) : base(position, new Box(position, new Vector2(8, 8)), spriteIndex)
        {
            AddComponent(new TopDownPhysics(10, 10));

            var anim = new P8TopDownAnimator(P8TopDownAnimator.AnimationMode.SIDES_ONLY);

            anim.RunRight  = new SpriteAnimation(new P8Sprite(22), 4, _animationLength);
            anim.IdleRight = new SpriteAnimation(new P8Sprite(21), 1, _animationLength);

            anim.RunLeft  = new SpriteAnimation(new P8Sprite(22, 1, 1, true, false), 4, _animationLength);
            anim.IdleLeft = new SpriteAnimation(new P8Sprite(21, 1, 1, true, false), 1, _animationLength);

            AddComponent(anim);

            _tortugaStateMachine = new TortugaStateMachine(this);
            _tortugaStateMachine.Init(TortugaStates.Wondering);

            lifeTime = 200;
        }