Esempio n. 1
0
 public static ParticleMng GetInstance()
 {
     if (!instance)
     {
         instance = (ParticleMng)GameObject.FindObjectOfType(typeof(ParticleMng));
         if (!instance)
         {
             Debug.LogError("Cant Find GameObject what have ParticleMng Component");
         }
     }
     return(instance);
 }
Esempio n. 2
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();
    }
Esempio n. 3
0
    private IEnumerator KnockBack()
    {
        Vector3    newPos = tr.position;
        Quaternion quater = tr.rotation;

        newPos.y += 1f;
        Instantiate(ParticleMng.GetInstance().EffectBloodSprray(), newPos, quater);
        Instantiate(ParticleMng.GetInstance().EffectBulletImpactFleshBig(), newPos, quater);

        while (elapsedTimeAfterKnockBack < knockBackTime)
        {
            direction.y = 0;
            playerCtrl.transform.position += (direction * forcePow) / 100;
            elapsedTimeAfterKnockBack     += Time.deltaTime;
            yield return(new WaitForFixedUpdate());
        }
        isKnockBackOn             = false;
        playerCtrl.CanInputSwitch = true;
    }
Esempio n. 4
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);
    }
Esempio n. 5
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);
                }
            }
        }
    }