Пример #1
0
        public Bullet(Handler handler, Vector2 position, Vector2 forward, int damage, float speed, Gun.Weights weight) : base(handler, position)
        {
            width  = DEFAULT_WIDTH;
            height = DEFAULT_HEIGHT;

            this.forward = forward;
            this.speed   = speed;
            this.damage  = damage;
            this.weight  = weight;

            bounds = new Rectangle(0, 0, width, height);

            texture = Assets.s_bullet;
        }
Пример #2
0
        private void CreateBlood(ref Bullet b, Gun.Weights weight)
        {
            int  x        = b.forward.X > 0 ? (int)position.X + width / 2 : (int)position.X - width / 2;
            bool faceLeft = b.forward.X > 0 ? false : true;

            Animation blood;
            int       r = handler.GetRandom(0, 1);

            switch (weight)
            {
            case Gun.Weights.LIGHT:
                if (r == 0)
                {
                    blood = new Animation(Assets.a_bloodSpirtMedium1, handler, faceLeft);
                }
                else
                {
                    blood = new Animation(Assets.a_bloodSpirtMedium2, handler, faceLeft);
                }
                break;

            case Gun.Weights.MEDIUM:
                if (r == 0)
                {
                    blood = new Animation(Assets.a_bloodSpirtMedium1, handler, faceLeft);
                }
                else
                {
                    blood = new Animation(Assets.a_bloodSpirtMedium2, handler, faceLeft);
                }
                break;

            case Gun.Weights.HEAVY:
                if (r == 0)
                {
                    blood = new Animation(Assets.a_bloodSpirtHard1, handler, faceLeft);
                }
                else
                {
                    blood = new Animation(Assets.a_bloodSpirtHard2, handler, faceLeft);
                }
                break;

            default: blood = new Animation(Assets.a_bloodSpirtHard1, handler, faceLeft); break;
            }

            blood.SetRectangle(new Rectangle(x, (int)position.Y, 40, 40));

            handler.GetAnimationManager().Add(blood);
        }