Пример #1
0
    private void FixedUpdate()
    {
        if (!selected)//If not selected the card will lerp to its own place
        {
            //lerping can be done because there are alway a hand fullof cards on the game
            transform.position = Vector3.Lerp(transform.position, orginPosition, Time.deltaTime * 6);
        }
        else //follow the finger which the player used to select this card
        {
            if (Input.touches.Length > 0)
            {
                SetCardPlaceWithFingerID(fingerfollowID);
            }
            else
            {
                //for now use mouse input, later use fingerID
                Vector3 _input = Input.mousePosition;
                _input.z           = 5;
                transform.position = Camera.main.ScreenToWorldPoint(_input);
            }
        }

        if (casted)
        {
            cardSpell.Casting(transform.position);
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            cardSpell.EndCast(Camera.main.ScreenToWorldPoint(Input.mousePosition));
        }
    }