Inheritance: MonoBehaviour
Esempio n. 1
0
    /// <summary>
    /// Calculates the rotation axis and torque for a rigid body based on the current touch position and the last touch position.
    /// </summary>
    /// <returns>
    /// True if rotation axis and torque were successfully calculated
    /// </returns>
    /// <param name='id'>
    /// Touch id.
    /// </param>
    /// <param name='torqueScalar'>
    /// Scalar value applied to torque calculation.
    /// </param>
    /// <param name='axis'>
    /// Sets rotation axis.
    /// </param>
    /// <param name='torque'>
    /// Sets torque.
    /// </param>
    public static bool RotationAxisTorque(int id, float torqueScalar, out Vector3 axis, out float torque)
    {
        bool success = false;

        axis = Vector3.zero;

        torque = 0;

        Vector2 curPos, deltPos, lastPos;

        if (TouchManager.GetTouchPos(id, out curPos))
        {
            Ray curRay = Camera.mainCamera.ScreenPointToRay(curPos);

            TouchManager.GetTouchDeltaPos(id, out deltPos);

            lastPos = curPos - deltPos;

            Ray prevRay = Camera.mainCamera.ScreenPointToRay(lastPos);

            axis = Vector3.Cross(curRay.direction, prevRay.direction);

            torque = (lastPos - curPos).magnitude * torqueScalar;

            success = true;
        }

        return(success);
    }
Esempio n. 2
0
    /**
     * 更新
     *
     * @access private
     */
    void Update()
    {
        // タッチ状態更新
        this._touch_manager.update();

        // タッチ取得
        TouchManager touch_state = this._touch_manager.getTouch();

        // タッチされていたら処理
        if (touch_state._touch_flag)
        {
            // 座標系変換
            Vector2 world_point = Camera.main.ScreenToWorldPoint(touch_state._touch_position);

            // 離した瞬間 か 押しっぱなし
            if (touch_state._touch_phase == TouchPhase.Ended)
            {
                Debug.Log("world_point x= " + world_point.x + " world_point y=" + world_point.y);
                RaycastHit2D hit = Physics2D.Raycast(world_point, Vector2.zero);
                // チップ切り替え
                if (hit)
                {
                    Debug.Log("オブジェクトにタッチしたよ");
                    // タッチ時の処理を行う
                    hit.collider.GetComponent <Chip>().touch();
                }
                else
                {
                    Debug.Log("そこにオブジェクトは無いよ");
                }
            }
        }
    }
    void FixedUpdate()
    {
        if (!activating)
        {
            return;
        }

        GameObject touchingTile = TouchManager.GetTouchingTile();

        if (touchingTile == null)
        {
            return;
        }

        TileBehaviour tileBehaviour = touchingTile.GetComponent <TileBehaviour>();

        if (!tileBehaviour.isMerged)
        {
            if (firstTile == null)
            {
                firstTile = touchingTile;
                tileBehaviour.isLinked           = true;
                firstTileBorderColor             = tileBehaviour.glowingBorderColor;
                tileBehaviour.glowingBorderColor = selectedTileBorderColor;
            }
            else if (secondTile == null && touchingTile != firstTile)
            {
                secondTile = touchingTile;
                secondTile.GetComponent <TileBehaviour>().isLinked = true;
                secondTileBorderColor            = tileBehaviour.glowingBorderColor;
                tileBehaviour.glowingBorderColor = selectedTileBorderColor;
                StartCoroutine(Exchange());
            }
        }
    }
Esempio n. 4
0
    /// <summary>
    /// Checks to see if a collider was touched
    /// </summary>
    /// <returns>
    /// True if the collider was touched.
    /// </returns>
    /// <param name='id'>
    /// Touch id.
    /// </param>
    /// <param name='collider'>
    /// Collider to check for touch.
    /// </param>
    /// <param name='distance'>
    /// Distance away from the touch screen location to check for collider intersection
    /// </param>
    /// <param name='screenPos'>
    /// Set with the screen position of the touch.
    /// </param>
    /// <param name='worldPos'>
    /// Set with the world position of the touch
    /// </param>
    public static bool TouchedCollider(int id, Collider collider, float distance, out Vector2 pos, out Vector3 worldPos)
    {
        bool touchedCollider = false;

        worldPos = Vector3.zero;

        if (TouchManager.GetTouchPos(id, out pos))
        {
            Ray ray = Camera.mainCamera.ScreenPointToRay(pos);

            RaycastHit hit;

            if (Physics.Raycast(ray, out hit, distance))
            {
                if (hit.collider == collider)
                {
                    worldPos = hit.point;

                    touchedCollider = true;
                }
            }
        }

        return(touchedCollider);
    }
