示例#1
0
    // Update is called once per frame
    void Update()
    {
        rotation = this.transform.localRotation;


        if (StageReset || MapInitializer.GetSpawnEnable())
        {
            characterController         = GetComponent <CharacterController>();
            characterController.enabled = false;
            abc.x = MapInitializer.GetSpawnData("px");
            abc.y = MapInitializer.GetSpawnData("py");
            abc.z = MapInitializer.GetSpawnData("pz");
            UpdatePlayerXYZ(abc.x, abc.y, abc.z);
        }
        px = this.transform.position.x;
        py = this.transform.position.y;
        pz = this.transform.position.z;
        rx = this.transform.rotation.x;
        ry = this.transform.rotation.y;
        rz = this.transform.rotation.z;

        //リセット処理その2(その1はFirstPersonController.cs)
        // if (Input.GetKey(KeyCode.Return)) {
        //     characterController.enabled = false;
        //     ClearCheckFlg = true; }

        if (ClearCheckFlg)
        {
            // UpdatePlayerXYZ(abc.x, 15, abc.z);
        }
    }
示例#2
0
    void Update()
    {
        //初期座標の更新
        if (MapInitializer.GetSpawnEnable())
        {
            float ini_x = MapInitializer.GetSpawnData("px");
            float ini_y = MapInitializer.GetSpawnData("py");
            float ini_z = MapInitializer.GetSpawnData("pz");
            playerTransform.position = new Vector3(ini_x, ini_y, ini_z);
        }

        // マウスで視点移動
        float x_rotate = Input.GetAxis("Mouse X") * 3.0f;
        float y_rotate = Input.GetAxis("Mouse Y");

        playerTransform.transform.Rotate(0, x_rotate, 0);
        cameraTransform.transform.Rotate(-y_rotate, 0, 0);

        // WASDで移動する
        float x = 0.0f;
        float z = 0.0f;

        if (Input.GetKey(KeyCode.D))
        {
            x += 1.0f;
        }
        if (Input.GetKey(KeyCode.A))
        {
            x -= 1.0f;
        }
        if (Input.GetKey(KeyCode.W))
        {
            z += 1.0f;
        }
        if (Input.GetKey(KeyCode.S))
        {
            z -= 1.0f;
        }

        Vector3 move = z * playerTransform.forward + x * playerTransform.right;

        rb.velocity = move * speed;
    }
示例#3
0
 void Start()
 {
     abc.x = MapInitializer.GetSpawnData("rx");
     abc.y = MapInitializer.GetSpawnData("ry");
     abc.z = MapInitializer.GetSpawnData("rz");
 }