/// <summary> /// 执行功能模块事件 /// </summary> public void DoFunBlock(FunBlock block) { BlockObj obj = FindFunBlockObj(block); if (obj == null) { return; } obj.OnClick(); }
/// <summary> /// 查找功能节点 /// </summary> private BlockObj FindFunBlockObj(FunBlock block) { List <SceneObj> l = GetAllSceneObj(); foreach (SceneObj s in l) { if (CheckFunBlock(s, block) == true) { return(s as BlockObj); } } return(null); }
/// <summary> /// 确认是否为该功能模块 /// </summary> private bool CheckFunBlock(SceneObj obj, FunBlock block) { if (obj == null || block == FunBlock.None) { return(false); } if (block == FunBlock.Boat && obj is BoatObj) { return(true); } if (block == FunBlock.Stage && obj is StageObj) { return(true); } return(false); }