示例#1
0
        public Enemy(float x, float y, string fileName)
        {
            _x = x;
            _y = y;
            var strings = File.ReadAllLines("Enemies/" + fileName);

            _width        = float.Parse(strings[0]);
            _height       = float.Parse(strings[1]);
            _speed        = float.Parse(strings[2]);
            _attackSpeed  = double.Parse(strings[3]);
            _leftTexture  = int.Parse(strings[4]);
            _rightTexture = int.Parse(strings[5]);

            _currentTexture = _leftTexture;
            _shotChar       = new ShotCharacteristics(strings[6] + ".f");

            _maxHp     = int.Parse(strings[7]);
            _hp        = _maxHp;
            _damage    = int.Parse(strings[8]);
            _shotSpeed = float.Parse(strings[9]);
            _shotRange = float.Parse(strings[10]);
            _name      = strings[11];
            _canShoot  = true;
            _isDead    = false;

            _isWaiting       = true;
            _timer           = new Timer(1000);
            _isWaiting       = true;
            _timer.AutoReset = false;
            _timer.Elapsed  += OnTimedEvent;
        }
示例#2
0
        public Person(float x, float y, float width, float height, float speed, double attackSpeed,
                      int leftTexture, int rightTexture, ShotCharacteristics shotChar, int hp, int damage, float shotSpeed,
                      float shotRange, string name)
        {
            _x              = x;
            _y              = y;
            _width          = width;
            _height         = height;
            _speed          = speed;
            _leftTexture    = leftTexture;
            _rightTexture   = rightTexture;
            _currentTexture = leftTexture;
            _attackSpeed    = attackSpeed;
            _canShoot       = true;
            _isDead         = false;
            _shotChar       = shotChar;
            _hp             = hp;
            _maxHp          = hp;
            _damage         = damage;
            _shotSpeed      = shotSpeed;
            _shotRange      = shotRange;
            _name           = name;
            _xAttack        = Form.Left;
            _yAttack        = Form.Bottom - Form.Height / 2;

            _timer.Interval  = _attackSpeed;
            _timer.AutoReset = false;
            _timer.Elapsed  += OnTimedEvent;
        }
示例#3
0
 public Player(int id, float x, float y, float width, float height, float speed, double attackSpeed,
               int leftTexture, int rightTexture, ShotCharacteristics shotChar, int hp, int damage,
               float shotSpeed, float shotRange, string name)
     : base(x, y, width, height, speed, attackSpeed, leftTexture, rightTexture, shotChar, hp, damage,
            shotSpeed, shotRange, name)
 {
     _id = id;
 }
示例#4
0
 public Boss(float x, float y, float width, float height, float speed, double attackSpeed,
             int leftTexture, int rightTexture, ShotCharacteristics shotChar, int hp, int damage,
             float shotSpeed, float shotRange, string name, BossAction skill)
     : base(x, y, width, height, speed, attackSpeed, leftTexture, rightTexture, shotChar, hp, damage,
            shotSpeed, shotRange, name)
 {
     _canUseSkill = true;
     _skill       = skill;
     _isFinal     = false;
 }
示例#5
0
 public Enemy(float x, float y, float width, float height, float speed, double attackSpeed,
              int leftTexture, int rightTexture, ShotCharacteristics shotChar, int hp, int damage,
              float shotSpeed, float shotRange, string name)
     : base(x, y, width, height, speed, attackSpeed, leftTexture, rightTexture, shotChar, hp, damage,
            shotSpeed, shotRange, name)
 {
     _isWaiting       = true;
     _timer           = new Timer(1000);
     _isWaiting       = true;
     _timer.AutoReset = false;
     _timer.Elapsed  += OnTimedEvent;
 }