public static void begin(Function method) { s_FunctionCache = method; switch (method) { case Function.Value1D: s_F1DCache = value1D; break; case Function.Perlin1D: s_F1DCache = perlin1D; break; case Function.Value2D: s_F2DCache = value2D; break; case Function.Perlin2D: s_F2DCache = perlin2D; break; case Function.Value3D: s_F3DCache = value3D; break; case Function.Perlin3D: s_F3DCache = perlin3D; break; default: break; } }
protected override void preInit() { handler = this.GetComponent <Text>(); if (m_Getter == null) { m_Getter = () => handler.text; } }
public static void randomSort <T>(this List <T> list, TezEventExtension.Function <int, int> insert_position) { List <T> sorter = new List <T>(list); list.Clear(); foreach (var item in sorter) { list.Insert(insert_position(list.Count), item); } }
public TezRandomIndex(int count, TezEventExtension.Function <int, int, int> randomGenerator) { m_Data = new int[count]; for (int i = 0; i < m_Data.Length; i++) { m_Data[i] = i; } m_Size = m_Data.Length; m_Generator = randomGenerator; }
/// <summary> /// 关闭此Pool /// 此Pool将永远无法再次使用 /// </summary> public void close() { this.destroyObjects(); m_Pool = null; m_CloseFunction = null; m_ClearFunction = null; m_CreateFunction = null; m_Instance = null; }
public static void end(Function method) { if (s_FunctionCache != method) { throw new Exception(string.Format("TezNoise End ERROR!![Current:{0}][You Want:{1}]", s_FunctionCache.ToString(), method.ToString())); } s_FunctionCache = Function.Error; s_F1DCache = null; s_F2DCache = null; s_F3DCache = null; }
public void foreachBlock(TezEventExtension.Function <bool, Block> function) { foreach (var block in m_BlockArray) { if (block != null) { if (function(block)) { return; } } } }
/// <summary> /// 随机打乱数组 /// </summary> public static void shuffle <T>(this List <T> list, TezEventExtension.Function <int, int> random) { var count = list.Count; while (count > 1) { count--; var index = random(count + 1); var value = list[index]; list[index] = list[count]; list[count] = value; } }
/// <summary> /// 替换SecondaryPath中的某个Token /// </summary> public bool replaceSecondaryPathToken(ITezAttributeToken new_token, TezEventExtension.Function <bool, ITezAttributeToken> finder) { for (int i = 0; i < m_SecondaryPath.Length; i++) { if (finder(m_SecondaryPath[i])) { m_SecondaryPath[i] = new_token; return(true); } } return(false); }
public static T randomGet <T>(this List <T> list, TezEventExtension.Function <int, int> insert_position) { var index = insert_position(list.Count); var result = list[index]; var last = list.Count - 1; if (index != last) { list[index] = list[last]; } list.RemoveAt(last); return(result); }
public void setupRealistic(float I0, float k, float a, float RBulge, float min, float max, int nSteps) { m_fMin = min; m_fMax = max; m_nSteps = nSteps; m_I0 = I0; m_k = k; m_a = a; m_RBulge = RBulge; m_pDistFun = Intensity; // build the distribution function BuildCDF(m_nSteps); }
public void foreachChunk(TezEventExtension.Function <bool, Chunk> function) { var x_length = m_ChunkArray.GetLength(0); var y_length = m_ChunkArray.GetLength(1); for (int y = 0; y < y_length; y++) { for (int x = 0; x < x_length; x++) { if (function(m_ChunkArray[x, y])) { return; } } } }
public void spectrum_to_xyz(TezEventExtension.Function <float, float> spec_intens, out float x, out float y, out float z) { int i; float lambda, X = 0, Y = 0, Z = 0, XYZ = 0; for (i = 0, lambda = 380; lambda < 780.1f; i++, lambda += 5) { float Me; Me = spec_intens(lambda); X += Me * cie_colour_match[i, 0]; Y += Me * cie_colour_match[i, 1]; Z += Me * cie_colour_match[i, 2]; } XYZ = (X + Y + Z); x = X / XYZ; y = Y / XYZ; z = Z / XYZ; }
public int createFilter(string filterName, TezEventExtension.Function <bool, TezComData> function) { var result = m_Filters.Find((BaseFilter filter) => { return(filter.name == filterName); }); if (result == null) { result = new Filter_Custom(m_Filters.Count) { name = filterName, manager = this }; result.setFunction(function); m_Filters.Add(result); return(result.index); } return(-1); }
protected override void onClose(bool self_close) { m_Getter = null; handler = null; m_Node = null; }
public void setGetter(TezEventExtension.Function <string> getter) { m_Getter = getter; this.refreshMask = true; }
public override void close() { base.close(); m_Function = null; }
public static void generate(ITezCategoryRootToken rootToken, ITezCategoryFinalToken finalToken, out TezCategory category, TezEventExtension.Function <TezCategory> onGenerate) { if (!m_SlotDic.TryGetValue(rootToken.toName, out Slot slot)) { slot = new Slot(); while (rootToken.toID >= m_SlotList.Count) { m_SlotList.Add(null); } m_SlotList[rootToken.toID] = slot; m_SlotDic.Add(rootToken.toName, slot); } slot.generate(finalToken, out category, onGenerate); }
public abstract void setFunction(TezEventExtension.Function <bool, TezComData> function);
public void setGetFunction(TezEventExtension.Function <string> function) { m_Label.setGetter(function); }
public void generate(ITezCategoryFinalToken finalToken, out TezCategory category, TezEventExtension.Function <TezCategory> onGenerate) { if (!m_Dic.TryGetValue(finalToken.toName, out category)) { category = onGenerate(); m_Dic.Add(finalToken.toName, category); while (finalToken.toID >= m_List.Count) { m_List.Add(null); } m_List[finalToken.toID] = category; } }
public ReturnSwitcher <R> register(T type, TezEventExtension.Function <R> call_back) { m_CallBack[type.ID] = call_back; return(this); }
public static void add(Type type, TezEventExtension.Function <List <TezType> > function) { Registers.Add(type, function); }
public override void setFunction(TezEventExtension.Function <bool, TezComData> function) { }
public TezRandomIndex(int[] sequence, TezEventExtension.Function <int, int, int> randomGenerator) { m_Data = sequence; m_Size = m_Data.Length; m_Generator = randomGenerator; }
public void close() { m_Data = null; m_Generator = null; }