Пример #1
0
 private void OnTriggerExit(Collider other)
 {
     if (other.gameObject.tag == "Obstacle" && planeState == PlaneState.near)
     {
         planeState    = PlaneState.farAway;
         moveSpeed     = 250;
         moveDirection = MoveDirtection.left;
         Invoke("SetBack", 2.0f);
     }
 }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            moveSpeed     = 250;
            moveDirection = MoveDirtection.left;
            Debug.Log(brushPastText.GetComponent <RectTransform>().localPosition.x);
            Invoke("SetBack", 2.0f);
        }
        brushPastText.GetComponent <RectTransform>().Translate(new Vector3(-moveSpeed, 0, 0));

        if (brushPastText.GetComponent <RectTransform>().localPosition.x <= 610 && moveDirection == MoveDirtection.left)//移动过头了
        {
            moveSpeed = -(610 - brushPastText.GetComponent <RectTransform>().localPosition.x);
        }
        if (brushPastText.GetComponent <RectTransform>().localPosition.x >= 1400 && moveDirection == MoveDirtection.right)
        {
            moveSpeed = -(1400 - brushPastText.GetComponent <RectTransform>().localPosition.x);
        }
    }
Пример #3
0
 private void SetBack()
 {
     moveSpeed     = -250;
     moveDirection = MoveDirtection.right;
 }