Skip to content

Commit 7f4adf6

Browse files
v1.2.0 release
Bitesize Samples v1.2.0 release
2 parents aa585e2 + a3c53f5 commit 7f4adf6

File tree

297 files changed

+26484
-205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

297 files changed

+26484
-205
lines changed

.yamato/project.metafile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ projects:
2626
- name: 2dspaceshooter
2727
path: Basic/2DSpaceShooter
2828
- name: invaders
29-
path: Basic/Invaders
29+
path: Basic/Invaders
30+
- name: clientdriven
31+
path: Basic/ClientDriven
32+
- name: dynamicaddressablesnetworkprefabs
33+
path: Basic/DynamicAddressablesNetworkPrefabs

Basic/2DSpaceShooter/Assets/Fonts/chintzy SDF.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ MonoBehaviour:
10761076
m_GlyphIndex: 89
10771077
m_Scale: 1
10781078
- m_ElementType: 1
1079-
m_Unicode: 45
1079+
m_Unicode: 95
10801080
m_GlyphIndex: 14
10811081
m_Scale: 1
10821082
- m_ElementType: 1

Basic/2DSpaceShooter/Assets/Prefabs/Bullet.prefab

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ GameObject:
1414
- component: {fileID: 5800000}
1515
- component: {fileID: 11400004}
1616
- component: {fileID: -4113703611147433057}
17-
- component: {fileID: -2419440837048175228}
18-
- component: {fileID: -7548598001898569089}
1917
m_Layer: 0
2018
m_Name: Bullet
2119
m_TagString: Untagged
@@ -33,6 +31,7 @@ Transform:
3331
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
3432
m_LocalPosition: {x: 17.05494, y: -1.1583278, z: 0}
3533
m_LocalScale: {x: 0.6, y: 0.6, z: 0.6}
34+
m_ConstrainProportionsScale: 0
3635
m_Children:
3736
- {fileID: 6681543778280045604}
3837
- {fileID: 2541587719488337929}
@@ -51,6 +50,7 @@ SpriteRenderer:
5150
m_CastShadows: 0
5251
m_ReceiveShadows: 0
5352
m_DynamicOccludee: 1
53+
m_StaticShadowCaster: 0
5454
m_MotionVectors: 1
5555
m_LightProbeUsage: 0
5656
m_ReflectionProbeUsage: 0
@@ -157,45 +157,6 @@ MonoBehaviour:
157157
AlwaysReplicateAsRoot: 0
158158
DontDestroyWithOwner: 0
159159
AutoObjectParentSync: 0
160-
--- !u!114 &-2419440837048175228
161-
MonoBehaviour:
162-
m_ObjectHideFlags: 0
163-
m_CorrespondingSourceObject: {fileID: 0}
164-
m_PrefabInstance: {fileID: 0}
165-
m_PrefabAsset: {fileID: 0}
166-
m_GameObject: {fileID: 100000}
167-
m_Enabled: 1
168-
m_EditorHideFlags: 0
169-
m_Script: {fileID: 11500000, guid: e96cb6065543e43c4a752faaa1468eb1, type: 3}
170-
m_Name:
171-
m_EditorClassIdentifier:
172-
SyncPositionX: 1
173-
SyncPositionY: 1
174-
SyncPositionZ: 1
175-
SyncRotAngleX: 1
176-
SyncRotAngleY: 1
177-
SyncRotAngleZ: 1
178-
SyncScaleX: 1
179-
SyncScaleY: 1
180-
SyncScaleZ: 1
181-
PositionThreshold: 0.001
182-
RotAngleThreshold: 0.01
183-
ScaleThreshold: 0.01
184-
InLocalSpace: 0
185-
Interpolate: 1
186-
CanCommitToTransform: 0
187-
--- !u!114 &-7548598001898569089
188-
MonoBehaviour:
189-
m_ObjectHideFlags: 0
190-
m_CorrespondingSourceObject: {fileID: 0}
191-
m_PrefabInstance: {fileID: 0}
192-
m_PrefabAsset: {fileID: 0}
193-
m_GameObject: {fileID: 100000}
194-
m_Enabled: 1
195-
m_EditorHideFlags: 0
196-
m_Script: {fileID: 11500000, guid: 80d7c879794dfda4687da0e400131852, type: 3}
197-
m_Name:
198-
m_EditorClassIdentifier:
199160
--- !u!1 &1734169577680067239
200161
GameObject:
201162
m_ObjectHideFlags: 0
@@ -223,6 +184,7 @@ Transform:
223184
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
224185
m_LocalPosition: {x: 0, y: 0, z: 0}
225186
m_LocalScale: {x: 1.6666665, y: 1.6666665, z: 1.6666665}
187+
m_ConstrainProportionsScale: 0
226188
m_Children: []
227189
m_Father: {fileID: 400000}
228190
m_RootOrder: 0
@@ -239,6 +201,7 @@ TrailRenderer:
239201
m_CastShadows: 0
240202
m_ReceiveShadows: 1
241203
m_DynamicOccludee: 1
204+
m_StaticShadowCaster: 0
242205
m_MotionVectors: 0
243206
m_LightProbeUsage: 0
244207
m_ReflectionProbeUsage: 0
@@ -361,6 +324,7 @@ Transform:
361324
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
362325
m_LocalPosition: {x: 0, y: 0, z: 0}
363326
m_LocalScale: {x: 0.6784176, y: 0.6784176, z: 0.6784176}
327+
m_ConstrainProportionsScale: 0
364328
m_Children: []
365329
m_Father: {fileID: 400000}
366330
m_RootOrder: 2
@@ -376,6 +340,7 @@ SpriteRenderer:
376340
m_CastShadows: 0
377341
m_ReceiveShadows: 0
378342
m_DynamicOccludee: 1
343+
m_StaticShadowCaster: 0
379344
m_MotionVectors: 1
380345
m_LightProbeUsage: 0
381346
m_ReflectionProbeUsage: 0
@@ -443,6 +408,7 @@ Transform:
443408
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
444409
m_LocalPosition: {x: 0, y: 0, z: 0}
445410
m_LocalScale: {x: 1.2764332, y: 1.2764332, z: 1.2764332}
411+
m_ConstrainProportionsScale: 0
446412
m_Children: []
447413
m_Father: {fileID: 400000}
448414
m_RootOrder: 1
@@ -459,6 +425,7 @@ TrailRenderer:
459425
m_CastShadows: 0
460426
m_ReceiveShadows: 1
461427
m_DynamicOccludee: 1
428+
m_StaticShadowCaster: 0
462429
m_MotionVectors: 0
463430
m_LightProbeUsage: 0
464431
m_ReflectionProbeUsage: 0