Esempio n. 5
0
 void Start()
 {
     _wallet          = Wallet.Instance;
     _touchManager    = TouchManager.Instance;
     _exchangeManager = ExchangeManager.Instance;
     _exchangeRate    = ExchangeRate.Instance;
 }
Esempio n. 6
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Tab))
        {
            GetNewTarget();
            Debug.LogFormat("generated new state:\n{0}", state);
        }

        if (SceneManager.GetActiveScene().buildIndex == (int)SceneBuildIndex.Game)
        {
            timeToNextShape -= Time.deltaTime;
            totalTime       += Time.deltaTime;
            if (timeToNextShape <= 0f)
            {
                if (!IsMatch())
                {
                    LoseGame();
                }

                timeToNextShape += timeBetweenShapes;
            }

            TouchManager.Update();
            UpdateTimeText();
        }
    }
Esempio n. 7
0
 // Start is called before the first frame update
 void Start()
 {
     _touchManager               = TouchManager.Get();
     _touchManager.onDragBegin  += BeginDrag;
     _touchManager.onDragEnd    += EndDrag;
     _touchManager.onDragUpdate += OnDrag;
 }
        private void OnEnable()
        {
            instance                = target as TouchManager;
            layers                  = serializedObject.FindProperty("layers");
            displayDevice           = serializedObject.FindProperty("displayDevice");
            shouldCreateCameraLayer = serializedObject.FindProperty("shouldCreateCameraLayer");
            useSendMessage          = serializedObject.FindProperty("useSendMessage");
            sendMessageTarget       = serializedObject.FindProperty("sendMessageTarget");
            sendMessageEvents       = serializedObject.FindProperty("sendMessageEvents");

            refresh();

            layersList = new ReorderableList(serializedObject, layers, true, true, false, false);
            layersList.drawHeaderCallback  += rect => GUI.Label(rect, LAYERS_HEADER);
            layersList.drawElementCallback += (rect, index, active, focused) =>
            {
                rect.height = 16;
                rect.y     += 2;
                if (index >= layers.arraySize)
                {
                    return;
                }
                var layer = layers.GetArrayElementAtIndex(index).objectReferenceValue as TouchLayer;
                if (layer == null)
                {
                    EditorGUI.LabelField(rect, "null");
                    return;
                }
                EditorGUI.LabelField(rect, layer.Name);
            };
        }
        void OnEnable()
        {
            touchManager = target as TouchManager;

            var path = AssetDatabase.GetAssetPath( MonoScript.FromScriptableObject( this ) );
            headerTexture = AssetDatabase.LoadAssetAtPath<Texture>( Path.GetDirectoryName( path ) + "/Images/TouchManagerHeader.png" );
        }
Esempio n. 10
0
 private void OnMouseEnter()
 {
     if (TouchManager.GetInstance().doDetect&& GetComponent <CardAttr>().inHand)
     {
         TouchManager.GetInstance().OnFocus(transform);
     }
 }
Esempio n. 11
0
    public void Swipe(TouchManager.Direction SwipeDirection)
    {
        if (Immobilized) return;

        HandleGo(SwipeDirection);
        HandleCharge(SwipeDirection);
    }
Esempio n. 12
0
	void Awake(){
		spriteRenderer = GetComponent<SpriteRenderer> ();
		points = 0;
		actualPlayer = -1;
		conquered = false;
		touchManager = GameObject.Find ("GameManager/TouchManager").GetComponent<TouchManager> ();
	}
        private void OnEnable()
        {
            instance = target as TouchManager;
            layers = serializedObject.FindProperty("layers");
            displayDevice = serializedObject.FindProperty("displayDevice");
            useSendMessage = serializedObject.FindProperty("useSendMessage");
            sendMessageTarget = serializedObject.FindProperty("sendMessageTarget");
            sendMessageEvents = serializedObject.FindProperty("sendMessageEvents");

            refresh();

            layersList = new ReorderableList(serializedObject, layers, true, true, false, false);
            layersList.drawHeaderCallback += rect => GUI.Label(rect, LAYERS_HEADER);
            layersList.drawElementCallback += (rect, index, active, focused) =>
            {
                rect.height = 16;
                rect.y += 2;
                if (index >= layers.arraySize) return;
                var layer = layers.GetArrayElementAtIndex(index).objectReferenceValue as TouchLayer;
                if (layer == null)
                {
                    EditorGUI.LabelField(rect, "null");
                    return;
                }
                EditorGUI.LabelField(rect, layer.Name);
            };
        }
