浏览代码

merge and inGameRunner update to use collider for area.

/main/staging/ngo_gameplay_tweaks
当前提交
07363e52
共有 14 个文件被更改,包括 92 次插入61 次删除
  1. 2
      Assets/Art/Icons/CursorIcon.png.meta
  2. 91
      Assets/Prefabs/NGO/InGameLogic.prefab
  3. 14
      Assets/Prefabs/NGO/SymbolContainer.prefab
  4. 14
      Assets/Prefabs/NGO/SymbolObject.prefab
  5. 2
      Assets/Scripts/Lobby/LobbyAsyncRequests.cs
  6. 4
      Assets/Scripts/Relay/RelayUtpSetup.cs
  7. 4
      Assets/Scripts/Tests/PlayMode/UtpTests.cs
  8. 4
      Assets/Scripts/NGO/SequenceSelector.cs
  9. 3
      Assets/Scripts/NGO/Scorer.cs
  10. 3
      Assets/Scripts/NGO/PlayerCursor.cs
  11. 10
      Assets/Scripts/NGO/InGameRunner.cs
  12. 2
      ProjectSettings/ProjectSettings.asset
  13. 0
      /Assets/Scripts/NGO
  14. 0
      /Assets/Scripts/NGO.meta

2
Assets/Art/Icons/CursorIcon.png.meta


externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0

91
Assets/Prefabs/NGO/InGameLogic.prefab


- component: {fileID: 6829526275642584874}
- component: {fileID: 2250928641321586401}
- component: {fileID: 2257191875943382526}
- component: {fileID: 4478514896869440358}
m_Layer: 0
m_Name: InGameRunner
m_TagString: Untagged

m_killVolume: {fileID: 3287911880781162359}
m_introOutroRunner: {fileID: 6828649701235740815}
m_dataStore: {fileID: 2257191875943382526}
m_collider: {fileID: 4478514896869440358}
--- !u!114 &6829526275642584874
MonoBehaviour:
m_ObjectHideFlags: 0

m_Script: {fileID: 11500000, guid: 5a054eb742dd9f748afc05982dc263b0, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!65 &4478514896869440358
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1306704497370578788}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 16, y: 120, z: 1}
m_Center: {x: 0, y: 69, z: 0}
--- !u!1 &1912141680601921478
GameObject:
m_ObjectHideFlags: 0

m_MaximumPacketSize: 1400
m_MaxPacketQueueSize: 128
m_SendQueueBatchSize: 6144
m_HeartbeatTimeoutMS: 500
m_ConnectTimeoutMS: 1000
m_MaxConnectAttempts: 60
m_DisconnectTimeoutMS: 30000
ConnectionData:
Address: 127.0.0.1
Port: 7777

