예제 #1
0
파일: Enemy.cs 프로젝트: fdlr3/TDGame
        public void Init
        (
            Vector2 position,
            Rectangle final_position,
            Vector2 rand_position,
            float angle,
            HealthBar roothp,
            ref EnergyStorage ES
        )
        {
            _position       = position;
            _final_position = final_position;
            _ES             = ES;
            _isvalid        = true;
            _arrived        = false;
            _counter        = 0;
            _pause          = 0;
            _damage_counter = 0;
            _angle          = angle;
            _killed         = false;
            _healthbar      = new Tuple <HealthBar, HealthBar>
                              (
                roothp.Clone() as HealthBar,
                roothp.Clone() as HealthBar
                              );
            _healthbar.Item1.SetColor(Color.Red);
            _healthbar.Item2.SetColor(Color.Black);

            //calculate direction
            Vector2 diff = Vector2.Subtract(position, rand_position);

            _direction = Vector2.Normalize(diff);
        }
예제 #2
0
 public EnergyStorageManager(Texture2D texture, int w, int h, HealthBar healtroot)
 {
     _rootenergystorage = new EnergyStorage(texture, w, h);
     _energy_storages   = new List <EnergyStorage>();
     _hproot            = healtroot;
 }