Esempio n. 14
0
 /// <summary>
 /// Unity OnDestroy callback.
 /// </summary>
 protected virtual void OnDestroy()
 {
     if (Application.isPlaying)
     {
         TouchManager.RemoveLayer(this);
     }
 }
        void Manipulate()
        {
            TouchManipulationInfo[] infos = new TouchManipulationInfo[touchDictionary.Count];
            touchDictionary.Values.CopyTo(infos, 0);
            SKMatrix touchMatrix = SKMatrix.MakeIdentity();

            if (infos.Length == 1)
            {
                SKPoint prevPoint  = infos[0].PreviousPoint;
                SKPoint newPoint   = infos[0].NewPoint;
                SKPoint pivotPoint = Matrix.MapPoint(bitmap.Width / 2, bitmap.Height / 2);

                touchMatrix = TouchManager.OneFingerManipulate(prevPoint, newPoint, pivotPoint);
            }
            else if (infos.Length >= 2)
            {
                int     pivotIndex = infos[0].NewPoint == infos[0].PreviousPoint ? 0 : 1;
                SKPoint pivotPoint = infos[pivotIndex].NewPoint;
                SKPoint newPoint   = infos[1 - pivotIndex].NewPoint;
                SKPoint prevPoint  = infos[1 - pivotIndex].PreviousPoint;

                touchMatrix = TouchManager.TwoFingerManipulate(prevPoint, newPoint, pivotPoint);
            }

            SKMatrix matrix = Matrix;

            SKMatrix.PostConcat(ref matrix, touchMatrix);
            Matrix = matrix;
        }
Esempio n. 16
0
 private void Awake()
 {
     if (!s_rInstance)
     {
         s_rInstance = this;
     }
 }
Esempio n. 17
0
    public LAppView(LAppModel model, Transform tr)
    {
        this.model = model;
        transform  = tr;


        deviceToScreen = new L2DMatrix44();


        viewMatrix = new L2DViewMatrix();


        viewMatrix.setMaxScale(LAppDefine.VIEW_MAX_SCALE);
        viewMatrix.setMinScale(LAppDefine.VIEW_MIN_SCALE);

        viewMatrix.setMaxScreenRect(
            LAppDefine.VIEW_LOGICAL_MAX_LEFT,
            LAppDefine.VIEW_LOGICAL_MAX_RIGHT,
            LAppDefine.VIEW_LOGICAL_MAX_BOTTOM,
            LAppDefine.VIEW_LOGICAL_MAX_TOP
            );


        touchMgr = new TouchManager();

        dragMgr = new L2DTargetPoint();

        Bounds bounds = model.getBounds();

        localP_LT = new Vector3(-(bounds.size.x / 2), 0, (bounds.size.z / 2));
        localP_RT = new Vector3((bounds.size.x / 2), 0, (bounds.size.z / 2));
        localP_LB = new Vector3(-(bounds.size.x / 2), 0, -(bounds.size.z / 2));
    }
        public override void Render(TimeSpan elapsedGameTime)
        {
            MainLayer.Begin();
            MainLayer.Save();

            MainLayer.DrawRectangle(new Color(252, 252, 252), 0, 0, MainLayer.Layout.Width, MainLayer.Layout.Height);

            GameService.ClassicGameState.Board.Render(elapsedGameTime, MainLayer);


            MainLayer.Save();
            MainLayer.DrawImage(Assets.Images.Layouts.StagingArea, 0, BoardConstants.TopAreaHeight);
            if (State.Congrats && !GameService.ClassicGameState.Board.IsMoving)
            {
                drawBottomChoosePlayers();
            }
            else
            {
                drawBottomInfo();
            }
            MainLayer.Restore();

            if (State.Congrats && !GameService.ClassicGameState.Board.IsMoving)
            {
                MainLayer.DrawImage(Assets.Images.Character.LabelBox.CharacterBox[State.CurrentChosenNumber.Character.CharacterNumber + 1], Positions.CongratsPosition, true);
                MainLayer.DrawString((Assets.Fonts.BabyDoll._130), string.Format("Congrats\nPlayer {0}!", (State.CurrentChosenNumber.Character.CharacterNumber + 1)), Positions.CongratsPosition);
            }
            MainLayer.Restore();

            TouchManager.Render(MainLayer);
            MainLayer.End();
        }
