private StoryInstanceInfo NewStoryInstance(int storyId) { //去剧情缓冲池里面找实例 StoryInstanceInfo instInfo = GetUnusedStoryInstanceInfoFromPool(storyId); if (instInfo == null) { //这里应该是现在角色所在的场景id DataSceneConfig cfg = GameData <DataSceneConfig> .dataMap[storyId]; if (cfg != null) { string[] filePath = new string[1] { cfg.StoryDSLFile }; for (int i = 0; i < 1; i++) { filePath[i] = Application.dataPath + "/Resources/" + cfg.StoryDSLFile; } StoryConfigManager.Instance.LoadStoryIfNotExist(storyId, 0, filePath); StoryInstance inst = StoryConfigManager.Instance.NewStoryInstance(storyId, 0); if (inst == null) { Debug.LogError("不能加载剧情:" + storyId); return(null); } StoryInstanceInfo info = new StoryInstanceInfo(); info.m_iStoryId = storyId; info.m_oInstance = inst; info.m_bIsUsed = true; AddStoryInstanceInfoToPool(storyId, info); return(info); } else { Debug.LogError("不能找到剧情" + storyId + "配置文件"); return(null); } } else { instInfo.m_bIsUsed = true; return(instInfo); } }
public virtual void UpdatePosition() { Vector3 point = Vector3.zero; if (Transform) { if (UnityTools.GetPointInTerrain(Position.x, Position.z, out point)) { Transform.position = new Vector3(point.x, point.y + 0.3f, point.z); if (Rotation != Vector3.zero) { Transform.eulerAngles = new Vector3(0, Rotation.y, 0); } } } else { var myself = this as EntityMyself; if (myself != null) { DataSceneConfig config = GameData <DataSceneConfig> .dataMap[myself.SceneId]; Vector3 bornPoint; if (UnityTools.GetPointInTerrain(config.EnterX, config.EnterZ, out bornPoint)) { Transform.position = new Vector3(bornPoint.x, bornPoint.y + 0.5f, bornPoint.z); } else { Transform.position = bornPoint; } } else { Transform.position = new Vector3(point.x, point.y + 1f, point.z); } } }