Ejemplo n.º 1
0
    public override void Die()
    {
        IsDead = true;
        if (nav)
        {
            nav.isStopped = true;
        }

        enemyTakingDamage.IsDead = true;
        // Animation
        animator.SetTrigger("Death");

        // Drop Item
        this.GetComponent <DropTable>().GetRandomItem();

        if (listStrDeathSound.Capacity > 0)
        {
            int rand = Random.Range(0, listStrDeathSound.Capacity - 2);
            AudioMng.GetInstance().PlaySound(listStrDeathSound[rand], this.transform.position, 120f);
        }


        // Destroy
        Destroy(this.gameObject, animator.GetCurrentAnimatorStateInfo(0).length + 1);
    }
Ejemplo n.º 2
0
    public void Attack(Animator _objAnimator)
    {
        Debug.Log("isNormalAtking = " + isNormalAtking);
        //Debug.Log("waitingTimeForAtk = " + waitingTimeForAtk);
        //Debug.Log("elapsedTimeAfterAtk = " + elapsedTimeAfterAtk);
        //isAtking은 코루틴에서 시간 계산 후 false값이 들어가도록 설정.
        if (!isNormalAtking)
        {
            isLeavingMeshElapseTime = true;

            switch (Random.Range(0, 2))
            {
            case 0:
                AudioMng.GetInstance().PlaySound("AttackSound_1", objTr.position, 100f);
                break;

            case 1:
                AudioMng.GetInstance().PlaySound("AttackSound_2", objTr.position, 100f);
                break;

            case 2:
                AudioMng.GetInstance().PlaySound("AttackSound_3", objTr.position, 100f);
                break;
            }
            elapsedTimeAfterAtk = 0.0f;

            isNormalAtking = true;

            //애니 이벤트로 NormalAttack 실행
            _objAnimator.SetTrigger("NormalAtk");
        }
    }
Ejemplo n.º 3
0
    public override void Attack(Animator _objAnimator)
    {
        //isAtking은 코루틴에서 시간 계산 후 false값이 들어가도록 설정.
        if (!isAtking)
        {
            canAttack = true;

            switch (Random.Range(0, 2))
            {
            case 0:
                AudioMng.GetInstance().PlaySound("AttackSound_1", objTr.position, 100f);
                break;

            case 1:
                AudioMng.GetInstance().PlaySound("AttackSound_2", objTr.position, 100f);
                break;

            case 2:
                AudioMng.GetInstance().PlaySound("AttackSound_3", objTr.position, 100f);
                break;
            }
            elapsedTimeAfterAtk = 0.0f;
            isAtking            = true;

            //애니 이벤트로 WeaponAttack 실행
            _objAnimator.SetTrigger("Attack");
        }
    }
Ejemplo n.º 4
0
    public void Die()
    {
        Vector3    newPos = this.transform.position;
        Quaternion quater = this.transform.rotation;

        newPos.y += 1f;

        Instantiate(ParticleMng.GetInstance().EffectSmallExp(), newPos, quater);
        AudioMng.GetInstance().PlaySound("PlayerDie", newPos, 100f);


        Destroy(gameObject);
        GameMng.Instance.GameOver();
    }
Ejemplo n.º 5
0
    private IEnumerator coroutineSpawn()
    {
        int count = 8;

        while (count > 0)
        {
            Vector3 newPos = tr.position;
            int     rand   = Random.Range(0, enemyPrefab.Capacity);

            newPos.x += 3f * Mathf.Cos(count * 45f * Mathf.Deg2Rad);
            newPos.z += 3f * Mathf.Sin(count * 45f * Mathf.Deg2Rad);
            Instantiate(enemyPrefab[rand], newPos, tr.rotation);
            Instantiate(ParticleMng.GetInstance().EffectPlasmaExp(), newPos, tr.rotation);
            AudioMng.GetInstance().PlaySound("MoveIn", tr.position, 100f);

            --count;
            yield return(new WaitForSeconds(0.15f));
        }
        Destroy(this.gameObject);
    }
