public override void TriggerEnter(PhysXCollider other)
    {
        // we only call Pickup() if "our" character collides with this PickupItem.
        // note: if you "position" remote characters by setting their translation, triggers won't be hit.

        // get gunner and driver id of pickup people.

        // execute if the driver id is mine or if I am the master client and driver id < 0

        if (PhotonNetwork.IsMasterClient)
        {
            NetworkPlayerVehicle npv = other.GetComponentInParent <NetworkPlayerVehicle>();
            if (npv != null && !npv.GetComponent <VehicleHealthManager>().isDead)
            {
                if (this.SentPickup)
                {
                    return;
                }
                int gunnerID         = npv.GetGunnerID();
                int driverID         = npv.GetDriverID();
                HotPotatoManager hpm = other.gameObject.GetComponentInParent <HotPotatoManager>();
                if (hpm.canPickupPotato)
                {
                    SentPickup = true;
                    GetComponent <PhotonView>().RPC(nameof(PickupPotato_RPC), RpcTarget.All, driverID, gunnerID, npv.teamId);
                }
            }
        }
    }
    void PickupPotato_RPC(int driverId, int gunnerId, int teamId)
    {
        if (driverId == PhotonNetwork.LocalPlayer.ActorNumber || (driverId < 0 && PhotonNetwork.IsMasterClient))
        {
            PhotonView otherpv = FindObjectOfType <PlayerTransformTracker>().GetVehicleTransformFromTeamId(teamId).GetComponent <PhotonView>();

            NetworkPlayerVehicle npv = otherpv.GetComponentInParent <NetworkPlayerVehicle>();
            HealthManager        hm  = otherpv.gameObject.GetComponentInChildren <HealthManager>();
            TeamNameSetup        tns = otherpv.gameObject.GetComponentInParent <TeamNameSetup>();
            HotPotatoManager     hpm = otherpv.gameObject.GetComponentInParent <HotPotatoManager>();


            this.GetComponent <PhotonView>().RPC(nameof(PunPickup), RpcTarget.AllViaServer, npv.GetDriverID(), npv.GetGunnerID());
            hm.HealObject(healthIncrease);
            tns.ChangeColour(true);
            hpm.pickupPotato();

            GameObject a = Instantiate(nutsNBoltsPrefab, transform.position, transform.rotation);
            Destroy(a, 4f);

            if (PhotonNetwork.IsMasterClient)
            {
                PhotonNetwork.Destroy(this.gameObject);
            }
            if (GetComponent <PhotonView>().IsMine)
            {
                PhotonNetwork.Destroy(this.gameObject);
            }
        }
    }
    protected new void Start()
    {
        baseCollisionResistance = deathForce / maxHealth;
        myRb = GetComponent <PhysXRigidBody>();
        if (GetComponent <HotPotatoManager>() != null)
        {
            hasHotPotatoManager = true;
            hotPotatoManager    = GetComponent <HotPotatoManager>();
            collisionNpv        = GetComponent <NetworkPlayerVehicle>();
            if (collisionNpv != null && !collisionNpv.botDriver)
            {
                driverCrashDetector = GetComponent <DriverCrashDetector>();
            }
        }

        base.Start();
    }
    void RemovePotato_RPC()
    {
        isPotato = false;
        PhotonView           otherpv = GetComponent <PhotonView>();
        NetworkPlayerVehicle npv     = otherpv.GetComponentInParent <NetworkPlayerVehicle>();
        HealthManager        hm      = otherpv.gameObject.GetComponentInChildren <HealthManager>();
        TeamNameSetup        tns     = otherpv.gameObject.GetComponentInParent <TeamNameSetup>();
        HotPotatoManager     hpm     = otherpv.gameObject.GetComponentInParent <HotPotatoManager>();

        canPickupPotato = false;
        Invoke(nameof(ReactivatePickupPotato), 5f);
        myDriverId = npv.GetDriverID();
        myGunnerId = npv.GetGunnerID();


        tns.ChangeColour(false);
        potatoEffects = GetComponentInChildren <PotatoEffects>();
        potatoEffects.DeactivatePotatoEffects(myDriverId, myGunnerId);
    }
    // Enable the arrow and find the player's own vehicle. Shouldn't be called until all vehicles are activated.
    public void ReadyUp()
    {
        hpms             = FindObjectsOfType <HotPotatoManager>().ToList();
        gamestateTracker = FindObjectOfType <GamestateTracker>();
        meshRenderer     = GetComponentInChildren <MeshRenderer>();
        PlayerEntry player = gamestateTracker.players.Get((short)PhotonNetwork.LocalPlayer.ActorNumber);
        List <NetworkPlayerVehicle> vehicles = FindObjectsOfType <NetworkPlayerVehicle>().ToList();

        foreach (NetworkPlayerVehicle vehicle in vehicles)
        {
            if (vehicle.teamId == player.teamId)
            {
                playerNPV = vehicle;
                playerHPM = vehicle.GetComponent <HotPotatoManager>();
                player.Release();
                break;
            }
        }

        isEnabled = true;
    }
 public VehicleTransformTeamIdPair(int id, Transform t, HotPotatoManager hpt)
 {
     teamId           = id;
     vehicleTransform = t;
     hotPotatoManager = hpt;
 }