コード例 #1
0
        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);
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
ファイル: Enemy.cs プロジェクト: Silentworker/Chameleon
        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);
        }