Ejemplo n.º 6
0
    private void Update()
    {
        int  slotNumber      = 0;
        Item it              = null;
        bool isPressedNumber = false;

        if (Input.GetKeyDown(KeyCode.F) && slot.IsCanPickUpItem())
        {
            pickup.CheckItemInArea(tr.position);
        }

        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            slotNumber = 0; isPressedNumber = true;
        }
        else if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            slotNumber = 1; isPressedNumber = true;
        }
        else if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            slotNumber = 2; isPressedNumber = true;
        }
        else if (Input.GetKeyDown(KeyCode.Alpha4))
        {
            slotNumber = 3; isPressedNumber = true;
        }
        else if (Input.GetKeyDown(KeyCode.Alpha5))
        {
            slotNumber = 4; isPressedNumber = true;
        }

        if (isPressedNumber)
        {
            isPressedNumber = false;
            // 그리고 누른 번호에 해당하는 슬롯의 정보를 현재 장착슬롯에 적용및 누른번호에 해당하는 슬롯에 대한 정보 소거
            // 따로 빼낸 정보를 슬롯에 추가
            AudioMng.GetInstance().PlaySound("Button1", tr.position, 100f);

            // 현재 낀 아이템이 있는지 체크
            if (equipment.IsEquipWeapon)
            {
                Item itMain = equipment.UnEquip();
                it = slot.GetItemListNumber(slotNumber);
                it.gameObject.SetActive(true);
                slot.RemoveItemMain();
                slot.AddItemMain(slot.ItemList[slotNumber]);
                slot.RemoveItemInNumber(slotNumber);
                slot.AddItem(slotNumber, itMain);
                equipment.Equip(it);
            }
            else
            {
                slot.RemoveItemMain();
                it = slot.GetItemListNumber(slotNumber);
                slot.AddItemMain(it);
                slot.RemoveItemInNumber(slotNumber);
                slot.AddItemEmpty(slotNumber);
                equipment.Equip(it);
            }
        }
    }
Ejemplo n.º 7
0
    private void OnTriggerEnter(Collider other)
    {
        if (!isDead)
        {
            if (opponentObjAtkTagName == null)
            {
                Debug.LogError("WeaponTag Name is null");
            }

            if (other.tag == opponentObjAtkTagName)
            {
                float weaponDamage = other.gameObject.GetComponent <NeedWeaponThingsForSystem>().Damage;

                CharacterStat  objStat  = this.gameObject.GetComponent <CharacterStat>();
                WeaponMeshCtrl meshCtrl = other.GetComponent <WeaponMeshCtrl>();

                //Weapon의 메쉬일 경우
                if (meshCtrl.IsWeaponMesh)
                {
                    Weapon weapon = null;

                    if (meshCtrl)
                    {
                        weapon = meshCtrl.WeaponGameObject;
                    }
                    else
                    {
                        weapon = other.GetComponent <ProjectileCtrl>().WeaponGameObject;
                    }

                    Vector3 newPos = tr.position;
                    newPos.y += 1f;

                    // Paticle
                    Instantiate(ParticleMng.GetInstance().EffectBulletImpactWood(), newPos, tr.rotation);
                    Instantiate(ParticleMng.GetInstance().EffectBulletImpactMetal(), newPos, tr.rotation);

                    if (weapon.listSoundName.Capacity > 0)
                    {
                        int rand = Random.Range(0, weapon.listSoundName.Count);
                        AudioMng.GetInstance().PlaySound(weapon.listSoundName[rand], this.transform.position, 120f);
                    }

                    if (!isAttacked && meshCtrl)
                    {
                        isAttacked = true;
                        weapon.SubtractDurability();
                    }

                    // Combo
                    ComboSystemMng.GetInstance().AddCombo(50f);

                    // Taking Damage
                    objStat.TakeDamage(weaponDamage);
                }

                //노멀 어택의 메쉬인 경우
                else
                {
                    NormalAtkCtrl normalAtkCtrl = other.GetComponent <NormalAtkCtrl>();

                    Vector3 newPos = tr.position;
                    newPos.y += 1f;

                    // Paticle
                    Instantiate(ParticleMng.GetInstance().EffectBulletImpactWood(), newPos, tr.rotation);
                    Instantiate(ParticleMng.GetInstance().EffectBulletImpactMetal(), newPos, tr.rotation);

                    //경훈이가 만들었는데 사운드 부분이여서 일단 자름
                    //if (normalAtkCtrl.listSoundName.Capacity > 0)
                    //{
                    //    int rand = Random.Range(0, normalAtkCtrl.listSoundName.Count);
                    //    AudioMng.GetInstance().PlaySound(normalAtkCtrl.listSoundName[rand], this.transform.position, 120f);
                    //}

                    if (!isAttacked)
                    {
                        isAttacked = true;
                    }

                    // Combo
                    ComboSystemMng.GetInstance().AddCombo(50f);

                    // Taking Damage
                    objStat.TakeDamage(weaponDamage);
                }
            }
        }
    }