Ejemplo n.º 1
0
    private void startEndAnimaition()
    {
        mCurEndImgShowTime = 0;
        mState             = STATE_END;

        if (mIsClicked)
        {
            CircleController circleController = circles[0].GetComponent <CircleController>();

            mClearImageController.startAnimaition(circles[0].transform.position, circleController.getColor32());
        }
        else
        {
            // right case
            //int onePerson = Random.Range(0, touches.Count);

            // wrong case
            int onePerson = Random.Range(0, touches.Count - 1);


            touchlocation thisTouch = touches[onePerson];

            foreach (touchlocation tl in touches)
            {
                if (tl == thisTouch)
                {
                    continue;
                }

                tl.dismissCircle();
            }

            mClearImageController.startAnimaition(thisTouch.getPos(), thisTouch.getColor32());
        }
    }
Ejemplo n.º 2
0
    private void updateGameState()
    {
        int i = 0;

        if (Application.isMobilePlatform)
        {
            while (i < Input.touchCount)
            {
                Touch t = Input.GetTouch(i);
                if (t.phase == TouchPhase.Began)
                {
                    Debug.Log("touch began");
                    touches.Add(new touchlocation(t.fingerId, getCircle(touches.Count), t.position));
                    resetEndTime();
                }
                else if (t.phase == TouchPhase.Ended)
                {
                    Debug.Log("touch ended");
                    touchlocation thisTouch = touches.Find(touchLocation => touchLocation.touchId == t.fingerId);
                    thisTouch.dismissCircle();
                    touches.RemoveAt(touches.IndexOf(thisTouch));
                    resetEndTime();
                }
                else if (t.phase == TouchPhase.Moved)
                {
                    Debug.Log("touch is moving");
                    touchlocation thisTouch = touches.Find(touchLocation => touchLocation.touchId == t.fingerId);
                    thisTouch.moveCircle(t.position);
                    //thisTouch.circle.transform.position = getTouchPosition(t.position);
                }
                ++i;
            }
        }
        else
        {
            if (Input.GetButtonDown("Fire1"))
            {
                showCircle(circles[0], Input.mousePosition);
                mIsClicked = true;
                resetEndTime();
            }
            else if (Input.GetButtonUp("Fire1"))
            {
                dismissCircle(circles[0]);
                mIsClicked = false;
                resetEndTime();
            }
            else if (Input.GetButton("Fire1"))
            {
                moveCircle(circles[0], Input.mousePosition);
                //circles[0].SetActive(true);
            }
        }

        checkGameEnd();
    }