Beispiel #1
0
    public static void ResetModel(GameObject modelGo, Pathea.MovementField movementField)
    {
        modelGo.name                    = "CloneModel";
        modelGo.transform.parent        = m_Instance.transform;
        modelGo.transform.localPosition = Vector3.zero;
        modelGo.transform.localRotation = Quaternion.identity;
        modelGo.transform.localRotation = Quaternion.identity;
        modelGo.layer                   = Layer.ShowModel;

        //normal_leisure0-2 陆地
        //normalsky_leisure0-2  空中

        Animator anim = modelGo.GetComponentInChildren <Animator>();

        if (null != anim)
        {
            string searchStr = movementField == Pathea.MovementField.Sky ? "normalsky_leisure" : "normal_leisure";
            if (movementField == Pathea.MovementField.Sky)
            {
                anim.SetBool("Fly", true);
            }
            anim.SetTrigger(searchStr + "0");
            AnimatorClipInfo[] idleClip = anim.GetCurrentAnimatorClipInfo(0);
            if (null != idleClip && idleClip.Length > 0)
            {
                idleClip[0].clip.SampleAnimation(anim.gameObject, idleClip[0].clip.length * 0.5f);
            }
        }
        ClearModel(modelGo);
    }
Beispiel #2
0
    public static GameObject LoadMonsterModelByID(int modelID, ref Pathea.MovementField movementField)
    {
        Pathea.MonsterProtoDb.Item item = Pathea.MonsterProtoDb.Get(modelID);
        if (null == item)
        {
            return(null);
        }
        string modelPath = item.modelPath;

        if (string.IsNullOrEmpty(modelPath))
        {
            return(null);
        }
        GameObject monsterGo = AssetsLoader.Instance.InstantiateAssetImm(modelPath, Vector3.zero, Quaternion.identity, Vector3.one);

        monsterGo = GetOnlyModel(monsterGo);
        if (monsterGo == null)
        {
            return(null);
        }
        ResetModel(monsterGo, item.movementField);
        movementField = item.movementField;
        return(monsterGo);
    }