//增加空对象 public storyActorInfo AddEmpty() { string name = "Actor1"; int dwID = name.GetHashCode(); Entity entity = Game.Instance.GetStoryScene().CreateEmptyObject(dwID); entity.name = name; storyActorInfo objEmpty = new storyActorInfo(); objEmpty.target = entity.gameObject; objEmpty.dwModelId = 0; objEmpty.nameIndex = 1; objEmpty.name = ""; objEmpty.type = 3; objEmpty.bFolderOut = false; _storyActor.Add(objEmpty); return objEmpty; }
public void InitActor(ref storyActorInfo storyActor) { int dwModelId = storyActor.dwModelId; Actor actor = storyActor.target.GetComponent<Actor>(); if (dwModelId == 1) { actor.SetMeshPart("head", "ZJ_nan_xuanren_tou"); actor.SetMeshPart("body", "ZJ_nan_xuanren_yi"); actor.SetMeshPart("weapon", "ZJ_nan_xuanren_wu"); storyActor.type = 1; actor.GetAnimator().cullingMode = AnimatorCullingMode.AlwaysAnimate; } else if (dwModelId == 2) { actor.SetMeshPart("head", "ZJ_Nv_tou"); actor.SetMeshPart("body", "ZJ_Nv_yi"); actor.SetMeshPart("weapon", "ZJ_Nv_wuqi"); storyActor.type = 1; actor.GetAnimator().cullingMode = AnimatorCullingMode.AlwaysAnimate; } else if (dwModelId == 3) { actor.SetMeshPart("head", "T_01"); actor.SetMeshPart("body", "Y_01"); storyActor.type = 1; actor.GetAnimator().cullingMode = AnimatorCullingMode.AlwaysAnimate; } }
public void DeleteActor(storyActorInfo actor) { if (!_storyActor.Contains(actor)) { Debug.LogWarning("can't find actor in _storyActor list.."); return; } GameObject.Destroy(actor.target); _storyActor.Remove(actor); }
//增加角色对象 public void AddActor(int dwModelID,int nameIndex, string gameName = "") { string actorName = "Actor" + nameIndex; int dwID = actorName.GetHashCode(); ResManager.UseActorConfig("story"); Actor objActor = Game.Instance.GetStoryScene().CreateActor(dwModelID, dwID); ResManager.UseActorConfig("default"); if (objActor == null) { return; } storyActorInfo clsActor = new storyActorInfo(); clsActor.target = objActor.gameObject; clsActor.dwModelId = dwModelID; clsActor.nameIndex = nameIndex; clsActor.name = gameName; clsActor.type = 0; clsActor.bFolderOut = false; InitActor(ref clsActor); objActor.name = actorName; _storyActor.Add(clsActor); }