Esempio n. 1
0
 // остановка
 public virtual void stop(bool andWithOutCallback = true)
 {
     if (andWithOutCallback)
     {
         callBackOnDone = null;
     }
     onCyclesFinish();
 }
Esempio n. 2
0
 private IEnumerator DoEffect()
 {
     while (initDone)
     {
         if (mpGenerator.MP < mpGenerator.MaxMP)
         {
             mpGenerator.MP += generationRate;
             OnEffectDone?.Invoke();
             yield return(new WaitForSeconds(generationDelay));
         }
         yield return(null);
     }
 }
Esempio n. 3
0
        private IEnumerator Shoot()
        {
            while (initDone)
            {
                yield return(new WaitForSeconds(shootingDelay));

#if UNITY_EDITOR
                Debug.DrawRay(this.transform.position, this.transform.TransformDirection(Vector3.forward) * distance, Color.white, shootingDelay);
#endif
                if (Physics.Raycast(this.transform.position, this.transform.TransformDirection(Vector3.forward), out var hit, distance))
                {
                    OnEffectDone?.Invoke();
                    var enemyBase = hit.collider?.GetComponentInParent <BaseEnemy>();
                    if (enemyBase != null)
                    {
                        var enemy = (IEnemy)enemyBase;
                        if (enemy.EnemyState.IsAlive)
                        {
                            enemy.EnemyState.HP -= damage;
                        }
                    }
                }
            }
        }
Esempio n. 4
0
 public void subscribeOnEffectDone(OnEffectDone newCallBack)
 {
     callBackOnDone = newCallBack;
 }