Exemplo n.º 1
0
        public IEnumerator BulletPatternDefeatedTest()
        {
            bool isBulletPatternFinished = false;
            EventHandler <EventArgs> onBulletPatternDefeated = (o, s) => isBulletPatternFinished = true;

            BulletPattern   bulletPattern                   = DataInjectorTestHelerMethod.GetTestBulletPattern(1).GetComponent <BulletPattern>();
            IEnemyComponent bulletPatternComponent          = bulletPattern.IntializeEnemyComponent();
            BulletPattern   BulletPatternFromEnemyComponent = (BulletPattern)bulletPatternComponent;

            BulletPatternFromEnemyComponent.OnEnemyFinished += onBulletPatternDefeated;
            BulletPatternFromEnemyComponent.ActiveEnemyComponent();

            BulletPatternFromEnemyComponent.Health.DecreseHealth(100);

            Assert.That(isBulletPatternFinished);

            yield return(null);
        }
Exemplo n.º 2
0
        public IEnumerator BullletPatternTimeOutTest()
        {
            bool isBulletPatternFinished = false, isBulletPatternEnded = false;
            EventHandler <EventArgs> onBulletPatternFinished = (o, s) => isBulletPatternFinished = true;
            EventHandler <EventArgs> onBulletPatternEnded    = (o, s) => isBulletPatternEnded = true;

            BulletPattern   bulletPattern                    = DataInjectorTestHelerMethod.GetTestBulletPattern(1).GetComponent <BulletPattern>();
            IEnemyComponent bulletPatternComponent           = bulletPattern.IntializeEnemyComponent();
            BulletPattern   bulletPatternComponentCast       = (BulletPattern)bulletPatternComponent;

            bulletPatternComponentCast.OnEnemyFinished += onBulletPatternFinished;
            bulletPatternComponentCast.OnEnemyEnd      += onBulletPatternEnded;
            bulletPatternComponentCast.ActiveEnemyComponent();

            yield return(new WaitForSecondsRealtime(3.05f));

            bulletPatternComponentCast.DeactiveEnemyComponent();

            Debug.Log($"{isBulletPatternFinished.ToString()} {isBulletPatternEnded.ToString()}");
            Assert.That(isBulletPatternFinished && isBulletPatternEnded);;
        }