Esempio n. 19
0
    /// <summary>
    /// 何とも当たっていないかどうかを判断する
    /// </summary>
    /// <returns>当たっている...true 当たっている...false</returns>
    private bool IsTouchingNothing()
    {
        var objects = GameObject.FindObjectsOfType <GameObject>();

        foreach (var obj in objects)
        {
            if (TouchManager.IsMouseButton(obj))
            {
                return(false);
            }
            if (TouchManager.IsTouching(obj))
            {
                return(false);
            }
        }

        if (IsBabbleInside(Input.mousePosition))
        {
            return(false);
        }

        foreach (var touch in Input.touches)
        {
            if (IsBabbleInside(touch.position))
            {
                return(false);
            }
        }

        return(true);
    }
Esempio n. 20
0
    /// <summary>
    /// RayCastでターゲットを探す
    /// </summary>
    void FindTarget(PointerEventData pe)
    {
        Vector2 touch = (Vector2)TouchManager.WorldPosition(pe.position);

        RaycastHit2D[] hit = Physics2D.CircleCastAll(touch, _radius, Vector2.zero);
        foreach (var h in hit)
        {
            if (h.collider != null)
            {
                ITargetable target = h.collider.transform.root.GetInterface <ITargetable>();
                if (target != null)
                {
//                        Debug.Log("HitTarget");
                    if (_target == null)
                    {
                        _target = h.collider.transform.root.gameObject;
                        continue;
                    }
                    if (Dist(_target, _player) > Dist(h.collider.gameObject, _player))
                    {
                        _target = h.collider.transform.root.gameObject;
                    }
                }
            }
        }
        if (hit.Length == 0)
        {
            _target = null;
        }
    }
Esempio n. 21
0
        /// <inheritdoc />
        protected override void touchEnded(TouchPoint touch)
        {
            base.touchEnded(touch);

            if (NumTouches == 0)
            {
                if (!isActive)
                {
                    setState(GestureState.Failed);
                    return;
                }

                // touches outside of gesture target are ignored in shouldCacheTouchPosition()
                // if all touches are outside ScreenPosition will be invalid
                if (TouchManager.IsInvalidPosition(ScreenPosition))
                {
                    setState(GestureState.Failed);
                }
                else
                {
                    tapsDone++;
                    isActive = false;
                    if (tapsDone >= numberOfTapsRequired)
                    {
                        setState(GestureState.Recognized);
                    }
                }
            }
        }
Esempio n. 22
0
 void Update()
 {
     for (int i = 0; i < TouchManager.TouchCount(); ++i)
     {
         if (TouchManager.GetTouch(i).phase.Equals(TouchPhase.Began))
         {
             //Construct a ray from the current touch coordinates
             RaycastHit hit;
             Ray        ray = Camera.main.ScreenPointToRay(TouchManager.GetTouch(i).position);
             if (Physics.Raycast(ray, out hit))
             {
                 //Destroy the first game object hit by ray
                 if (hit.collider.gameObject.tag == "Password")
                 {
                     hitPosition     = hit.point;
                     currentPosition = hitPosition;
                     passwordText.SetActive(true);
                     Scoreboard.currentScore += 5;
                     hit.collider.gameObject.SetActive(false);
                     TransitionToNewScene.LoadScene("Secure The Server");
                 }
             }
         }
     }
 }
Esempio n. 23
0
    public void touchUp(TouchManager.TouchUpEvent touchEvent)
    {
        if (touchEvent.startTarget != transform) return;
        Transform inputTarget = target ? target : transform.root;

        inputTarget.SendMessage("touchUp", touchEvent, SendMessageOptions.DontRequireReceiver);
    }
Esempio n. 24
0
    void UpdatePerFinger()
    {
        for (int i = 0; i < TouchManager.Instance.MaxFingers && i < MaxSimultaneousGestures; ++i)
        {
            TouchManager.Finger finger = TouchManager.GetFinger(i);
            T gesture = gestures[i];
            TouchManager.FingerList touches = tempTouchList;
            touches.Clear();

            if (finger.IsDown)
            {
                touches.Add(finger);
            }
            if (gesture.State == GestureRecognitionState.Ready)
            {
                if (CanBegin(gesture, touches))
                {
                    Begin(gesture, 0, touches);
                }
            }
            UpdateGesture(gesture, touches);
            if ("OnEasyGesture" == gesture.Recognizer.EventMessageName)
            {
                if (touches.Count <= 0)
                {
                    Reset(gesture, false);
                }
            }
        }
    }
Esempio n. 25
0
 // Update is called once per frame
 void Update()
 {
     if (TouchManager.IsTouchObject(_obj))
     {
         // タッチされた時の処理
     }
 }
