void Awake() { collider = GetComponent <Collider2D>(); componentMove = new ComponentMove(); spritesInHierarchy = GetComponentsInChildren <SpriteRenderer>(); originalColors = new Color[spritesInHierarchy.Length]; for (int i = 0; i < spritesInHierarchy.Length; ++i) { originalColors[i] = spritesInHierarchy[i].color; } }
protected void doneCallback(MoveCallback curDoneCallback, object curDoneUserData, ComponentMove component) { // 先保存回调,然后再调用回调之前就清空回调,确保在回调函数执行时已经完全完成 MoveCallback tempCallback = curDoneCallback; object tempUserData = curDoneUserData; clearCallback(); if (tempCallback != null) { tempCallback(component, tempUserData, false, true); } }
protected static void setCallback(MoveCallback callback, object userData, ref MoveCallback curCallback, ref object curUserData, ComponentMove component) { MoveCallback tempCallback = curCallback; object tempUserData = curUserData; curCallback = null; curUserData = null; // 如果回调函数当前不为空,则是中断了正在进行的变化 if (tempCallback != null) { tempCallback(component, tempUserData, true, false); } curCallback = callback; curUserData = userData; }
public static bool TryGetComponentMove(this int entity, out ComponentMove component) { component = Storage <ComponentMove> .Instance.TryGet(entity); return(component != null); }
public static void SetCacheEnable(this ComponentMove component, in ent entity)