public new void Construct(IScoreManager scoreManager) { _particle = GetComponentInChildren <ParticleSystem>(); var createState = new Sequence( new CheckCrystal(), new CustomAction(c => { _particle?.Play(); scoreManager.AddScore(1); }), new WaitForSecondAction(_particle != null ? _particle.main.duration : 0), new DestroyEntity() ); Behaiour.Register(BehaiourState.Create, createState); }
void OnTriggerExit2D(Collider2D other) { if (other.tag == Tag.Shot) { shotFactory.ReturnShotToPool(other.gameObject); } else if (other.tag == Tag.Enemy) { Enemy enemyComponent = other.GetComponent <Enemy>(); if (!enemyComponent.Dead) { scoreManager.AddScore(Consts.Score.MissEnemy); } enemyFactory.ReturnToPool(other.gameObject); } }
private void ApplyDamage(float damage) { if (Dead) { return; } _health -= damage; _health = _health < 0 ? 0 : _health; ShowProgress(); Debug.LogFormat("damage: {0}", damage); if (!Dead) { return; } Animator.Stop(); _rigidbody.gravityScale = 1; scoreManager.AddScore(Consts.Score.KillEnemy); }