Esempio n. 26
0
    // Update is called once per frame
    void Update()
    {
        if (isActive)
        {
            switch (state)
            {
            case DrawState.HIDE:
                if (TouchManager.IsSwipingLeft() || TouchManager.IsSwipingRight())
                {
                    DrawCard();
                }
                break;

            case DrawState.REVEAL:
                if (TouchManager.IsTapping() || TouchManager.IsSwipingLeft() || TouchManager.IsSwipingRight())
                {
                    NextCard();
                }
                break;

            case DrawState.GAMEOVER:

                if (TouchManager.IsTapping())
                {
                    ShowGameover();
                    isActive = false;
                }
                break;
            }
        }
    }
        public void InitCardTouches()
        {
            Goal[] goals = GameService.ClassicGameState.UnusedGoals;
            for (int index = goals.Length - 1; index >= 0; index--)
            {
                Goal goal = goals[index];

                int topRow = goals.Length / 2;
                int bottomRow = goals.Length / 2 + goals.Length % 2;
                int posx, posy;


                if (index < topRow)
                {
                    int centerOffset = (Positions.BottomCardAreaWidth / (topRow)) / 2;
                    posx = Positions.BottomCardAreaWidth / topRow * (index) + centerOffset;
                    posy = Positions.BottomCardSize / 2 - Positions.CardShadowHeight;
                }
                else
                {
                    int centerOffset = (Positions.BottomCardAreaWidth / (bottomRow)) / 2;
                    posx = Positions.BottomCardAreaWidth / bottomRow * (index - topRow) + centerOffset;
                    posy = Positions.BottomCardSize - 40 + Positions.BottomCardSize / 2 - Positions.CardShadowHeight;
                }


                posy += BoardConstants.TopAreaHeight;

                TouchManager.PushClickRect(new TouchRect(posx, posy, Positions.BottomCardSize, Positions.BottomCardSize, tapCard, state: goal, pointIsCenter: true));
            }
        }
Esempio n. 28
0
    private void Start()
    {
        TouchManager.AddDirectionListener(this);

        _sprite = GetComponent <SpriteRenderer>();
        _rb     = GetComponent <Rigidbody2D>();
    }
Esempio n. 29
0
    // 按下时 触发此方法
    void PressIsTrue()
    {
        // UICamera.lastTouchPosition 为当前鼠标按下时的坐标(Vector2类型)
        if (bigCircleStartWorldPos == Vector2.zero)
        {
            bigCircleStartWorldPos = Camera.main.WorldToScreenPoint(bigCircleTrans.position);
        }
        Vector2 touchPos = TouchManager.GetTouchPosition(touchDirType) - bigCircleStartWorldPos;

        // 当鼠标拖动的位置与中心位置大于bigCircleRadius时,则固定按钮位置不会超过bigCircleRadius。  bigCircleRadius为背景图片半径长度
        if (Vector2.Distance(touchPos, Vector2.zero) > bigCircleRadius)
        {
            // 按钮位置为 鼠标方向单位向量 * bigCircleRadius
            smallCircleTrans.localPosition = touchPos.normalized * bigCircleRadius;
        }
        else
        {
            // 按钮位置为鼠标位置
            smallCircleTrans.localPosition = touchPos;
        }

        // 按钮位置x轴 / 半径 的值为0-1的横向偏移量
        h = smallCircleTrans.localPosition.x / bigCircleRadius;

        // 按钮位置y轴 / 半径 的值为0-1的纵向偏移量
        v = smallCircleTrans.localPosition.y / bigCircleRadius;
    }
Esempio n. 30
0
        /// <summary>
        /// Unity3d Start handler.
        /// </summary>
        /// <exception cref="System.InvalidOperationException">TouchManager instance is required!</exception>
        protected virtual void Start()
        {
            touchManager   = TouchManager.Instance;
            gestureManager = GestureManager.Instance;

            Reset();
        }
Esempio n. 31
0
 protected virtual void OnDisable()
 {
     if (TouchManager.Instance)
     {
         TouchManager.Unregister(this);
     }
 }
