forked from Unity-Technologies/EntityComponentSystemSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLevelComponent.cs
More file actions
65 lines (48 loc) · 2.17 KB
/
Copy pathLevelComponent.cs
File metadata and controls
65 lines (48 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System;
using Unity.Entities;
/// <summary>Serializable attribute ensures the Inspector can expose fields as this struct is a field inside ServerSettings.</summary>
[Serializable]
public struct LevelComponent : IComponentData
{
public int levelWidth;
public int levelHeight;
public float shipForwardForce;
public float shipRotationRate;
public float bulletVelocity;
/// <summary>Value of 0 implies one bullet per simulation tick. ROF cannot go higher than that.</summary>
public uint bulletRofCooldownTicks;
public float asteroidVelocity;
public int numAsteroids;
[UnityEngine.SerializeField] private byte _asteroidsDamageShips;
public bool asteroidsDamageShips => _asteroidsDamageShips != 0;
/// <summary>Can ships destroy each other?</summary>
[UnityEngine.SerializeField] private byte _shipPvP;
public bool shipPvP => _shipPvP != 0;
[UnityEngine.SerializeField] private byte _asteroidsDestroyedOnShipContact;
public bool asteroidsDestroyedOnShipContact => _asteroidsDestroyedOnShipContact != 0;
[UnityEngine.SerializeField] private byte _bulletsDestroyedOnContact;
public bool bulletsDestroyedOnContact => _bulletsDestroyedOnContact != 0;
/// <summary>When > 0, informs <see cref="Unity.NetCode.GhostRelevancyMode"/>. Optimization.</summary>
public int relevancyRadius;
[UnityEngine.SerializeField] private byte _staticAsteroidOptimization;
public bool staticAsteroidOptimization => _staticAsteroidOptimization != 0;
[UnityEngine.SerializeField] private byte _enableGhostImportanceScaling;
public bool enableGhostImportanceScaling => _enableGhostImportanceScaling != 0;
public static LevelComponent Default = new LevelComponent
{
levelWidth = 2048,
levelHeight = 2048,
shipForwardForce = 50,
shipRotationRate = 100,
bulletVelocity = 500,
bulletRofCooldownTicks = 10,
asteroidVelocity = 10,
numAsteroids = 200,
_asteroidsDamageShips = 1,
_shipPvP = 0,
_asteroidsDestroyedOnShipContact = 0,
_bulletsDestroyedOnContact = 1,
relevancyRadius = 0,
_staticAsteroidOptimization = 0,
};
}