Exemple #1
0
    void Update()
    {
        if (null == target)
        {
            return;
        }

        tank.AimAt(ProjectTargetPosition(target));
    }
Exemple #2
0
    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();
        }
    }
    // 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);
        }
    }