예제 #1
0
        public override void Init()
        {
            base.Init();
            _changeDirectionTimer = new Timer();
            _changeDirectionTimer.Duration = 3;
            _changeDirectionTimer.Run();
            _changeDirectionTimer.OnTick += (s, a) => dir *= -1;
            _changeDirectionTimer.Repeat = true;

            _shootingTimer = new Timer();
            _shootingTimer.Duration = 1.5f;
            _shootingTimer.Repeat = true;
            _shootingTimer.OnTick += (s, a) =>
            {
                var b = CreateInstance("Bullet", Transform.Position);
                var bc = b.GetComponent<BulletControl>();
                bc.Side = Side.Enemy;
                bc.Transform.RotationVector = new Vector2(-1, 0);
            };
            _shootingTimer.Run();

            dir = 1;
        }
예제 #2
0
 public override void Init()
 {
     base.Init();
     _shootingTimer = new Timer();
     _shootingTimer.Duration = 1.0f;
 }