Basic/2DSpaceShooter/Assets/Readme.asset

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ MonoBehaviour:
2424
url: https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-spaceshooter/index.html
2525
- heading:
2626
text: The entry scene for this game is the network scene. From there a game can
27-
be hosted or an existing game can be joined.
27+
be hosted or an existing game can be joined. Control the ship using WASD and
28+
shoot asteroids (or other players!) using the spacebar. Fly over pickups in
29+
the scene to get different temporary buffs for your ship (like increased fly
30+
speed or shooting extra bullets).
2831
linkText:
2932
url:
3033
- heading:

Basic/2DSpaceShooter/Assets/Scripts/Bullet.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,26 @@ private void DestroyBullet()
3838
NetworkObject.Despawn(true);
3939
}
4040

41+
public void SetVelocity(Vector2 velocity)
42+
{
43+
if (IsServer)
44+
{
45+
var bulletRb = GetComponent<Rigidbody2D>();
46+
bulletRb.velocity = velocity;
47+
SetVelocityClientRpc(velocity);
48+
}
49+
}
50+
51+
[ClientRpc]
52+
void SetVelocityClientRpc(Vector2 velocity)
53+
{
54+
if (!IsHost)
55+
{
56+
var bulletRb = GetComponent<Rigidbody2D>();
57+
bulletRb.velocity = velocity;
58+
}
59+
}
60+
4161
void OnCollisionEnter2D(Collision2D other)
4262
{
4363
var otherObject = other.gameObject;

Basic/2DSpaceShooter/Assets/Scripts/Powerup.cs

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,14 @@ public override void OnNetworkSpawn()
6161
{
6262
OnStartServer();
6363
}
64-
Color buffColor = Buff.buffColors[(int)buffType.Value];
65-
GetComponent<Renderer>().material.color = buffColor;
66-
m_PowerUpGlow.material.SetColor("_Color", buffColor);
67-
m_PowerUpGlow.material.SetColor("_EmissiveColor", buffColor);
68-
m_PowerUpGlow2.material.SetColor("_Color", buffColor);
69-
m_PowerUpGlow2.material.SetColor("_EmissiveColor", buffColor);
70-
71-
m_PowerUpLabel.text = buffType.Value.ToString().ToUpper();
72-
73-
if (buffType.Value == Buff.BuffType.QuadDamage)
74-
{
75-
m_PowerUpLabel.text = "Quad Damage";
76-
}
7764

78-
m_PowerUpLabel.style.color = buffColor;
65+
UpdateVisuals(buffType.Value);
66+
buffType.OnValueChanged += OnBuffTypeChanged;
67+
}
68+
69+
public override void OnNetworkDespawn()
70+
{
71+
buffType.OnValueChanged -= OnBuffTypeChanged;
7972
}
8073

