Ejemplo n.º 1
0
    void OnTriggerEnter(Collider collider)
    {
        AtkElement atkTmp = collider.GetComponent <AtkElement>();

        if (atkTmp == null)
        {
            return;
        }
        if (MultyManager.Inst == null)
        {
            if (atkTmp.GetUnit().GetType() == m_Unit.GetType())
            {
                return;
            }
        }
        else
        {
            if (atkTmp.GetUnit() == m_Unit)
            {
                return;
            }
        }

        m_nValue -= atkTmp.GetValue();
        atkTmp.PooledThis();
        //ObjectPool.GetInst ().PooledObject (collider.transform.gameObject);
        if (m_nValue < 0)
        {
            PooledThis();
            //ObjectPool.GetInst ().PooledObject (transform.gameObject);
        }
    }
Ejemplo n.º 2
0
    protected override IEnumerator ExecuteCoroutine()
    {
        yield return(new WaitUntil(() => m_Unit != null));

        transform.parent   = null;
        transform.position = m_Unit.transform.position + transform.forward + transform.up;
        if (m_Unit.GetTransformAtk() != null)
        {
            transform.position = m_Unit.GetTransformAtk().position;
        }
        for (int i = 0; i < m_argoBullets.Length; i++)
        {
            m_argoBullets [i].SetActive(true);
            AtkElement atkTmp = m_argoBullets [i].GetComponent <AtkElement> ();
            atkTmp.SetUnit(m_Unit);
            atkTmp.SetValue(m_nValue);
            yield return(new WaitForSeconds(0.1f));
        }
        yield return(new WaitForSeconds(0.5f));

        while (m_bAllive)
        {
            if (transform.childCount == m_argoBullets.Length)
            {
                PooledThis();
            }
            yield return(null);
        }

        yield return(null);
    }
    private IEnumerator UseAtkEffectCoroutine(ChipData chipData)
    {
        yield return(new WaitForSeconds(0.35f));

        m_goChip = ObjectPool.GetInst().GetObject(chipData.objType);

        m_goChip.transform.position = m_goHand.transform.position;

        AtkElement atkTmp = m_goChip.transform.GetComponent <AtkElement> ();

        atkTmp.SetUnit(this);
        atkTmp.SetValue(chipData.nValue);

        yield return(null);

        m_goChip = null;
        ResetIdle();

        yield return(null);
    }
    protected IEnumerator UseWeaponCoroutine(ChipData chipData)
    {
        UseSubCam();

        yield return(null);

        GameObject goWeapon = null;

        if (chipData.objType == null)
        {
            yield break;
        }

        m_goChip = ObjectPool.GetInst().GetObject(chipData.objType);

        goWeapon = m_goChip.transform.Find("WeaponArm").gameObject;


        m_goChip.transform.parent = m_goWeaponArm.transform;
        //m_goChip.transform.localRotation = m_goHand.transform.localRotation;
        m_goChip.transform.localPosition = new Vector3(0.0f, 0.0f, 0.0f);
        m_goChip.transform.localRotation = Quaternion.identity;
        m_goChip.transform.Rotate(-90.0f, 0.0f, 0.0f);
        goWeapon.transform.localPosition = new Vector3(0.0f, 0.0f, 0.0f);
        goWeapon.transform.localRotation = Quaternion.identity;

        AtkElement atkTmp = goWeapon.transform.GetChild(0).GetComponent <AtkElement>();

        if (atkTmp != null)
        {
            atkTmp.SetUnit(this);
            atkTmp.transform.localPosition = m_transAtk.position;
            atkTmp.SetValue(chipData.nValue);
        }

        yield return(new WaitForSeconds(0.8f));

        m_goChip = null;
        ResetIdle();
        yield return(null);
    }
    protected override IEnumerator AttackCorutine()
    {
        if (m_goChip != null)
        {
            yield break;
        }

        while (m_act == E_ACT.ATK)
        {
            if (StageMgr.Inst.IsPlay == false)
            {
                m_act = E_ACT.IDLE;
                yield break;
            }

            int        nPlAnim = (int)E_PlAnimState.NormalShot;
            int        nDmg    = m_baseAtk.nDmg;
            GameObject objType = m_baseAtk.objType;
            if (m_bCharged == true)
            {
                m_bCharged = false;
                nPlAnim    = (int)E_PlAnimState.RecoilShot;
                objType    = m_goChargeAtk;
                nDmg      *= 10;
            }
            m_anim.SetInteger("CurAnim", nPlAnim);
            m_fChargeTime = 0.0f;
            yield return(null);

            GameObject objTmp = ObjectPool.GetInst().GetObject(objType);

            AtkElement atkTmp = objTmp.GetComponent <AtkElement> ();
            atkTmp.SetValue(nDmg);

            atkTmp.SetUnit(this);
            objTmp.transform.position = m_transAtk.position;
            yield return(new WaitForSeconds(0.5f));
        }
    }