コード例 #1
0
    private void SetRenderer(Obj obj, Boolean isBattle)
    {
        if (!this.isPosObj(obj))
        {
            return;
        }
        PosObj posObj = (PosObj)obj;

        if (!((UnityEngine.Object)posObj.go != (UnityEngine.Object)null))
        {
            return;
        }
        Boolean flag1     = (Int32)obj.flags != obj.tempFlag;
        Boolean flag2     = (Int32)posObj.meshflags != (Int32)posObj.tempMeshflags;
        Boolean flag3     = posObj.frontCamera != posObj.tempfrontCamera;
        Int32   meshCount = posObj.geoGetMeshCount();
        Boolean flag4     = ((Int32)obj.flags & 1) == 1;
        Boolean flag5     = posObj.frontCamera;
        Int32   num1      = 0;

        if ((UnityEngine.Object)posObj.go.GetComponent <HonoBehavior>() != (UnityEngine.Object)null)
        {
            if (flag1 || flag2 || flag3)
            {
                if (flag4 && flag5)
                {
                    for (Int32 mesh = 0; mesh < meshCount; ++mesh)
                    {
                        Boolean flag6 = (Int32)posObj.geoMeshChkFlags(mesh) == 0;
                        posObj.SetIsEnabledMeshRenderer(mesh, flag6 && flag4);
                        if (flag6 && flag4)
                        {
                            ++num1;
                        }
                    }
                    foreach (FieldMapActor componentsInChild in posObj.go.GetComponentsInChildren <FieldMapActor>())
                    {
                        componentsInChild.actor.tempFlag = -1;
                    }
                }
                else
                {
                    Actor actor = (Actor)obj;
                    foreach (Renderer componentsInChild in posObj.go.GetComponentsInChildren <Renderer>())
                    {
                        if ((Int32)FF9StateSystem.Common.FF9.fldMapNo != 52 || (Int32)actor.sid != 6 && (Int32)actor.sid != 13 || this.eBin.getVarManually(6357) == 0)
                        {
                            componentsInChild.enabled = false;
                        }
                    }
                }
                obj.tempFlag           = (Int32)obj.flags;
                posObj.tempMeshflags   = posObj.meshflags;
                posObj.tempfrontCamera = posObj.frontCamera;
                if (isBattle)
                {
                    Transform child1 = posObj.go.transform.FindChild("field_model");
                    if ((UnityEngine.Object)child1 != (UnityEngine.Object)null)
                    {
                        foreach (Renderer componentsInChild in child1.GetComponentsInChildren <Renderer>())
                        {
                            componentsInChild.enabled = false;
                        }
                    }
                    if (num1 == meshCount)
                    {
                        Transform child2 = posObj.go.transform.FindChild("battle_model");
                        if ((UnityEngine.Object)child2 != (UnityEngine.Object)null)
                        {
                            foreach (Renderer componentsInChild in child2.GetComponentsInChildren <Renderer>())
                            {
                                componentsInChild.enabled = true;
                            }
                        }
                    }
                }
                else
                {
                    Transform child1 = posObj.go.transform.FindChild("battle_model");
                    if ((UnityEngine.Object)child1 != (UnityEngine.Object)null)
                    {
                        foreach (Renderer componentsInChild in child1.GetComponentsInChildren <Renderer>())
                        {
                            componentsInChild.enabled = false;
                        }
                    }
                    if (num1 == meshCount)
                    {
                        Transform child2 = posObj.go.transform.FindChild("field_model");
                        if ((UnityEngine.Object)child2 != (UnityEngine.Object)null)
                        {
                            foreach (Renderer componentsInChild in child2.GetComponentsInChildren <Renderer>())
                            {
                                componentsInChild.enabled = true;
                            }
                        }
                    }
                }
            }
            if (this.gMode != 1)
            {
                return;
            }
            Actor actor1 = (Actor)obj;
            Dictionary <Int32, FF9Shadow> dictionary = FF9StateSystem.Field.FF9Field.loc.map.shadowArray;
            if (!dictionary.ContainsKey((Int32)actor1.uid))
            {
                return;
            }
            FF9Shadow    ff9Shadow    = dictionary[(Int32)actor1.uid];
            MeshRenderer meshRenderer = actor1.fieldMapActor.shadowMeshRenderer;
            Transform    transform    = actor1.fieldMapActor.shadowTran;
            if (ff9Shadow.needUpdate || flag1)
            {
                ff9Shadow.needUpdate = false;
                Boolean flag6 = flag4 && ((Int32)FF9StateSystem.Common.FF9.FF9GetCharPtr((Int32)obj.uid).attr & 16) == 0;
                meshRenderer.enabled = flag6;
                transform.localScale = (Int32)FF9StateSystem.Common.FF9.fldMapNo != 2913 || (Int32)actor1.uid != 6 ? new Vector3(ff9Shadow.xScale, 1f, ff9Shadow.zScale) : new Vector3(ff9Shadow.xScale, 1f, ff9Shadow.zScale) * actor1.fieldMapActor.transform.localScale.z;
            }
            if (!ff9Shadow.needUpdateAmp || !meshRenderer.enabled)
            {
                return;
            }
            ff9Shadow.needUpdateAmp = false;
            Byte num2 = (Byte)(ff9Shadow.amp * 2);
            meshRenderer.material.SetColor("_Color", (Color) new Color32(num2, num2, num2, Byte.MaxValue));
        }
        else
        {
            if (!(obj.isEnableRenderer ^ flag4))
            {
                return;
            }
            foreach (Renderer componentsInChild in obj.go.GetComponentsInChildren <Renderer>())
            {
                componentsInChild.enabled = flag4;
            }
            obj.isEnableRenderer = flag4;
        }
    }
