-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
* fixing pong spawn points * renaming files and asmdef * More Cloud examples * Moving pong example to cloud folder * Moving shared code to GUI folder * Adding readme for examples * Adding tank example
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "Mirror.CloudServices", | ||
"name": "Mirror.Cloud", | ||
"references": [ | ||
"Mirror" | ||
], | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Cloud GUI | ||
|
||
This folder contains an example of a List server canvas and scripts that can help set up a GUI. | ||
|
||
|
||
## Other Examples | ||
|
||
See `PongWithListServer` or `TanksWithListServer` for playable examples |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Pong with Cloud List server | ||
|
||
This is an example that uses the list server to find games of pong | ||
|
||
## Setup | ||
|
||
Add the following scenes to build settings | ||
``` | ||
Mirror\Examples\Cloud\PongWithListServer\Scenes\ListServerLobbyScenePong.unity | ||
Mirror\Examples\Cloud\PongWithListServer\Scenes\PongGameScene.unity | ||
``` | ||
> Note: you can not connect to your own public ip address, to test out ServerOnly you will need a 2nd person (or a 2nd internet connection) | ||
## Api Key | ||
|
||
Api key on the NetworkManager is a demo key that should not be used in production. | ||
|
||
Visit [Mirror Networking](https://mirror-networking.com/list-server/) to get an api key that you can use in your game. | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "Mirror.Examples.Cloud.Pong", | ||
"references": [ | ||
"Mirror", | ||
"Mirror.Cloud", | ||
"Mirror.Examples.Cloud.GUI" | ||
], | ||
"optionalUnityReferences": [], | ||
"includePlatforms": [], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using UnityEngine; | ||
|
||
namespace Mirror.CloudServices.Example | ||
{ | ||
public sealed class NetworkManagerListServerPong : NetworkManagerListServer | ||
{ | ||
public override void OnServerAddPlayer(NetworkConnection conn) | ||
{ | ||
Debug.Assert(startPositions.Count == 2, "Pong Scene should have 2 start Poitions"); | ||
// add player at correct spawn position | ||
Transform startPos = numPlayers == 0 ? startPositions[0] : startPositions[1]; | ||
|
||
GameObject player = startPos != null | ||
? Instantiate(playerPrefab, startPos.position, startPos.rotation) | ||
: Instantiate(playerPrefab); | ||
|
||
NetworkServer.AddPlayerForConnection(conn, player); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.