8174
void OnStartClient()
@@ -94,6 +87,30 @@ void OnStartServer()
9487
{
9588
numPowerUps += 1;
9689
}
90+
91+
void OnBuffTypeChanged(Buff.BuffType previousValue, Buff.BuffType newValue)
92+
{
93+
UpdateVisuals(newValue);
94+
}
95+
96+
void UpdateVisuals(Buff.BuffType buffType)
97+
{
98+
var buffColor = Buff.buffColors[(int)buffType];
99+
GetComponent<Renderer>().material.color = buffColor;
100+
m_PowerUpGlow.material.SetColor("_Color", buffColor);
101+
m_PowerUpGlow.material.SetColor("_EmissiveColor", buffColor);
102+
m_PowerUpGlow2.material.SetColor("_Color", buffColor);
103+
m_PowerUpGlow2.material.SetColor("_EmissiveColor", buffColor);
104+
105+
m_PowerUpLabel.text = buffType.ToString().ToUpper();
106+
107+
if (buffType == Buff.BuffType.QuadDamage)
108+
{
109+
m_PowerUpLabel.text = "Quad Damage";
110+
}
111+
112+
m_PowerUpLabel.style.color = buffColor;
113+
}
97114

98115
void LateUpdate()
99116
{

Basic/2DSpaceShooter/Assets/Scripts/ShipControl.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,23 +196,24 @@ void Fire(Vector3 direction)
196196
{
197197
fireSound.Play();
198198

199-
int damage = 5;
199+
var damage = 5;
200200
if (QuadDamageTimer.Value > NetworkManager.ServerTime.TimeAsFloat)
201201
{
202202
damage = 20;
203203
}
204204

205-
bool bounce = BounceTimer.Value > NetworkManager.ServerTime.TimeAsFloat;
205+
var bounce = BounceTimer.Value > NetworkManager.ServerTime.TimeAsFloat;
206206

207-
GameObject bullet = m_ObjectPool.GetNetworkObject(BulletPrefab).gameObject;
208-
bullet.transform.position = transform.position + direction;
207+
var bulletGo = m_ObjectPool.GetNetworkObject(BulletPrefab).gameObject;
208+
bulletGo.transform.position = transform.position + direction;
209209

210-
var bulletRb = bullet.GetComponent<Rigidbody2D>();
211210
var velocity = m_Rigidbody2D.velocity;
212211
velocity += (Vector2)(direction) * 10;
213-
bulletRb.velocity = velocity;
214-
bullet.GetComponent<Bullet>().Config(this, damage, bounce, m_BulletLifetime);
215-
bullet.GetComponent<NetworkObject>().Spawn(true);
212+
bulletGo.GetComponent<NetworkObject>().Spawn(true);
213+
var bullet = bulletGo.GetComponent<Bullet>();
214+
bullet.Config(this, damage, bounce, m_BulletLifetime);
215+
bullet.SetVelocity(velocity);
216+
216217
}
217218

218219
void Update()

Basic/2DSpaceShooter/Assets/Scripts/Spawner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ void Update()
152152

153153
GameObject powerUp = m_ObjectPool.GetNetworkObject(m_PowerupPrefab).gameObject;
154154
powerUp.transform.position = pos;
155-
powerUp.GetComponent<Powerup>().buffType.Value = (Buff.BuffType)Random.Range(0, (int)Buff.BuffType.Last);
156155
powerUp.GetComponent<NetworkObject>().Spawn(true);
156+
powerUp.GetComponent<Powerup>().buffType.Value = (Buff.BuffType)Random.Range(0, (int)Buff.BuffType.Last);
157157
}
158158

159159
if (Asteroid.numAsteroids == 0)

Basic/2DSpaceShooter/Packages/manifest.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
{
22
"dependencies": {
33
"com.unity.2d.sprite": "1.0.0",
4-
"com.unity.collab-proxy": "1.17.7",
5-
"com.unity.ide.rider": "3.0.16",
6-
"com.unity.ide.visualstudio": "2.0.16",
4+
"com.unity.collab-proxy": "2.0.0",
5+
"com.unity.ide.rider": "3.0.18",
6+
"com.unity.ide.visualstudio": "2.0.17",
77
"com.unity.ide.vscode": "1.2.5",
88
"com.unity.multiplayer.samples.coop": "https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop",
99
"com.unity.netcode.gameobjects": "1.2.0",
1010
"com.unity.postprocessing": "3.2.2",
11-
"com.unity.render-pipelines.universal": "12.1.8",
11+
"com.unity.render-pipelines.universal": "12.1.10",
1212
"com.unity.test-framework": "1.1.31",
1313
"com.unity.textmeshpro": "3.0.6",
1414
"com.unity.timeline": "1.6.4",
1515
"com.unity.ugui": "1.0.0",
16+
"com.veriorpies.parrelsync": "https://github.com/VeriorPies/ParrelSync.git?path=/ParrelSync#bb3d5067e49e403d8b8ba15c036d313b4dd2c696",
1617
"com.unity.modules.ai": "1.0.0",
1718
"com.unity.modules.androidjni": "1.0.0",
1819
"com.unity.modules.animation": "1.0.0",

0 commit comments

Comments
 (0)