public void LoadChara(string path, float posX = 0f, float posY = 4000f, float cPosY = 0f, float cPosZ = 0f, bool useCamCont = true)
    {
        GameObject original = AssetDataMng.Instance().LoadObject(path, null, true) as GameObject;

        this.goChara  = UnityEngine.Object.Instantiate <GameObject>(original);
        this.cpParams = this.goChara.GetComponent <CharacterParams>();
        if (null != this.cpParams)
        {
            this.cpParams.SetBillBoardCamera(this.cam);
            this.cpParams.PlayAnimation(CharacterAnimationType.idle, SkillType.Attack, 0, null, null);
        }
        this.goChara.name = path;
        this.goChara.transform.SetParent(base.gameObject.transform);
        if (useCamCont)
        {
            if (null != this.cpParams)
            {
                this.cpParams.SetPreviewCamera(this.cam);
            }
        }
        else
        {
            this.goChara.transform.localPosition = new Vector3(0f, cPosY, cPosZ);
        }
        Quaternion localRotation = Quaternion.Euler(0f, -10f, 0f);

        this.goChara.transform.localRotation    = localRotation;
        base.gameObject.transform.localPosition = new Vector3(posX, posY, 0f);
        this.smrList = CommonRender3DRT.GetCompoSMR(this.goChara);
        if (this.smrList != null)
        {
            this.SetSMRUpdateFlag(this.smrList);
        }
    }
Exemple #2
0
    private void InitOutline()
    {
        List <SkinnedMeshRenderer> compoSMR = CommonRender3DRT.GetCompoSMR(base.gameObject);

        this.matList    = CommonRender3DRT.GetAllMaterialsInSMRS(compoSMR);
        this.valueList  = CommonRender3DRT.GetOutlineWidth(this.matList);
        this.farmCamera = FarmRoot.Instance.Camera;
    }
        public static void SetWireFrameRendering(GameObject modelObject)
        {
            List <SkinnedMeshRenderer> compoSMR = CommonRender3DRT.GetCompoSMR(modelObject);

            if (compoSMR != null)
            {
                foreach (SkinnedMeshRenderer skinMesh in compoSMR)
                {
                    CutsceneCommon.SetSubMeshRendering(skinMesh, MeshTopology.Lines);
                }
            }
        }
        public static void ChangeMaterial(GameObject modelObject, List <Material[]> materialsList)
        {
            List <SkinnedMeshRenderer> compoSMR = CommonRender3DRT.GetCompoSMR(modelObject);

            if (compoSMR != null && compoSMR.Count == materialsList.Count)
            {
                for (int i = 0; i < compoSMR.Count; i++)
                {
                    compoSMR[i].materials = materialsList[i];
                }
            }
        }
        public static void ResetRendering(GameObject modelObject)
        {
            List <SkinnedMeshRenderer> compoSMR = CommonRender3DRT.GetCompoSMR(modelObject);

            if (compoSMR != null)
            {
                for (int i = 0; i < compoSMR.Count; i++)
                {
                    CutsceneCommon.SetSubMeshRendering(compoSMR[i], MeshTopology.Triangles);
                }
            }
        }
        public static List <Material[]> GetMaterial(GameObject modelObject)
        {
            List <Material[]>          list     = new List <Material[]>();
            List <SkinnedMeshRenderer> compoSMR = CommonRender3DRT.GetCompoSMR(modelObject);

            if (compoSMR != null)
            {
                foreach (SkinnedMeshRenderer skinnedMeshRenderer in compoSMR)
                {
                    list.Add(skinnedMeshRenderer.materials);
                }
            }
            return(list);
        }
        public static void ChangeMaterial(GameObject modelObject, Material changeMaterial)
        {
            List <SkinnedMeshRenderer> compoSMR = CommonRender3DRT.GetCompoSMR(modelObject);

            if (compoSMR != null)
            {
                foreach (SkinnedMeshRenderer skinnedMeshRenderer in compoSMR)
                {
                    Material[] materials = skinnedMeshRenderer.materials;
                    for (int i = 0; i < materials.Length; i++)
                    {
                        materials[i] = changeMaterial;
                    }
                    skinnedMeshRenderer.materials = materials;
                }
            }
        }
        public static List <Material[]> SetWireFrameRendering(GameObject modelObject, Material wireFrameMaterial)
        {
            List <Material[]>          list     = new List <Material[]>();
            List <SkinnedMeshRenderer> compoSMR = CommonRender3DRT.GetCompoSMR(modelObject);

            if (compoSMR != null)
            {
                foreach (SkinnedMeshRenderer skinnedMeshRenderer in compoSMR)
                {
                    list.Add(skinnedMeshRenderer.materials);
                    Material[] array = new Material[skinnedMeshRenderer.materials.Length];
                    for (int i = 0; i < array.Length; i++)
                    {
                        array[i] = wireFrameMaterial;
                    }
                    skinnedMeshRenderer.materials = array;
                    CutsceneCommon.SetSubMeshRendering(skinnedMeshRenderer, MeshTopology.Lines);
                }
            }
            return(list);
        }
    public void LoadMonsterModel(string path, Vector3 characterLocalPosition, float characterLocalEulerAngleY)
    {
        GameObject original = AssetDataMng.Instance().LoadObject(path, null, true) as GameObject;

        this.goChara      = UnityEngine.Object.Instantiate <GameObject>(original);
        this.goChara.name = path;
        this.goChara.transform.SetParent(base.gameObject.transform);
        this.goChara.transform.localPosition = characterLocalPosition;
        Quaternion localRotation = Quaternion.Euler(0f, characterLocalEulerAngleY, 0f);

        this.goChara.transform.localRotation = localRotation;
        this.rotY    = characterLocalEulerAngleY;
        this.smrList = CommonRender3DRT.GetCompoSMR(this.goChara);
        if (this.smrList != null)
        {
            this.SetSMRUpdateFlag(this.smrList);
        }
        this.cpParams = this.goChara.GetComponent <CharacterParams>();
        if (null != this.cpParams)
        {
            this.cpParams.PlayAnimation(CharacterAnimationType.idle, SkillType.Attack, 0, null, null);
        }
        this.SetBillBoardCamera();
    }