示例#1
0
    void Update()
    {
        // プレイヤーの移動
        float delta = Time.deltaTime;
        var   h     = Input.GetAxis(horizontalAxis);
        var   v     = Input.GetAxis(verticalAxis);

        var old         = transform.localPosition;
        var newPosition = new Vector3(
            old.x + h * delta * Speed,
            old.y + v * delta * Speed,
            old.z);

        // 画面端に出ないようにする
        var topLeft     = mainCamera.ViewportToWorldPoint(new Vector2(0, 0));
        var bottomRight = mainCamera.ViewportToWorldPoint(new Vector2(1, 1));

        newPosition.x = Mathf.Clamp(newPosition.x, topLeft.x, bottomRight.x);
        newPosition.y = Mathf.Clamp(newPosition.y, topLeft.y, bottomRight.y);

        transform.localPosition = newPosition;

        // shot入力チェック
        fireAxis.Update();
        if (fireAxis.ChangePositive)
        {
            shot();
        }
    }
示例#2
0
    // Update is called once per frame
    async void Update()
    {
        axis.Update();
        if (axis.ChangePositive)
        {
            if (buttonOnce)
            {
                return;
            }
            buttonOnce = true;
            GameObject o = GameObject.Find("PushAnyButton");
            if (o != null)
            {
                var flasher = o.GetComponent <FlashTextMeshProUGUI>();
                if (flasher != null)
                {
                    flasher.interval = 0.2f;
                    // メインスレッドで2秒後に処理を行う
                    await AwaitHelper.Delay(2f);

                    Debug.Log("load scene");
                    SceneManager.LoadScene("GameScene");
                }
            }
        }
        if (Input.GetKeyDown(KeyCode.Tab))
        {
            SceneManager.LoadScene("KeyCheckScene");
        }
    }
示例#3
0
 void Update()
 {
     fireAxis.Update();
     if (fireAxis.ChangePositive)
     {
         SceneManager.LoadScene("TitleScene");
     }
 }