propertyPath: m_Name
value: UserCardPanel
objectReference: {fileID: 0}
- target: {fileID: 1767503274657767312, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
value: 0
value: 1
value: 0
value: 1
value: 0
value: 40
value: 0
value: 40
value: 0
value: 43
value: 0
value: -23
value: 0
value: 1
value: 0
value: 1
value: 0
value: 49
value: 0
value: -3
value: 0
value: 1
value: 0
value: 1
value: 0
value: 40
value: 0
value: 135
value: 0
value: -3
objectReference: {fileID: 0}
- target: {fileID: 3229036008637484624, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_Pivot.x

objectReference: {fileID: 0}
- target: {fileID: 5804120253616419419, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
value: 0
value: 1
value: 0
value: 46
value: 0
value: -3
value: 0
value: 1
value: 0
value: 1
value: 0
value: 138
value: 0
value: -3
value: 0
value: 1
value: 0
value: 1
value: 0
value: 1
value: 0
value: 1
value: 0
value: 40
value: 0
value: 40
value: 0
value: 92
value: 0
value: -23
value: 0
value: 1
value: 0
value: 1
value: 0
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9c09208dc6d58f54aabb57c12071b660, type: 3}

14
Assets/Prefabs/NGO/SymbolContainer.prefab


SyncPositionX: 1
SyncPositionY: 1
SyncPositionZ: 1
SyncRotAngleX: 1
SyncRotAngleY: 1
SyncRotAngleZ: 1
SyncScaleX: 1
SyncScaleY: 1
SyncScaleZ: 1
SyncRotAngleX: 0
SyncRotAngleY: 0
SyncRotAngleZ: 0
SyncScaleX: 0
SyncScaleY: 0
SyncScaleZ: 0
Interpolate: 1
Interpolate: 0
CanCommitToTransform: 0
--- !u!114 &2302923454152093614
MonoBehaviour:

14
Assets/Prefabs/NGO/SymbolObject.prefab


SyncPositionX: 1
SyncPositionY: 1
SyncPositionZ: 1
SyncRotAngleX: 1
SyncRotAngleY: 1
SyncRotAngleZ: 1
SyncScaleX: 1
SyncScaleY: 1
SyncScaleZ: 1
SyncRotAngleX: 0
SyncRotAngleY: 0
SyncRotAngleZ: 0
SyncScaleX: 0
SyncScaleY: 0
SyncScaleZ: 0
InLocalSpace: 1
InLocalSpace: 0
Interpolate: 1
CanCommitToTransform: 0
--- !u!65 &1363360377255918887

2
Assets/Scripts/Lobby/LobbyAsyncRequests.cs


private RateLimitCooldown m_rateLimitQuickJoin = new RateLimitCooldown(10f);
private RateLimitCooldown m_rateLimitHost = new RateLimitCooldown(3f);
// TODO: Shift to using this to do rate limiting for all API calls? E.g. the lobby data pushing is on its own loop.
#endregion
private static Dictionary<string, PlayerDataObject> CreateInitialPlayerData(LobbyUser player)

4
Assets/Scripts/Relay/RelayUtpSetup.cs


var relayServerData = new RelayServerData(ref serverEndpoint, 0, ref allocationId, ref connectionData, ref hostConnectionData, ref key, isSecure);
relayServerData.ComputeNewNonce(); // For security, the nonce value sent when authenticating the allocation must be increased.
var relayNetworkParameter = new RelayNetworkParameter { ServerData = relayServerData };
var networkSettings = new NetworkSettings();
m_networkDriver = NetworkDriver.Create(new INetworkParameter[] { relayNetworkParameter });
m_networkDriver = NetworkDriver.Create(networkSettings.WithRelayParameters(ref relayServerData));
m_connections = new List<NetworkConnection>(connectionCapacity);
if (m_networkDriver.Bind(NetworkEndPoint.AnyIpv4) != 0)

4
Assets/Scripts/Tests/PlayMode/UtpTests.cs


}
private LobbyRelaySample.Auth.SubIdentity_Authentication m_auth;
GameObject m_dummy;
#pragma warning disable CS0414 // This is the "assigned but its value is never used" warning, which will otherwise appear when DTLS is unavailable.
GameObject m_dummy;
#pragma warning restore CS0414
[OneTimeSetUp]
public void Setup()

4
Assets/Scripts/NGO/SequenceSelector.cs


{
[SerializeField] private SymbolData m_symbolData = default;
[SerializeField] private Image[] m_targetSequenceOutput = default;
public const int k_symbolCount = 200;
private bool m_hasReceivedTargetSequence = false; // TODO: Perhaps split up members by client vs. host?
public const int k_symbolCount = 140;
private bool m_hasReceivedTargetSequence = false;
private ulong m_localId;
private bool m_canAnimateTargets = false;

3
Assets/Scripts/NGO/Scorer.cs


namespace LobbyRelaySample.ngo
{
// TODO: I'm using host and server interchangeably...which in part I have to since it's ServerRpc but I think IsHost vs. IsServer yield different results in some places?
// TODO: Most of the ints could be bytes?
[SerializeField] private NetworkedDataStore m_dataStore = default;
private ulong m_localId;
[SerializeField] private TMP_Text m_scoreOutputText = default;

3
Assets/Scripts/NGO/PlayerCursor.cs


var trails = m_onClickParticles.trails;
trails.colorOverLifetime = new ParticleSystem.MinMaxGradient(Color.grey);
}
else
{ m_renderer.enabled = false; // The local player should see their cursor instead of the simulated cursor object, since the object will appear laggy.
}
}
[ClientRpc]

10
Assets/Scripts/NGO/InGameRunner.cs


[SerializeField] private SymbolKillVolume m_killVolume = default;
[SerializeField] private IntroOutroRunner m_introOutroRunner = default;
[SerializeField] private NetworkedDataStore m_dataStore = default;
[SerializeField] private BoxCollider m_collider;
private Transform m_symbolContainerInstance;
private PlayerData m_localUserData; // This has an ID that's not necessarily the OwnerClientId, since all clients will see all spawned objects regardless of ownership.

private void ResetPendingSymbolPositions()
{
m_pendingSymbolPositions.Clear();
IList<Vector2> points = m_sequenceSelector.GenerateRandomSpawnPoints(new Rect(-15, 0, 30, 120), 2);
Rect boxRext = new Rect(m_collider.bounds.min.x, m_collider.bounds.min.y, m_collider.bounds.size.x, m_collider.bounds.size.y);
IList<Vector2> points = m_sequenceSelector.GenerateRandomSpawnPoints(boxRext, 2);
foreach (Vector2 point in points)
m_pendingSymbolPositions.Enqueue(point);
}

private void VerifyConnection_ServerRpc(ulong clientId)
{
VerifyConnection_ClientRpc(clientId);
[ClientRpc]
private void VerifyConnection_ClientRpc(ulong clientId)
{

/// <summary>
/// Once the connection is confirmed, check if all players have connected.
/// </summary>

bool areAllPlayersConnected = NetworkManager.ConnectedClients.Count >= m_expectedPlayerCount; // The game will begin at this point, or else there's a timeout for booting any unconnected players.
VerifyConnectionConfirm_ClientRpc(clientData.id, areAllPlayersConnected);
}
[ClientRpc]
private void VerifyConnectionConfirm_ClientRpc(ulong clientId, bool canBeginGame)
{

m_hasConnected = true;
}
if (canBeginGame && m_hasConnected)
{
m_timeout = -1;

}
public void OnReProvided(IInGameInputHandler previousProvider) { /*No-op*/ }
}
}
}

2
ProjectSettings/ProjectSettings.asset


accelerometerFrequency: 60
companyName: Unity
productName: Game-Lobby-Sample
defaultCursor: {fileID: 0}
defaultCursor: {fileID: 2800000, guid: 9367b4ce9024f5b4090fabc2941d2116, type: 3}
cursorHotspot: {x: 0, y: 0}
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
m_ShowUnitySplashScreen: 1

/Assets/Scripts/Netcode → /Assets/Scripts/NGO

/Assets/Scripts/Netcode.meta → /Assets/Scripts/NGO.meta

正在加载...
取消
保存