Esempio n. 32
0
 protected virtual void OnEnable()
 {
     if (TouchManager.Instance)
     {
         TouchManager.Register(this);
     }
 }
        public void Init()
        {
            TouchManager.ClearClickRect();
            TouchManager.ClearSwipeRect();

            for (int x = 0; x < BoardConstants.SquareWidth; x++)
            {
                for (int y = 0; y < BoardConstants.SquareHeight; y++)
                {
                    int x1        = x;
                    int y1        = y;
                    var touchRect = new TouchRect(x * BoardConstants.SquareSize + BoardConstants.SideOffset, y * BoardConstants.SquareSize + BoardConstants.TopOffset, BoardConstants.SquareSize, BoardConstants.SquareSize,
                                                  (type, box, touchX, touchY, collide) => squareTouch(x1, y1, type, box, touchX, touchY, collide));

                    Layout.LayoutView.TouchManager.PushClickRect(touchRect);
                }
            }
            Layout.LayoutView.TouchManager.PushSwipeRect(new TouchRect(0, 0, BoardConstants.TotalWidth, BoardConstants.TopAreaHeight, swipeMotion));


            Layout.LayoutView.TouchManager.PushClickRect(new TouchRect(Positions.UndoButtonRect, undoPress));
            Layout.LayoutView.TouchManager.PushClickRect(new TouchRect(Positions.PassButtonRect, passPress));

            Layout.LayoutView.TouchManager.PushClickRect(new TouchRect(0, 0, Layout.Width, Layout.Height, wholeBoardClick));

            startTurn(GameService.ClassicGameState.ChosenNumbers[GameService.ClassicGameState.ChosenNumbers.Count - 1]);
            foreach (var animatedCharacterSubLayout in CharacterAnimations)
            {
                animatedCharacterSubLayout.Value.InitLayoutView(TouchManager);
            }
        }
Esempio n. 34
0
    /// <summary>
    /// Method to parse and send an RPC event from smart device such as recieving touch input
    /// </summary>
    /// <param name="connectionID">The id of the device that connected</param>
    /// <param name="recBuffer">The data that was recieved from the smart device</param>
    private void HandleRPC(int connectionID, byte[] recBuffer)
    {
        Stream          stream    = new MemoryStream(recBuffer);
        BinaryFormatter formatter = new BinaryFormatter();
        RPCSerializer   rpcData   = (RPCSerializer)formatter.Deserialize(stream);

        int        playerID = -1;
        NaviDevice dev      = null;

        for (int i = 0; i < playerConnectionIds.Count; i++)
        {
            if (playerConnectionIds[i].connectionID == connectionID)
            {
                playerID = i;
                dev      = playerConnectionIds[i];
                break;
            }
        }

        if (rpcData.methodName.Equals(TOUCH_METHOD_ID))
        {
            TouchSerializer ts = (TouchSerializer)rpcData.args [0];
            TouchManager.ProcessTouch(playerID, ts);
        }
        else if (rpcData.methodName.Equals(SET_SIZE_METHOD_ID))
        {
            dev.SetServerScreenSize((int)rpcData.args[0], (int)rpcData.args[1]);
        }
    }
Esempio n. 35
0
 // Use this for initialization
 void Start()
 {
     _player = _player = GameObject.FindWithTag("Player");
     TouchManager.AddListener(EventTriggerType.PointerDown, FindTarget);
     TouchManager.AddListener(EventTriggerType.Drag, FindTarget);
     TouchManager.AddListener(EventTriggerType.PointerUp, i => _target = null);
 }
Esempio n. 36
0
 //public Vector2 clickableTouchPosition  { get; private set; }
 void Awake()
 {
     if (current == null) {
         current = this;
         DontDestroyOnLoad (current);
     } else
         DestroyObject (this);
 }
Esempio n. 37
0
 void Start()
 {
     m_Instance = this;
     UIEventListener listener = UIEventListener.Get(gameObject);
     listener.onDrag += PlayerDrag;
     listener.onDragOut += PlayerDragOut;
     listener.onClick += PlayerClick;
 }
Esempio n. 38
0
    void Start()
    {
        touchManager = GetComponent<TouchManager>();

        for (int i = 0; i < input.Length; i++) {
            input[i] = new InputData();
        }
    }
Esempio n. 39
0
 public void drag(TouchManager.TouchDragEvent touchEvent)
 {
     float widthClamp = ((float)mapControl.width / 2.0f) + 5.0f;
     posGoal.x = Mathf.Clamp(posGoal.x - (touchEvent.touchDelta.x * scollSpeed), -widthClamp, widthClamp);
     float lengthClamp = ((float)mapControl.length / 3.0f);
     rotGoal = Mathf.Clamp(rotGoal + (touchEvent.touchDelta.y * scollSpeed), -lengthClamp, lengthClamp);
     ClearTarget();
 }
Esempio n. 40
0
 void Awake()
 {
     // TouchManagerの唯一のインスタンスを生成
     if (instance == null) {
         instance = this;
     } else {
         Destroy (gameObject);
     }
 }
Esempio n. 41
0
 public void drag(TouchManager.TouchDragEvent touchEvent)
 {
     if (touchEvent.startTarget == lowerLeft) {
         miniMapControl.Scroll(touchEvent.touchDelta);
     }
     if (touchEvent.startTarget == zoomHandle) {
         miniMapControl.AdjustZoomLevel(-touchEvent.touchDelta.y * 0.01f);
     }
 }