コード例 #2
0
ファイル: FieldMapActor.cs プロジェクト: ArtReeX/memoria
    public override void HonoLateUpdate()
    {
        if (FF9StateSystem.Common.FF9.fldMapNo == 70)
        {
            return;
        }
        BGCAM_DEF currentBgCamera  = this._fieldMap.GetCurrentBgCamera();
        Matrix4x4 cam              = FF9StateSystem.Common.FF9.cam;
        UInt16    proj             = FF9StateSystem.Common.FF9.proj;
        Vector2   projectionOffset = FF9StateSystem.Common.FF9.projectionOffset;
        Vector3   position         = base.transform.position;

        this.projectedPos   = PSX.CalculateGTE_RTPT_POS(position, Matrix4x4.identity, cam, (Single)proj, projectionOffset, true);
        this.projectedDepth = this.projectedPos.z / 4f + (Single)FF9StateSystem.Field.FF9Field.loc.map.charOTOffset;
        this.charOTOffset   = FF9StateSystem.Field.FF9Field.loc.map.charOTOffset;
        if (this.projectedDepth < 100f || this.projectedDepth > 3996f)
        {
        }
        Single num  = PSX.CalculateGTE_RTPTZ(base.transform.position, Matrix4x4.identity, cam, (Single)proj, projectionOffset) * 1f;
        Single num2 = num / 4f + (Single)FF9StateSystem.Field.FF9Field.loc.map.charOTOffset;

        if (this.meshRenderer != null)
        {
            if (this.actor != null)
            {
                PosObj posObj = this.actor;
                if (num2 < 100f || num2 > 3996f)
                {
                    if (FF9StateSystem.Common.FF9.fldMapNo == 1413)
                    {
                        FieldMapActorController component = base.GetComponent <FieldMapActorController>();
                        if (component.originalActor.sid == 12)
                        {
                            posObj.frontCamera = true;
                        }
                        else
                        {
                            posObj.frontCamera = false;
                        }
                    }
                    else if (FF9StateSystem.Common.FF9.fldMapNo == 1414)
                    {
                        FieldMapActorController component2 = base.GetComponent <FieldMapActorController>();
                        if (component2.originalActor.sid == 16)
                        {
                            posObj.frontCamera = true;
                        }
                        else
                        {
                            posObj.frontCamera = false;
                        }
                    }
                    else if (FF9StateSystem.Common.FF9.fldMapNo != 2752 && FF9StateSystem.Common.FF9.fldMapNo != 1707)
                    {
                        posObj.frontCamera = false;
                    }
                    return;
                }
                posObj.frontCamera = true;
            }
            Renderer[] array = this.meshRenderer;
            for (Int32 i = 0; i < (Int32)array.Length; i++)
            {
                Renderer renderer = array[i];
                if (renderer.enabled)
                {
                    Single num3;
                    if (MBG.MarkCharacterDepth)
                    {
                        num3 = 8f;
                    }
                    else
                    {
                        num3 = num;
                    }
                    this.charPsxZ = num3;
                    this.charZ    = (Single)(((Int32)num3 / 4 + FF9StateSystem.Field.FF9Field.loc.map.charOTOffset) * 1);
                    this.charZ    = (Single)(-(Single)((Int32)this.charZ));
                    if (FF9StateSystem.Common.FF9.fldMapNo == 2510 && this.actor.uid == 8)
                    {
                        renderer.material.SetFloat("_CharZ", 20f);
                    }
                    if (FF9StateSystem.Common.FF9.fldMapNo == 2363 && this.actor.uid == 33)
                    {
                        renderer.material.SetFloat("_CharZ", 20f);
                    }
                }
            }
        }
        if (this.actor == null)
        {
            return;
        }
        FF9Shadow ff9Shadow = FF9StateSystem.Field.FF9Field.loc.map.shadowArray[(Int32)this.actor.uid];
        Vector3   zero      = Vector3.zero;

        if (FF9StateSystem.Common.FF9.fldMapNo == 661 && this.actor.uid == 3)
        {
            zero = new Vector3(-39f, -14f, 80f);
        }
        else if (FF9StateSystem.Common.FF9.fldMapNo == 1659 && this.actor.uid == 128)
        {
            zero = new Vector3(0f, -66f, 0f);
        }
        else if (FF9StateSystem.Common.FF9.fldMapNo == 1659 && this.actor.uid == 129)
        {
            zero = new Vector3(0f, -21f, 0f);
        }
        else if (FF9StateSystem.Common.FF9.fldMapNo == 2363 && (this.actor.uid == 16 || this.actor.uid == 15 || this.actor.uid == 32 || this.actor.uid == 33))
        {
            zero = new Vector3(0f, -15f, 0f);
        }
        Vector3 a = this.GetShadowCurrentPos();

        if ((FF9StateSystem.Common.FF9.fldMapNo == 2107 && this.actor.uid == 5) || (FF9StateSystem.Common.FF9.fldMapNo == 2102 && this.actor.uid == 4))
        {
            a   = base.transform.position;
            a.y = 0f;
        }
        this.shadowTran.localPosition = a + new Vector3(ff9Shadow.xOffset, this.shadowHeightOffset * 1f, ff9Shadow.zOffset) + zero;
        Single num4 = PSX.CalculateGTE_RTPTZ(this.shadowTran.position, Matrix4x4.identity, cam, (Single)proj, projectionOffset);

        num4          = (Single)(((Int32)num4 / 4 + FF9StateSystem.Field.FF9Field.loc.map.charOTOffset) * 1);
        num4          = (Single)(-(Single)((Int32)num4));
        this.shadowZ  = (Int32)num4;
        this.charAbsZ = base.transform.position.z;
    }