コード例 #1
0
ファイル: Unit.cs プロジェクト: kmimimi/shooting_game
        /// <summary>
        /// 유닛 죽음
        /// </summary>
        public virtual void Die()
        {
            if (!string.IsNullOrEmpty(this.dieSoundKey))
            {
                SoundManager.inst.PlaySound(this.dieSoundKey, 0.2f);
            }

            this.unitState = UnitState.Death;
            this.controller.OnDie();
            this.conditionModule.Collect();

            if (this.agent.enabled)
            {
                this.agent.enabled = false;
            }

            if (this.unitSide == UnitSide.Enemy)
            {
                // 퀘스트가 있다면 퀘스트 체크
                QuestManager.inst.CheckQuest_Accum(QuestCheckKey.QuestKey_Hunt_ + this.unitKey, 1);

                // 코인 뿌림. 값은 그냥 랜덤줌.
                int count = Random.Range(3, 5);
                for (int i = 0; i < count; i++)
                {
                    CoinObject coin = ObjectPoolManager.inst.Get <CoinObject>(PrefabPath.Coin);

                    coin.transform.position = this.transform.position;
                    coin.Init(Random.Range(30, 50));
                    coin.PlayAnimation(KUtils.SamplePosition_NavMesh(this.transform.position + new Vector3(Random.Range(-1.0f, 1.0f), 0, Random.Range(-1.0f, 1.0f))));
                }

                // 스코어 누적
                if (StageMaster.current != null)
                {
                    if (this.isBoss)
                    {
                        StageMaster.current.scoreInfo.killBoss++;
                    }
                    else
                    {
                        StageMaster.current.scoreInfo.killMonster++;
                    }
                }
            }

            // 죽으면 모든 콜라이더 끔
            for (int i = 0; i < this.cols.Length; i++)
            {
                this.cols[i].enabled = false;
            }


            this.animCtrl.TriggerDie();
        }
コード例 #2
0
        /// <summary>
        /// 작은 거미를 소환한다.(Called By Skill)
        /// 직접 호출금지.
        /// </summary>
        public void Summon()
        {
            Metalon mini = ObjectPoolManager.inst.Get <Metalon>(PrefabPath.Unit.MetalonMini);

            mini.transform.position = this.tail.transform.position;
            mini.unitSide           = this.unitSide;
            (mini.controller as MetalonAIController).targetPosition = KUtils.SamplePosition_NavMesh(mini.transform.position + new Vector3(Random.Range(-1, 1.0f) * 10, 0, Random.Range(-1, 1.0f) * 10));

            mini.Init();

            SoundManager.inst.PlaySound(SoundKeys.EFFECT_CREATE_METALON_MINI, this.transform.position);
        }
コード例 #3
0
        /// <summary>
        /// index == 0 : 기본공격
        /// index == 1 : SpellAttack(SpellAttack은 종류가 여러가지임)
        /// index == 2 : JumpAttack
        /// </summary>
        public override void OnStartAttackEvent(int index)
        {
            base.OnStartAttackEvent(index);

            switch (index)
            {
            case SKILL_IDX_ATTACK:     // 기본 공격
            {
                SkillUtility.SimpleRangeDamage(this, this.hone.position, 1.5f, this.unitSide, this.defaultDamage, PrefabPath.Particle.FireHit, SoundKeys.EFFECT_HIT_SOUND);
                SoundManager.inst.PlaySound(SoundKeys.EFFECT_PUNCH, this.hone.position);
            }
            break;

            case SKILL_IDX_BULLET_ATTACK:
            {
                if (this.spell == SpellAttackKind.Direct)         // 360 샷
                {
                    this.skillModule.skills[SKILL_IDX_BULLET_ATTACK].Action();
                }
                else if (this.spell == SpellAttackKind.Summon)         // 소환
                {
                    this.skillModule.skills[SKILL_IDX_SUMMON].Action();
                }
                else if (this.spell == SpellAttackKind.SpiderWeb)         // 거미줄(일부로 하드코딩 했음)
                {
                    for (int i = 0; i < 2; i++)
                    {
                        SpiderWeb web = ObjectPoolManager.inst.Get <SpiderWeb>(PrefabPath.SpiderWeb);
                        web.transform.position = this.transform.position;

                        web.Init(this, Vector2.one * (Random.Range(-1.0f, 1) + 3));
                        web.PlayAnimation(KUtils.SamplePosition_NavMesh(this.transform.position + new Vector3(Random.Range(-5, 5), 0, Random.Range(-5, 5))));
                        SoundManager.inst.PlaySound(SoundKeys.EFFECT_CREATE_SPIDER_WEB, this.transform.position);
                    }
                }
            }
            break;

            case SKILL_IDX_JUMP_ATTACK:     // 점프공격
            {
                this.skillModule.skills[SKILL_IDX_JUMP_ATTACK].Action();
            }
            break;
            }
        }