Skip to content

Commit

Permalink
v1.2.0 release
Browse files Browse the repository at this point in the history
Bitesize Samples v1.2.0 release
  • Loading branch information
fernando-cortez authored Feb 17, 2023
2 parents aa585e2 + a3c53f5 commit 7f4adf6
Show file tree
Hide file tree
Showing 297 changed files with 26,484 additions and 205 deletions.
6 changes: 5 additions & 1 deletion .yamato/project.metafile
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ projects:
- name: 2dspaceshooter
path: Basic/2DSpaceShooter
- name: invaders
path: Basic/Invaders
path: Basic/Invaders
- name: clientdriven
path: Basic/ClientDriven
- name: dynamicaddressablesnetworkprefabs
path: Basic/DynamicAddressablesNetworkPrefabs
2 changes: 1 addition & 1 deletion Basic/2DSpaceShooter/Assets/Fonts/chintzy SDF.asset
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ MonoBehaviour:
m_GlyphIndex: 89
m_Scale: 1
- m_ElementType: 1
m_Unicode: 45
m_Unicode: 95
m_GlyphIndex: 14
m_Scale: 1
- m_ElementType: 1
Expand Down
49 changes: 8 additions & 41 deletions Basic/2DSpaceShooter/Assets/Prefabs/Bullet.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ GameObject:
- component: {fileID: 5800000}
- component: {fileID: 11400004}
- component: {fileID: -4113703611147433057}
- component: {fileID: -2419440837048175228}
- component: {fileID: -7548598001898569089}
m_Layer: 0
m_Name: Bullet
m_TagString: Untagged
Expand All @@ -33,6 +31,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 17.05494, y: -1.1583278, z: 0}
m_LocalScale: {x: 0.6, y: 0.6, z: 0.6}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6681543778280045604}
- {fileID: 2541587719488337929}
Expand All @@ -51,6 +50,7 @@ SpriteRenderer:
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
Expand Down Expand Up @@ -157,45 +157,6 @@ MonoBehaviour:
AlwaysReplicateAsRoot: 0
DontDestroyWithOwner: 0
AutoObjectParentSync: 0
--- !u!114 &-2419440837048175228
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e96cb6065543e43c4a752faaa1468eb1, type: 3}
m_Name:
m_EditorClassIdentifier:
SyncPositionX: 1
SyncPositionY: 1
SyncPositionZ: 1
SyncRotAngleX: 1
SyncRotAngleY: 1
SyncRotAngleZ: 1
SyncScaleX: 1
SyncScaleY: 1
SyncScaleZ: 1
PositionThreshold: 0.001
RotAngleThreshold: 0.01
ScaleThreshold: 0.01
InLocalSpace: 0
Interpolate: 1
CanCommitToTransform: 0
--- !u!114 &-7548598001898569089
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 80d7c879794dfda4687da0e400131852, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1734169577680067239
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -223,6 +184,7 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.6666665, y: 1.6666665, z: 1.6666665}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 400000}
m_RootOrder: 0
Expand All @@ -239,6 +201,7 @@ TrailRenderer:
m_CastShadows: 0
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 0
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
Expand Down Expand Up @@ -361,6 +324,7 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.6784176, y: 0.6784176, z: 0.6784176}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 400000}
m_RootOrder: 2
Expand All @@ -376,6 +340,7 @@ SpriteRenderer:
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
Expand Down Expand Up @@ -443,6 +408,7 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.2764332, y: 1.2764332, z: 1.2764332}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 400000}
m_RootOrder: 1
Expand All @@ -459,6 +425,7 @@ TrailRenderer:
m_CastShadows: 0
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 0
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
Expand Down
5 changes: 4 additions & 1 deletion Basic/2DSpaceShooter/Assets/Readme.asset
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ MonoBehaviour:
url: https://docs-multiplayer.unity3d.com/netcode/current/learn/bitesize/bitesize-spaceshooter/index.html
- heading:
text: The entry scene for this game is the network scene. From there a game can
be hosted or an existing game can be joined.
be hosted or an existing game can be joined. Control the ship using WASD and
shoot asteroids (or other players!) using the spacebar. Fly over pickups in
the scene to get different temporary buffs for your ship (like increased fly
speed or shooting extra bullets).
linkText:
url:
- heading:
Expand Down
20 changes: 20 additions & 0 deletions Basic/2DSpaceShooter/Assets/Scripts/Bullet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,26 @@ private void DestroyBullet()
NetworkObject.Despawn(true);
}

public void SetVelocity(Vector2 velocity)
{
if (IsServer)
{
var bulletRb = GetComponent<Rigidbody2D>();
bulletRb.velocity = velocity;
SetVelocityClientRpc(velocity);
}
}

[ClientRpc]
void SetVelocityClientRpc(Vector2 velocity)
{
if (!IsHost)
{
var bulletRb = GetComponent<Rigidbody2D>();
bulletRb.velocity = velocity;
}
}

