Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        // update if it is ready
        if (!isReadyToMove)
        {
            if (Utility.getInst().checkMatchV2(curObj.transform.position, refObj.transform.position))
            {
                this.GetComponent <ReadyMsg> ().sentMsg = "ready";
                isReadyToMove = true;
            }

//			if (readyMsg.text != null) {
//				if (readyMsg.text.Equals ("ready"))
//					isReadyToMove = true;
//				if (readyMsg.sentMsg.Equals ("ready"))
//					isReadyToMove = true;
//			}
        }

        if (Utility.getInst().checkMatchV2(curObj.transform.position, refObj.transform.position))
        {
            randAnime.disappear(curObj.transform.position);
            Debug.LogWarning("disappear");
        }
        else
        {
            randAnime.appear(isReadyToMove);
            shape.SetActive(false);
        }

        if (randAnime.isTimeToShow == 0)
        {
            shape.SetActive(true);
        }
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.UpArrow))
        {
            StepperCommunication.getInstance().forward(1);
        }

        if (Input.GetKey(KeyCode.DownArrow))
        {
            StepperCommunication.getInstance().backward(1);
        }

        if (Input.GetKey(KeyCode.LeftArrow))
        {
            StepperCommunication.getInstance().left(1);
        }

        if (Input.GetKey(KeyCode.RightArrow))
        {
            StepperCommunication.getInstance().right(1);
        }

        float angle = Quaternion.Dot(transform.rotation, refObj.transform.rotation);
        float dis   = Vector3.Distance(new Vector3(transform.position.x, 0, transform.position.z), new Vector3(refObj.transform.position.x, 0, refObj.transform.position.z));

        if (dis < disError
            //	&& (Mathf.Abs (Mathf.Abs (angle) - 1.0f) < rotateError)
            )
        {
            _ra.disappear(transform.position);
        }
        else
        {
            _ra.appear(gameObject.GetComponent <CarCtrl>().isReadyToMove);
            gameObject.SetActive(false);
        }

        if (_ra.isTimeToShow == 0)
        {
            gameObject.SetActive(true);
        }
    }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        //float angle = Quaternion.Dot(transform.rotation, refObj.transform.rotation);
        //float dis = Vector3.Distance (new Vector3 (transform.position.x, 0, transform.position.z), new Vector3 (refObj.transform.position.x, 0, refObj.transform.position.z));
        if (Utility.getInst().checkMatchV2(transform.position, refObj.transform.position)
            //	&& (Mathf.Abs (Mathf.Abs (angle) - 1.0f) < rotateError)
            )
        {
            _ra.disappear(transform.position);
        }
        else
        {
            _ra.appear(isReadyToMove);
            //carGeo.SetActive (false);
        }

        if (_ra.isTimeToShow == 0)
        {
            carGeo.SetActive(true);
        }
    }