示例#1
0
文件: BaseEffect.cs 项目: lunice/bgo
 // остановка
 public virtual void stop(bool andWithOutCallback = true)
 {
     if (andWithOutCallback)
     {
         callBackOnDone = null;
     }
     onCyclesFinish();
 }
示例#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);
     }
 }
示例#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;
                        }
                    }
                }
            }
        }
示例#4
0
文件: BaseEffect.cs 项目: lunice/bgo
 public void subscribeOnEffectDone(OnEffectDone newCallBack)
 {
     callBackOnDone = newCallBack;
 }