void OnCollisionEnter2D(Collision2D other)
{
var otherObject = other.gameObject;
Expand Down
45 changes: 31 additions & 14 deletions Basic/2DSpaceShooter/Assets/Scripts/Powerup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,14 @@ public override void OnNetworkSpawn()
{
OnStartServer();
}
Color buffColor = Buff.buffColors[(int)buffType.Value];
GetComponent<Renderer>().material.color = buffColor;
m_PowerUpGlow.material.SetColor("_Color", buffColor);
m_PowerUpGlow.material.SetColor("_EmissiveColor", buffColor);
m_PowerUpGlow2.material.SetColor("_Color", buffColor);
m_PowerUpGlow2.material.SetColor("_EmissiveColor", buffColor);

m_PowerUpLabel.text = buffType.Value.ToString().ToUpper();

if (buffType.Value == Buff.BuffType.QuadDamage)
{
m_PowerUpLabel.text = "Quad Damage";
}

m_PowerUpLabel.style.color = buffColor;
UpdateVisuals(buffType.Value);
buffType.OnValueChanged += OnBuffTypeChanged;
}

public override void OnNetworkDespawn()
{
buffType.OnValueChanged -= OnBuffTypeChanged;
}

void OnStartClient()
Expand All @@ -94,6 +87,30 @@ void OnStartServer()
{
numPowerUps += 1;
}

void OnBuffTypeChanged(Buff.BuffType previousValue, Buff.BuffType newValue)
{
UpdateVisuals(newValue);
}

void UpdateVisuals(Buff.BuffType buffType)
{
var buffColor = Buff.buffColors[(int)buffType];
GetComponent<Renderer>().material.color = buffColor;
m_PowerUpGlow.material.SetColor("_Color", buffColor);
m_PowerUpGlow.material.SetColor("_EmissiveColor", buffColor);
m_PowerUpGlow2.material.SetColor("_Color", buffColor);
m_PowerUpGlow2.material.SetColor("_EmissiveColor", buffColor);

m_PowerUpLabel.text = buffType.ToString().ToUpper();

if (buffType == Buff.BuffType.QuadDamage)
{
m_PowerUpLabel.text = "Quad Damage";
}

m_PowerUpLabel.style.color = buffColor;
}

void LateUpdate()
{
Expand Down
17 changes: 9 additions & 8 deletions Basic/2DSpaceShooter/Assets/Scripts/ShipControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,23 +196,24 @@ void Fire(Vector3 direction)
{
fireSound.Play();

int damage = 5;
var damage = 5;
if (QuadDamageTimer.Value > NetworkManager.ServerTime.TimeAsFloat)
{
damage = 20;
}

bool bounce = BounceTimer.Value > NetworkManager.ServerTime.TimeAsFloat;
var bounce = BounceTimer.Value > NetworkManager.ServerTime.TimeAsFloat;

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

var bulletRb = bullet.GetComponent<Rigidbody2D>();
var velocity = m_Rigidbody2D.velocity;
velocity += (Vector2)(direction) * 10;
bulletRb.velocity = velocity;
bullet.GetComponent<Bullet>().Config(this, damage, bounce, m_BulletLifetime);
bullet.GetComponent<NetworkObject>().Spawn(true);
bulletGo.GetComponent<NetworkObject>().Spawn(true);
var bullet = bulletGo.GetComponent<Bullet>();
bullet.Config(this, damage, bounce, m_BulletLifetime);
bullet.SetVelocity(velocity);

}

void Update()
Expand Down
2 changes: 1 addition & 1 deletion Basic/2DSpaceShooter/Assets/Scripts/Spawner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ void Update()

GameObject powerUp = m_ObjectPool.GetNetworkObject(m_PowerupPrefab).gameObject;
powerUp.transform.position = pos;
powerUp.GetComponent<Powerup>().buffType.Value = (Buff.BuffType)Random.Range(0, (int)Buff.BuffType.Last);
powerUp.GetComponent<NetworkObject>().Spawn(true);
powerUp.GetComponent<Powerup>().buffType.Value = (Buff.BuffType)Random.Range(0, (int)Buff.BuffType.Last);
}

if (Asteroid.numAsteroids == 0)
Expand Down
9 changes: 5 additions & 4 deletions Basic/2DSpaceShooter/Packages/manifest.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"dependencies": {
"com.unity.2d.sprite": "1.0.0",
"com.unity.collab-proxy": "1.17.7",
"com.unity.ide.rider": "3.0.16",
"com.unity.ide.visualstudio": "2.0.16",
"com.unity.collab-proxy": "2.0.0",
"com.unity.ide.rider": "3.0.18",
"com.unity.ide.visualstudio": "2.0.17",
"com.unity.ide.vscode": "1.2.5",
"com.unity.multiplayer.samples.coop": "https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop",
"com.unity.netcode.gameobjects": "1.2.0",
"com.unity.postprocessing": "3.2.2",
"com.unity.render-pipelines.universal": "12.1.8",
"com.unity.render-pipelines.universal": "12.1.10",
"com.unity.test-framework": "1.1.31",
"com.unity.textmeshpro": "3.0.6",
"com.unity.timeline": "1.6.4",
"com.unity.ugui": "1.0.0",
"com.veriorpies.parrelsync": "https://github.com/VeriorPies/ParrelSync.git?path=/ParrelSync#bb3d5067e49e403d8b8ba15c036d313b4dd2c696",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
Expand Down
Loading

0 comments on commit 7f4adf6

Please sign in to comment.