コード例 #1
0
        public static FunctionUpdater CreateMouseDraggingAction(int mouseButton, Action <Vector3> onMouseDragging)
        {
            bool dragging = false;

            return(FunctionUpdater.Create(() => {
                if (Input.GetMouseButtonDown(mouseButton))
                {
                    dragging = true;
                }
                if (Input.GetMouseButtonUp(mouseButton))
                {
                    dragging = false;
                }
                if (dragging)
                {
                    onMouseDragging(UtilsClass.GetMouseWorldPosition());
                }
                return false;
            }));
        }
コード例 #2
0
        // Create a Text Popup in the World
        public static void CreateWorldTextPopup(Transform parent, string text, Vector3 localPosition, int fontSize, Color color, Vector3 finalPopupPosition, float popupTime)
        {
            TextMesh  textMesh   = CreateWorldText(parent, text, localPosition, fontSize, color, TextAnchor.LowerLeft, TextAlignment.Left, sortingOrderDefault);
            Transform transform  = textMesh.transform;
            Vector3   moveAmount = (finalPopupPosition - localPosition) / popupTime;

            FunctionUpdater.Create(delegate() {
                transform.position += moveAmount * Time.deltaTime;
                popupTime          -= Time.deltaTime;
                if (popupTime <= 0f)
                {
                    UnityEngine.Object.Destroy(transform.gameObject);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }, "WorldTextPopup");
        }
コード例 #3
0
 private static void RemoveUpdater(FunctionUpdater funcUpdater)
 {
     InitIfNeeded();
     updaterList.Remove(funcUpdater);
 }
コード例 #4
0
ファイル: World_Sprite.cs プロジェクト: ArtiX-GP/LoginBus
 public void SetPosition(Func <Vector3> getLocalPosition)
 {
     FunctionUpdater.Create(() => {
         transform.localPosition = getLocalPosition();
     });
 }