Esempio n. 1
0
    public void MakeSubChar()
    {
        if (this.m_kParentChar == null)
        {
            return;
        }
        if (this.m_kParentChar.m_k3DChar == null)
        {
            return;
        }
        if (null == this.m_kParentChar.m_k3DChar.GetRootGameObject())
        {
            return;
        }
        int     num    = -1;
        Vector3 vector = default(Vector3);

        vector.x = this.m_kParentChar.m_k3DChar.GetRootGameObject().transform.position.x;
        vector.y = this.m_kParentChar.m_k3DChar.GetRootGameObject().transform.position.y;
        vector.z = this.m_kParentChar.m_k3DChar.GetRootGameObject().transform.position.z;
        Vector3 a    = this.m_kParentChar.m_k3DChar.GetRootGameObject().transform.TransformDirection(Vector3.forward);
        float   num2 = NrSubCharHelper.s_fSubCharDistance;
        Vector3 a2   = a * -num2;
        float   num3 = Mathf.Atan2(a.x, a.z) * 180f / 3.14159274f;

        num3 = 180f - ((num3 <= 0f) ? (num3 + 360f) : num3);
        float   x    = vector.x;
        float   z    = vector.z;
        float   f    = 0.0174532924f * num3;
        float   num4 = Mathf.Cos(f);
        float   num5 = Mathf.Sin(f);
        Vector3 a3   = Vector3.zero;

        NrSubCharHelper.NrSubCharEntity[] kSubCharList = this.m_kSubCharList;
        for (int i = 0; i < kSubCharList.Length; i++)
        {
            NrSubCharHelper.NrSubCharEntity nrSubCharEntity = kSubCharList[i];
            if (0 < nrSubCharEntity.SubCharKind)
            {
                num++;
                if (0 < num)
                {
                    if (num % 2 != 0)
                    {
                        vector.x += 2.5f;
                    }
                    else
                    {
                        vector.x  = x;
                        vector.z += 2.5f;
                    }
                }
                if (nrSubCharEntity.SubChar == null)
                {
                    float num6 = vector.x - x;
                    float num7 = vector.z - z;
                    a3.x = num4 * num6 + -num5 * num7 + x;
                    a3.y = 0f;
                    a3.z = num5 * num6 + num4 * num7 + z;
                    a3  += a2 / 2f;
                    if (!nrSubCharEntity.MakeSubChar(a3.x, a3.z, a.x, a.z))
                    {
                        return;
                    }
                }
            }
        }
        this.m_bNeedMakeSubChar = false;
    }