How to lock / unlock network objects by users correctly

Options
Hi everyone, dear colleagues! Advise, please - I can't think up the solution of the task. I have a virtual furniture shop. The applicatuon must visually reflects a real condition of a warehouse and furniture in shop. The buyer can approach and "take" a chair (by touch to model). Respectively, other buyer isn't reported to buy it any more, it has to be blocked by the first.
...
I use the Photon. Advise, please, what mechanism it is possible to lock a subject that there were no conflicts of users - for example, repeatedly another couldn't buy the bought chair any more?
...
That is I so understand that both players have to send something to the master client, and master client has to solve to whom to give preference. Probably so somehow? And how to make it what methods in the Photon for this purpose are?
...
And still I wanted to ask: how it is correct to make that if the administrator of shop has changed something, this change would right there be displayed at all network players? For example, the administrator has decided to add a sofa (or to change for other model) - then all players have to see it at once. Here it is better for them to use the mechanism of the Photon? To use network prefabs of a scene? Or somehow differently?

Best regards!

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @SN_007,

    Did you try CAS (Compare-And-Swap or Check-And-Set)?
    Basically every time you try to set new room or player properties you need to meet expected requirement based on previous values of same or other properties.
    It could be done using expectedProperties parameter of SetProperties methods.
    Read more here.