Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.54 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4.  
  5. public class CPUController : MonoBehaviour
  6. {
  7.     Text MainPageText;
  8.     Vector2 MainPageCoord;
  9.    public float UIYCoord;
  10.     void Start ()
  11.     {
  12.         MainPageText = transform.Find("CPUCanvas/Panel/Text").GetComponent<Text>();
  13.         //MainPageText.text = "34553453453455434534534534583908530984520938450-2384523094852837589237523-523458273523845723-572-9759-23752-394572834752-934875";
  14.         UIYCoord = -600.0f;
  15.         //MovePageUp();
  16.     }
  17.    
  18.    
  19.     void Update ()
  20.     {
  21.         MainPageText.transform.localPosition = new Vector3(20.0f, UIYCoord, 0.0f);
  22.         //UIYCoord += 20.3f * Time.deltaTime;
  23.       //  MainPageCoord = new Vector2(20.0f, UIYCoord);
  24.        // MainPageText.rectTransform.anchoredPosition = MainPageCoord;
  25.        // MainPageText.transform.localPosition = new Vector3(20.0f, UIYCoord, 0.0f);
  26.         if (Input.GetKey(KeyCode.P))
  27.         {
  28.             MovePageUp();
  29.         }
  30.     }
  31.  
  32.  
  33.  
  34.     public void MovePageUp()
  35.     {
  36.         StartCoroutine(PageMoveUp());
  37.  
  38.     }
  39.  
  40.     IEnumerator PageMoveUp()
  41.     {
  42.      
  43.         {
  44.            
  45.             while (MainPageText.transform.localPosition.y < 600.0f)
  46.             {
  47.                 UIYCoord += 70.0f * Time.deltaTime;
  48.                 yield return null;
  49.             }
  50.             UIYCoord = -600.0f;
  51.             //MainPageText.transform.localPosition = new Vector3(20.0f, -600.0f, 0.0f);
  52.             Debug.Log("Верхний предел");
  53.            // MovePageUp();
  54.         }
  55.     }
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement