Those two explains it quite easily to understand:
The construct 2 tutorial also shows you some helpful screenshots on how it works.
Basically photon works mostly with the "raise event" function between both players (there is no host and no peer)
- Player 1 Raise event (code: 1) with (data: "10"), target "others"
---> Event code is an identifier for each event, so that you can separate when you receive data from different events. You can use the numbers 1-200 and smth I think, but you don't need so many.
"Data" is only optional, but it can be super helpful to reduce the amount of different event codes. I think all data is converted into string, but I am not sure. (so if you use a number variable, the receiver gets it as a string)
"Target" are the people that receive the event. I am only using "others", since that will cause the least trouble in my opinion. If you set to "everyone", you will also receive your own event which you don't want in many cases.
- Player 2 "On Event (Code=1)"
Subtract (Photon.EventData) from health.
(in this case 10, I am still not sure if you need to convert it to float/int first or not)
What you did now, was sending the enemy the event number 1 (I would advice you to note your events somewhere on Google spreadsheets for example) which causes that the enemy looses health in this example.
The event data was 10, so you told him to loose 10 health.