public Machinegun(AbstractScene scene, Hero hero) : base(scene, hero) { Animations = new AnimationStateMachine(); RemoveComponent <AnimationStateMachine>(); AddComponent(Animations); AllAmmo = 0; //LeftFacingOffset = new Vector2(50, 0); //RightFacingOffset = new Vector2(-50, 0); if (hero.CurrentFaceDirection == Direction.EAST) { Transform.Position = RightFacingOffset; } else { Transform.Position = LeftFacingOffset; } /*SpriteSheetAnimation machineGunLeft = new SpriteSheetAnimation(this, Assets.GetTexture("Machinegun"), 1); * Animations.RegisterAnimation("MachineGunLeft", machineGunLeft, () => CurrentFaceDirection == Direction.WEST); * * SpriteSheetAnimation machineGunRight = machineGunLeft.CopyFlipped(); * machineGunLeft.FlipVertical(); * Animations.RegisterAnimation("MachineGunRight", machineGunRight, () => CurrentFaceDirection == Direction.EAST);*/ SpriteSheetAnimation animLeft = new SpriteSheetAnimation(this, Assets.GetTexture("Machinegun"), 32, 32, 1); SpriteSheetAnimation animRight = animLeft.CopyFlipped(); animLeft = animLeft.CopyFlipped(); animLeft.FlipVertical(); Animations.RegisterAnimation("MachineGunLeft", animLeft, () => CurrentFaceDirection == Direction.WEST); Animations.RegisterAnimation("MachineGunRight", animRight, () => CurrentFaceDirection == Direction.EAST); }
public Handgun(AbstractScene scene, Hero hero) : base(scene, hero) { LeftFacingOffset = new Vector2(-3, -17); RightFacingOffset = new Vector2(3, -17); if (hero.CurrentFaceDirection == Direction.EAST) { Transform.Position = RightFacingOffset; } else { Transform.Position = LeftFacingOffset; } ClipSize = 7; AmmoInClip = ClipSize; AllAmmo = 0; Animations.Offset = Offset; SpriteSheetAnimation animLeft = new SpriteSheetAnimation(this, Assets.GetTexture("Gun"), 40); animLeft.StartFrame = 1; animLeft.EndFrame = 2; SpriteSheetAnimation animRight = animLeft.CopyFlipped(); animLeft = animLeft.CopyFlipped(); animLeft.FlipVertical(); Animations.RegisterAnimation("GunLeft", animLeft, () => CurrentFaceDirection == Direction.WEST); Animations.RegisterAnimation("GunRight", animRight, () => CurrentFaceDirection == Direction.EAST); //AddComponent(Texture); //DEBUG_SHOW_PIVOT = true; }