Esempio n. 42
0
    public void tap(TouchManager.TapEvent touchEvent)
    {
        if (touchEvent.touchTarget == centerMiniMap) {
            miniMapControl.CenterMiniMap();
        }

        if (touchEvent.touchTarget == resizeButton) {
            Resize();
        }
    }
Esempio n. 43
0
    public void drag(TouchManager.TouchDragEvent touchEvent)
    {
        Vector3 worldPos = Camera.main.ScreenToWorldPoint(new Vector3 (touchEvent.touchPosition.x, touchEvent.touchPosition.y, Camera.main.nearClipPlane + 1.0f));
        if (touchEvent.startTarget.name.Equals("MoveThumb"))
            movePosGoal = Vector3.ClampMagnitude(moveThumb.parent.InverseTransformPoint(worldPos), 0.1f);

        if (touchEvent.startTarget.name.Equals("ThrowThumb"))
            throwPosGoal = Vector3.ClampMagnitude(throwThumb.parent.InverseTransformPoint(worldPos), 0.1f);

        if (touchEvent.startTarget.name.Equals("ShootThumb"))
            shootPosGoal = Vector3.ClampMagnitude(shootThumb.parent.InverseTransformPoint(worldPos), 0.1f);
    }
 public LAppView(LAppModel model, Transform tr)
 {
     this.model = model;
     this.transform = tr;
     this.deviceToScreen = new L2DMatrix44();
     this.touchMgr = new TouchManager();
     this.dragMgr = new L2DTargetPoint();
     Bounds bounds = model.GetBounds();
     this.localP_LT = new Vector3(-(bounds.size.x / 2f), 0f, bounds.size.z / 2f);
     this.localP_RT = new Vector3(bounds.size.x / 2f, 0f, bounds.size.z / 2f);
     this.localP_LB = new Vector3(-(bounds.size.x / 2f), 0f, -(bounds.size.z / 2f));
 }
Esempio n. 45
0
 void Start()
 {
     debug = _.debug;
     positions = _.positions;
     cameraPositions = _.cameraPositions;
     triggerPositions = _.triggerPositions;
     cylinderPositions = _.cylinderPositions;
     hammerPositions = _.hammerPositions;
     revolver = _.revolver;
     stationaryParts = _.stationaryParts;
     touchManager = _.touchManager;
     stateMachine = _.stateMachine;
 }
Esempio n. 46
0
    void HandleGo(TouchManager.Direction Direction)
    {

        Going = true;
        GoDirection = Direction;
        _smoothFollow.TargetTransform = PlacesToBe[(int)Direction];
        GoTimer.SetTimer(Go_Return_Time);

        //what if we are comboing
        Comboing = false;
        ComboDirection = TouchManager.Direction.Nowhere;
        ComboTimer.SetActive(false);
        MyMat.color = Color.blue;
        
    }
Esempio n. 47
0
	// Use this for initialization
	void Awake () {
		buttonNewSpawn = transform.FindChild ("ButtonNewSpawn").GetComponent<Button> ();
		buttonCreateCreep1 = transform.FindChild ("ButtonCreateCreep1").GetComponent<Button> ();
		buttonSkillSquad = transform.FindChild ("ButtonSkillSquad").GetComponent<Button> ();
		buttonEvolveSquad1 = transform.FindChild ("ButtonEvolveSquad1").GetComponent<Button> ();
		buttonEvolveSquad2 = transform.FindChild ("ButtonEvolveSquad2").GetComponent<Button> ();
		selectedTxt = transform.FindChild ("SelectedText").GetComponent<Text> ();
		/*buttonEvolveSpawnT1 = transform.FindChild ("ButtonEvolveSpawnT1").GetComponent<Button> ();
		buttonEvolveSpawnT2 = transform.FindChild ("ButtonEvolveSpawnT2").GetComponent<Button> ();
		buttonEvolveCreepA = transform.FindChild ("ButtonEvolveCreepA").GetComponent<Button> ();
		buttonEvolveCreepB = transform.FindChild ("ButtonEvolveCreepB").GetComponent<Button> ();
		buttonSkillSpawn = transform.FindChild ("ButtonSkillSpawn").GetComponent<Button> ();
		buttonAddBioPool = transform.FindChild ("ButtonAddBioPool").GetComponent<Button> ();
		buttonEvolveCreepA.interactable = false;
		buttonEvolveCreepB.interactable = false;
		buttonEvolveSpawnT2.interactable = false;
		buttonSkillSpawn.interactable = false;*/
		touchManager = GameObject.Find ("GameManager/TouchManager").GetComponent<TouchManager> ();
		pool = GameObject.Find ("Pool").GetComponent<Pool> ();
		badgerSq = pool.prefabSquadBadger.GetComponentInChildren<Squad> ();
	}
