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
82 lines (68 loc) · 2.64 KB
/
Copy pathLevelComponent.cs
File metadata and controls
82 lines (68 loc) · 2.64 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using System;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using Unity.NetCode;
using UnityEngine;
/// <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 shipCollisionRadius;
public float bulletVelocity;
public float bulletCollisionRadius;
/// <summary>Value of 0 implies one bullet per simulation tick. ROF cannot go higher than that.</summary>
public uint bulletRofCooldownTicks;
public float asteroidVelocity;
public float asteroidCollisionRadius;
public int numAsteroids;
public bool asteroidsDamageShips;
/// <summary>Can ships destroy each other?</summary>
public bool shipPvP;
public bool asteroidsDestroyedOnShipContact;
public bool bulletsDestroyedOnContact;
/// <summary>When > 0, informs <see cref="Unity.NetCode.GhostRelevancyMode"/>. Optimization.</summary>
/// <remarks>
/// Note: If <see cref="enableGhostImportanceScaling"/> is checked, the package uses the const defined in
/// <see cref="GhostDistanceImportance.BatchScaleWithRelevancyFunctionPointer"/> instead of this field.
/// </remarks>
public int relevancyRadius;
public bool staticAsteroidOptimization;
public bool enableGhostImportanceScaling;
public GhostDistanceData distanceImportanceTileConfig;
/// <summary>Distributes the CollisionSystem work over N ticks (1 = OFF).</summary>
[Min(1)]
public uint collisionSystemRoundRobinSegments;
public static LevelComponent Default = new LevelComponent
{
levelWidth = 2048,
levelHeight = 2048,
shipForwardForce = 50,
shipRotationRate = 140,
shipCollisionRadius = 10,
bulletVelocity = 500,
bulletCollisionRadius = 5,
bulletRofCooldownTicks = 3,
asteroidVelocity = 10,
asteroidCollisionRadius = 15,
numAsteroids = 800,
asteroidsDamageShips = true,
shipPvP = true,
asteroidsDestroyedOnShipContact = true,
bulletsDestroyedOnContact = true,
enableGhostImportanceScaling = true,
distanceImportanceTileConfig = new GhostDistanceData
{
TileSize = new int3(512, 512, 10240),
TileCenter = new int3(0, 0, 0),
TileBorderWidth = new float3(1f),
},
relevancyRadius = 1400,
staticAsteroidOptimization = false,
collisionSystemRoundRobinSegments = 1,
};
}