Professional Documents
Culture Documents
Player.cs:
We have 6 players for default, they must be located in Resources folder (Photon
requirements)
They are instantiated by name so they must be named “Player” + index ( from 0-5)
Those 6 prefabs that I created are the same, so you can just modify them later.
The player prefab must have ( in case you want to create the prefab from scratch, if you only
want to modify the existing prefabs, ignore this ):
Add a Photon Transform view, but this time check the box “Rotation”
Add a Photon Animator view, and put “Continous” to the animations that you want to
synchronize
Add a Photon View component and add to “Observed Components” the previous added
components
Like this:
In the Main Camera inside the Player prefab, I created the “CameraFollow” script.
In Player.cs at the start method, I set the parent of the camera to “null” so the camera can
follow smoothly the player, instead of being inside of the player in the hierarchy.
You can notice how necessary is this if you're spectating another player in online multiplayer,
it won't look smooth if you put the camera inside of the player.
If you don't want this, just remove “Camera Follow” from the Main Camera, but I don't
recommend it.
Some Photon View components have no observed components but you can't remove them
because they are required to do other tasks.
Projectiles:
All projectiles must have a Photon View to be spawned across the network.
In all projectiles script, in the Update method, you have to add this code:
if (!owner)
Destroy(this.gameObject);
“owner” is a variable used in all projectiles script, so I guess you'll follow the same structure
for all different type of projectiles abilities.
The purpose of this line is to destroy automatically the projects thrown by players who left the
room in the middle of a battle or pvp.
In “OnTriggerEnter” method, you have to check if the projectile collided with something with
tag “NotShootable” and in that case, ”return;”
The damage is done through a RPC method in online rooms, so the damage is syncrhonized,
since the one who detects if the projectile damaged someone or not, is the Master Client (“to
avoid hacking”)
All projectiles and everything that will be spawned across the network must be located in
“Resources” folder.
Camera:
You must go to Camera component – Rendering – Depth Texture – and change it to “On”
like this:
So you can see the “Fire Circle” properly with his effects and shadows.
Fire Circle:
I bought an asset for this, you can find it in “Oliver's work – Bonus Assets “
It's well documented and I think their document will help you more than my explanation of that
asset.
ZoneTimerCanvas gameobject, is where the waiting time for shrinking zone is displayed.
CurrentSafeZoneVisualizer gameobject is the fire circle itself, and you can change the
materials from it to change the color etc.
Zone is the gameobject where everything is controlled, the zone delay, shrinking time, etc.
In Multiplayer Level Manager you can set up how much damage will the storm do per second.
Create the Ultimate Orbs Spawn Zone (it's just a collider, they will spawn inside of that
collider)
In Canvas – InGameControls
Of course, in multiplayer they are spawned by the Master client, as all multiplayer logic,
master client handles this type of game logic
That's what I did to make it look “decent” using some effects that I imported.
Selector Scene:
At the start, the online buttons “Join 1v1, Join 2v2, Join 3v3” are disabled because you aren't
connected to photon, or if you left a game, it will be disabled while Photon gets ready to join
any other room.
There are a few changes to “Hero Selector” script, we reference all the buttons to select
characters so they get disabled when other player chose it.
After “TimeToAutoSelect” seconds it will choose an available character for the player, so the
game starts and players don't get stuck at this screen while others are waiting for him to start
the game.
“Loading Screen” gameobject inside of the MP_Canvas will block any clicks to the whole
canvas while it's active.