Esempio n. 48
0
 /// <summary>
 /// Unity OnDestroy callback.
 /// </summary>
 protected virtual void OnDestroy()
 {
     manager = null;
 }
Esempio n. 49
0
 void Awake()
 {
     touchManager = GameObject.Find("touchManager").GetComponent<TouchManager>();
     ren = gameObject.GetComponent<Renderer>();
 }
Esempio n. 50
0
 void touchDown(TouchManager.TouchDownEvent touchEvent)
 {
     target.SendMessage ("touchDown", touchEvent);
 }
Esempio n. 51
0
 void drag(TouchManager.TouchDragEvent touchEvent)
 {
     target.SendMessage ("drag", touchEvent);
 }
Esempio n. 52
0
 public void tap(TouchManager.TapEvent touchEvent)
 {
     if (touchEvent.touchTarget.name.Equals("UpperRight")) {
         gameControl.LoadNewLevel("MainMenu", 1);
         gameControl.OpenInfoBox("Returning to Menu...", 3, 0.25f);
     }
     if (!playersTurn) return;
     foreach(Transform point in points) point.SendMessage("UnSelect");
 }
Esempio n. 53
0
 public void touchUp(TouchManager.TouchUpEvent touchEvent)
 {
     float widthClamp = ((float)mapControl.width / 2.0f) - 5.0f;
     posGoal.x = Mathf.Clamp(posGoal.x, -widthClamp, widthClamp);
 }
Esempio n. 54
0
 public void touchUp(TouchManager.TouchUpEvent touchEvent)
 {
     if (!playersTurn) return;
     cameraControl.touchUp(touchEvent);
 }
Esempio n. 55
0
 void tap(TouchManager.TapEvent touchEvent)
 {
     target.SendMessage ("tap", touchEvent);
 }
Esempio n. 56
0
 public void drag(TouchManager.TouchDragEvent touchEvent)
 {
     if (!playersTurn) return;
     cameraControl.drag(touchEvent);
 }
Esempio n. 57
0
 void touchUp(TouchManager.TouchUpEvent touchEvent)
 {
     target.SendMessage ("touchUp", touchEvent);
 }
Esempio n. 58
0
	void Start () {
		//Inicializamos el path para evitar errores;
		initPos = new Vector3(0,0,100000);
		//Buscamos la pool para solicitar los creeps;
		pool = GameObject.Find ("Pool").GetComponent<Pool> ();
		//Iniciamos la solicitud de creeps basicos;
		invokeGene [0] = true;
		invokeGene [1] = false;
		Invoke("Create",1f/spawnRate);
		//Iniciamos la solicitud de creeps de tier;
		//Invoke("CreateTier",spawnRateTier);
		//Texto para ver el numero de creeps;
		textNumberCreeps = GameObject.Find ("CreepsText/Number").GetComponent<UITest> ();
		numberCreeps = 0;
		pathfinder = GameObject.Find("GameManager/PathFinder").GetComponent<PathFinding>();
		geneSpeed = 0;
		/***************************
	 	* SOLO PARA LAS PRUEBAS DE LA BARRA DE GENERACION*/
		spritesGene [0] = transform.FindChild ("ProductionBar/Prod_0").GetComponent<SpriteRenderer> ();
		spritesGene [1] = transform.FindChild ("ProductionBar/Prod_1").GetComponent<SpriteRenderer> ();
		spritesGene [2] = transform.FindChild ("ProductionBar/Prod_2").GetComponent<SpriteRenderer> ();
		spritesGene [3] = transform.FindChild ("ProductionBar/Prod_3").GetComponent<SpriteRenderer> ();
		spritesGene [4] = transform.FindChild ("ProductionBar/Prod_4").GetComponent<SpriteRenderer> ();
		/*****************************/
		touchManager = GameObject.Find ("GameManager/TouchManager").GetComponent<TouchManager> ();
		tier = 0;
		subType = -1;
		numBioPools = 0;
	}
Esempio n. 59
0
            if (value == state && state != GestureState.Changed) return false;

            var newState = Manager.GestureChangeState(this, value);
            State = newState;

            return value == newState;
Esempio n. 60
0
 //SearchEnemy searchEnemy;
 //==========基本コード==========
 void Awake()
 {
     touchManager = GameObject.Find("touchManager").GetComponent<TouchManager>();
     animator = GetComponent<Animator>();
     //searchEnemy = GameObject.Find("attackRange").GetComponent<SearchEnemy>();
 }