コード例 #1
0
    void Update()
    {
        if (null == target)
        {
            return;
        }

        tank.AimAt(ProjectTargetPosition(target));
    }
コード例 #2
0
ファイル: PlayerControls.cs プロジェクト: tsani/tanks
    void Update()
    {
        var mask = 1 << aimLayer;

        RaycastHit hit;
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hit, Mathf.Infinity, mask))
        {
            tankController.AimAt(hit.point);
        }

        if (Input.GetButtonDown("Fire1"))
        {
            tankController.Shoot();
        }
    }
コード例 #3
0
    // Update is called once per frame
    void Update()
    {
        if (photonView.IsMine == false && PhotonNetwork.IsConnected == true)
        {
            return;
        }
        if (tankController == null)
        {
            return;
        }

        tankController.AimAt(camera.ScreenToWorldPoint(Input.mousePosition));

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

        tankController.MoveTo(direction);

        if (Input.GetButtonDown("Fire") && tankController.CanShoot())
        {
            tankController.photonView.RPC("Shoot", RpcTarget.AllViaServer);
        }
    }