// остановка public virtual void stop(bool andWithOutCallback = true) { if (andWithOutCallback) { callBackOnDone = null; } onCyclesFinish(); }
private IEnumerator DoEffect() { while (initDone) { if (mpGenerator.MP < mpGenerator.MaxMP) { mpGenerator.MP += generationRate; OnEffectDone?.Invoke(); yield return(new WaitForSeconds(generationDelay)); } yield return(null); } }
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; } } } } }
public void subscribeOnEffectDone(OnEffectDone newCallBack) { callBackOnDone = newCallBack; }