Esempio n. 1
0
    protected void GeneralProjectileType()
    {
        Debug.DrawLine(transform.position, transform.position + m_vDir * WeaponInfo.fProjectileSpeed, Color.yellow);

        Vector2 vPos = transform.position + m_vDir * WeaponInfo.fProjectileSpeed * Time.deltaTime;

        SetVPos(vPos);
    }
Esempio n. 2
0
    protected void GuidedProjectileType()
    {
        GameObject     pEntity     = null;
        EA_CObjectBase pObjectBase = null;

        if (!string.IsNullOrEmpty(WeaponInfo.m_strTargetActorBoneName))
        {
            pObjectBase = EACObjManager.instance.GetActor(WeaponInfo.m_TargetActorId);
        }
        else
        {
            pObjectBase = EACObjManager.instance.GetGameObject(WeaponInfo.m_TargetActorId);
        }

        if (pObjectBase != null && pObjectBase.GetLinkEntity())
        {
            pEntity = pObjectBase.GetLinkEntity();

            Collider c = pObjectBase.collider;

            Vector3 vColliderPos = Vector3.zero;

            if (c != null)
            {
                vColliderPos = c.bounds.extents;
            }

            Vector3 vTargetPos = (pEntity.gameObject.transform.position) + vColliderPos;

            Vector3 vDiff = vTargetPos - transform.position;

            m_vDir = vDiff;
            m_vDir.Normalize();
        }
        else
        {
            WeaponInfo.m_TargetActorId = CObjGlobal.InvalidObjID;
            m_vDir = m_vStartDir;
        }

        Debug.DrawLine(transform.position, transform.position + m_vDir * WeaponInfo.fProjectileSpeed * Time.deltaTime, Color.yellow);

        Vector3 vPos = transform.position + m_vDir * WeaponInfo.fProjectileSpeed * Time.deltaTime;

        SetVPos(vPos);
    }
Esempio n. 3
0
    /// <summary>
    /// Display currently registered bone
    /// </summary>
    protected void DrawBone()
    {
        foreach (KeyValuePair <int, Transform> t in transformList)
        {
            float   len    = 0.05f;
            Vector3 loxalX = new Vector3(len, 0, 0);
            Vector3 loxalY = new Vector3(0, len, 0);
            Vector3 loxalZ = new Vector3(0, 0, len);

            loxalX = t.Value.rotation * loxalX;
            loxalY = t.Value.rotation * loxalY;
            loxalZ = t.Value.rotation * loxalZ;

            for (int i = 0; i < t.Value.childCount; ++i)
            {
                Debug.DrawLine(t.Value.position, t.Value.GetChild(i).position, Color.white);
            }
        }
    }
Esempio n. 4
0
    protected void HitCheck()
    {
        if (GetItemBase() == null)
        {
            return;
        }

        excludeIds[0] = GetItemBase().GetItemInfo().m_HavenUser;
        excludeIds[1] = m_weaponId;

        List <Collider> hits = HitHelper.HitTestProjectile(m_collider, m_prePos, m_vDir, WeaponInfo.fProjectileSpeed * Time.deltaTime, false, false, excludeIds);

        if (hits != null && hits.Count > 0)
        {
            OnTriggerEnter(hits[0]);
        }

        Debug.DrawLine(m_prePos, transform.position, Color.blue);
        m_prePos = transform.position;
    }