Пример #1
0
 // Start is called before the first frame update
 void Start()
 {
     music = bgm.GetComponent <Music>();
     image = GetComponent <Image>();
     r     = GetComponent <RectTransform>();
     music.BGM(3);
     DateTime awakeDateTime = DateTime.Now;
 }
Пример #2
0
        // Update is called once per frame
        void Update()

        {
            if (!babiniku && music.num2 == 2 && !music.stream)
            {
                music.BGM(0);
            }

            s.sortingOrder = 100 - (int)(t.position.y * 10);

            if (babiniku)
            {
                s.sprite = sp1;
            }
            else
            {
                s.sprite = sp2;
            }


            float x = Input.GetAxis("Horizontal");
            float y = Input.GetAxis("Vertical");

            float vx;
            float vy;


            float speed = 4.0f;

            vy = y * Mathf.Cos(rotate * 3.1415f / 180.0f) + x * Mathf.Sin(rotate * 3.1415f / 180.0f);
            vx = -y *Mathf.Sin(rotate * 3.1415f / 180.0f) + x * Mathf.Cos(rotate * 3.1415f / 180.0f);

            rb.velocity = new Vector2(vx * speed, vy * speed);


            if (right && vx < -0.1f)
            {
                s.flipX = false;
                right   = false;
            }
            if (!right && vx > 0.1f)
            {
                s.flipX = true;
                right   = true;
            }
        }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        timer -= Time.unscaledDeltaTime;

        if (timer > 2.0f)
        {
            Time.timeScale = 0;
            image.sprite   = sprite3;
        }
        else if (timer > 1.0f)
        {
            image.sprite   = sprite2;
            Time.timeScale = 0;
        }
        else if (timer > 0.0f)
        {
            image.sprite   = sprite1;
            Time.timeScale = 0;
        }
        else if (timer > -1.0f)
        {
            image.sprite   = spritego;
            r.localScale   = new Vector2(16, 4);
            Time.timeScale = 1;
        }
        else
        {
            if (music.num2 == 3)
            {
                music.BGM(0);
            }
            cg.alpha = 0;
            if (once)
            {
                GameController.Instance.InitGame();
                once = false;
            }
        }
    }