예제 #1
0
        public Slash(float x, float y, float dirX, float dirY, Damage.Side side)
            : base(x, y)
        {
            sprite = new Spritemap(Global.imagePath + "Player/Slash.png", 64, 64);
            sprite.Add(0, new Anim("0-3", "3"));
            sprite.Angle    = MathHelper.ToDegrees((float)Math.Atan2(dirX, dirY)) + 90;
            sprite.FlippedY = dirX > 0;
            sprite.SetOrigin(0, 32);

            AddGraphic(sprite);
            sprite.Play(0);
            sprite.Anims[0].NoRepeat();
            sprite.Anims[0].OnComplete += () => { RemoveSelf(); };

            AddComponents(damage = new Damage(5, x, y, side));

            var col = new LineCollider(-dirX * 10, -dirY * 10, -dirX * 50, -dirY * 50, Global.Tags.Attack);

            AddCollider(col);
            AddComponent(new YSort());
        }