Add StickGame Assets

This commit is contained in:
Dzejkobik007
2024-03-24 22:21:16 +01:00
parent 5a5812c0c7
commit 6c8b523d1f
6643 changed files with 596260 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
using FishNet.Object;
using UnityEngine;
namespace FishNet.Demo.HashGrid
{
public class GridSpawner : NetworkBehaviour
{
[SerializeField]
private NetworkObject _staticPrefab;
[SerializeField]
private NetworkObject _movingPrefab;
[SerializeField]
private int _movingCount = 100;
[SerializeField]
private byte _spacing = 2;
private float _range => MoveRandomly.Range;
public override void OnStartServer()
{
for (int x = (int)(_range * -1); x < _range; x+= _spacing)
{
for (int y = (int)(_range * -1); y < _range; y++)
{
NetworkObject n = Instantiate(_staticPrefab, new Vector3(x, y, transform.position.z), Quaternion.identity);
base.Spawn(n);
}
}
for (int i = 0; i < _movingCount; i++)
{
NetworkObject n = Instantiate(_movingPrefab, transform.position, transform.rotation);
base.Spawn(n);
}
}
}
}