void InitTeachGroups() { Transform ts = transform; for (int i = 0; i < ts.childCount; ++i) { Transform child = ts.GetChild(i); TeachGroup tg = child.GetComponent <TeachGroup>(); if (!tg) { Debug.LogError("Cannot find component TeachGroup in Control:" + child.name); } string name = tg.name; if (!name.StartsWith(TEACH_GROUP_PREFIX)) { Debug.LogError(string.Format("TeachGroup name {0} format is invalid!", name)); } name = name.Substring(TEACH_GROUP_PREFIX.Length); int teach_id = int.Parse(name); if (!teachGroupList.ContainsKey(teach_id)) { teachGroupList.Add(teach_id, tg); } else { Debug.LogError(string.Format("TeachGroup {0} already exist!", name)); } } }
// 检测指定的教学组是否满足开启条件 public static bool IsTrigger(int teach_id) { TeachGroup teach_group = TeachGroupMgr.Instance.GetTeachGroup(teach_id); if (teach_group) { bool ok = false; foreach (TriggerObject to in teach_group.triggers) { string trig_params = to.triggerParams; string[] params_list = trig_params.Split('#'); ok = IsTrigger(to.triggerType, params_list); if (!ok) { return(false); } } if (ok) { return(true); } } return(false); }
public TeachStep GetTeachStep(TeachGroup tg, int teach_step_id) { if (tg == null) { return(null); } return(tg.GetTeachStep(teach_step_id)); }
// 开启新教学 public void StartTeach(int teach_id) { isTeaching = true; isFinishedGroup = false; teachingID = teach_id; teachingStepIdx = 0; curTeachGroup = TeachGroupMgr.Instance.GetTeachGroup(teachingID); curTeachStep = CreateTeachStep(teachingStepID); curTeachStep.OnStart(); interruptTeachID = teachingID; interruptTeachStepID = teachingStepID; Debug.LogError("-------------StartTeach:" + teach_id); }
public TeachStep GetTeachStep(int teach_id, int teach_step_id) { TeachGroup tg = GetTeachGroup(teach_id); return(GetTeachStep(tg, teach_step_id)); }