Пример #1
0
    // Update is called once per frame
    void Update()
    {
        Button btn1 = Answer1.GetComponent <Button>();
        Button btn2 = Answer2.GetComponent <Button>();
        Button btn3 = Answer3.GetComponent <Button>();

        btn1.onClick.AddListener(AnswerA);
        btn2.onClick.AddListener(AnswerB);
        btn3.onClick.AddListener(AnswerC);

        //print(Late.GetComponent<Rigidbody2D>().IsSleeping());

        if (Status == 1 && sleeping)
        {
            Answer2.transform.Translate(Vector3.left * 1000 * Time.deltaTime);
            Answer3.transform.Translate(Vector3.left * 1000 * Time.deltaTime);
            An1.GetComponent <Image>().color = Color.red;
            Late.GetComponent <Rigidbody2D>().WakeUp();
            Late.SetActive(true);
            van.SetActive(true);
            van.transform.Translate(Vector3.left * 200 * Time.deltaTime);
            van.GetComponent <Rigidbody2D>().AddForce(force);
            van.GetComponent <Rigidbody2D>().WakeUp();
            GameObject.Find("Target").SetActive(false);
            GameObject.Find("Player").SetActive(false);
        }
        if (Status == 2 && sleeping)
        {
            Answer1.transform.Translate(Vector3.left * 1000 * Time.deltaTime);
            Answer3.transform.Translate(Vector3.left * 1000 * Time.deltaTime);
            An2.GetComponent <Image>().color = Color.green;
            Late2.GetComponent <Rigidbody2D>().WakeUp();
            Late2.SetActive(true);
            //Late.GetComponent<Rigidbody2D>().WakeUp();
            //Late.SetActive(true);
            van.SetActive(true);
            //van.transform.Translate(Vector3.left * 200 * Time.deltaTime);
        }
        if (Status == 3 && sleeping)
        {
            Answer2.transform.Translate(Vector3.left * 1000 * Time.deltaTime);
            Answer1.transform.Translate(Vector3.left * 1000 * Time.deltaTime);
            An1.GetComponent <Image>().color = Color.green;
            Late2.GetComponent <Rigidbody2D>().WakeUp();
            Late2.SetActive(true);
            van.SetActive(true);
            //van.transform.Translate(Vector3.left * 200 * Time.deltaTime);
        }
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        Button btn1 = Answer1.GetComponent <Button>();
        Button btn2 = Answer2.GetComponent <Button>();
        Button btn3 = Answer3.GetComponent <Button>();

        btn1.onClick.AddListener(AnswerA);
        btn2.onClick.AddListener(AnswerB);
        btn3.onClick.AddListener(AnswerC);

        //print(Late.GetComponent<Rigidbody2D>().IsSleeping());

        if (Status == 1)
        {
            Answer2.transform.Translate(Vector3.left * 1000 * Time.deltaTime);
            Answer3.transform.Translate(Vector3.left * 1000 * Time.deltaTime);
            An1.GetComponent <Image>().color = Color.red;
            Late.GetComponent <Rigidbody2D>().WakeUp();
            Late.SetActive(true);
        }
        if (Status == 2)
        {
            Answer1.transform.Translate(Vector3.left * 1000 * Time.deltaTime);
            Answer3.transform.Translate(Vector3.left * 1000 * Time.deltaTime);
            An2.GetComponent <Image>().color = Color.green;
            Late.GetComponent <Rigidbody2D>().WakeUp();
            Late.SetActive(true);

            //van.transform.Translate(Vector3.left * 200 * Time.deltaTime);
        }
        if (Status == 3)
        {
            Answer2.transform.Translate(Vector3.left * 1000 * Time.deltaTime);
            Answer1.transform.Translate(Vector3.left * 1000 * Time.deltaTime);
            An1.GetComponent <Image>().color = Color.green;
            Late.GetComponent <Rigidbody2D>().WakeUp();
            Late.SetActive(true);
            //van.transform.Translate(Vector3.left * 200 * Time.deltaTime);
        }
    }
Пример #3
0
 private void OnMouseEnter()
 {
     An1.GetComponent <Image>().color = Color.red;
     An2.GetComponent <Image>().color = Color.red;
     An3.GetComponent <Image>().color = Color.red;
 }