コード例 #1
0
ファイル: PlayerAtkMng.cs プロジェクト: spriggan4/MyProject
    private void Start()
    {
        objTr = this.gameObject.transform;

        playerAnim = this.gameObject.GetComponent <Animator>();
        if (!playerAnim)
        {
            Debug.LogError("PlayerAtkMng의 playerAnim is null");
            Debug.Break();
        }

        comboSystemMng = ComboSystemMng.GetInstance();
        if (!comboSystemMng)
        {
            Debug.LogError("PlayerAtkMng의 comboSystemMng is null");
        }

        playerStats = this.gameObject.GetComponent <PlayerStats>();
        if (!playerStats)
        {
            Debug.LogError("playerAtkMng의 playerStats이 비었음");
        }

        normalAtkCtrl = this.gameObject.GetComponent <NormalAtkCtrl>();
        if (!normalAtkCtrl)
        {
            Debug.LogError("playerAtkMng의 normalAtkCtrl이 비었음");
        }

        elapsedMaintableTimeAfterSpecialAtk = playerStats.SpecialAtkMaintableTime;

        if (!specialAtkUiText)
        {
            Debug.LogError("PlayerAtkMng의 specialAtkUiText is null");
        }
        else
        {
            textUi = specialAtkUiText.GetComponent <Text>();
            if (!textUi)
            {
                Debug.LogError("textUi is Null , Maybe comboTextUi dont have Text Component");
            }
            specialAtkUiTextRct = specialAtkUiText.GetComponent <RectTransform>();
        }
        specialAtkUiText.gameObject.SetActive(false);

        SetForNormalAtk();
    }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        comboSystemMng = ComboSystemMng.GetInstance();
        if (!comboSystemMng)
        {
            Debug.LogError("EndTutorial의 comboSystemMng is null");
            Debug.Break();
        }

        player = GameObject.FindGameObjectWithTag("Player");
        if (!player)
        {
            Debug.LogError("EndTutorial의 playeris null");
            Debug.Break();
        }
        else
        {
            playerAtkMng = player.gameObject.GetComponent <PlayerAtkMng>();
            if (!playerAtkMng)
            {
                Debug.LogError("EndTutorial의 playerAtkMng is null");
            }
        }
    }
コード例 #3
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);
                }
            }
        }
    }
コード例 #4
0
 // Use this for initialization
 void Start()
 {
     comboSystemMng = ComboSystemMng.GetInstance();
 }