コード例 #1
0
        private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            List <(int, Vector2)> path;

            if (_generateLeft)
            {
                path = new List <(int, Vector2)>
                {
                    (0, _rightVector),
                    (2 * 60, _downRightVector),
                };

                var chopper = new ChopperSprite(_texture, path);
                chopper.Position = new Vector2(-200, 100);
                _chopperHandler(chopper);
            }
            else
            {
                path = new List <(int, Vector2)>
                {
                    (0, _leftVector),
                    (2 * 60, _downLeftVector),
                };

                var chopper = new ChopperSprite(_texture, path);
                chopper.Position = new Vector2(1500, 100);
                _chopperHandler(chopper);
            }

            _generateLeft = !_generateLeft;

            _choppersGenerated++;
            if (_choppersGenerated == _maxChoppers)
            {
                StopGenerating();
            }
        }
コード例 #2
0
 public override void LoadContent()
 {
     _chopper          = new ChopperSprite(LoadTexture(ChopperTexture), new System.Collections.Generic.List <(int, Vector2)>());
     _chopper.Position = new Vector2(300, 100);
     AddGameObject(_chopper);
 }
コード例 #3
0
 private void AddChopper(ChopperSprite chopper)
 {
     chopper.OnObjectChanged += _chopperSprite_OnObjectChanged;
     _enemyList.Add(chopper);
     AddGameObject(chopper);
 }