Added # ships on display
This commit is contained in:
Родитель
6013e23663
Коммит
4e9e3aff94
|
@ -23,7 +23,8 @@ namespace ECS_MLAgents_v0.Example.SpaceWars.Scripts
|
|||
style.normal.textColor = new Color (1.0f, 1.0f, 0.5f, 1.0f);
|
||||
float msec = deltaTime * 1000.0f;
|
||||
float fps = 1.0f / deltaTime;
|
||||
string text = string.Format("{0:0.0} ms ({1:0.} fps)", msec, fps);
|
||||
string text = string.Format(" {0:0.0} ms ({1:0.} fps)\n" +
|
||||
" # Ships : {2}", msec, fps, Globals.NumberShips);
|
||||
GUI.Label(rect, text, style);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ namespace ECS_MLAgents_v0.Example.SpaceWars.Scripts
|
|||
{
|
||||
public class Globals : MonoBehaviour
|
||||
{
|
||||
public static int NumberShips;
|
||||
|
||||
public static float SHIP_SPEED = 2f;
|
||||
public static float SHIP_ROTATION_SPEED = 1f;
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace ECS_MLAgents_v0.Example.SpaceWars.Scripts
|
|||
|
||||
var camPosition = manager.GetComponentData<Position>(_playerEntity).Value;
|
||||
var camRotation = manager.GetComponentData<Rotation>(_playerEntity).Value;
|
||||
camPosition += math.mul(camRotation, new float3(-2, 0, 5));
|
||||
camPosition += math.mul(camRotation, new float3(0, 0, 5));
|
||||
Camera.transform.position = Vector3.Lerp(Camera.transform.position,camPosition,0.1f);
|
||||
Camera.transform.rotation = Quaternion.Lerp(Camera.transform.rotation,camRotation,0.1f);
|
||||
|
||||
|
@ -96,6 +96,7 @@ namespace ECS_MLAgents_v0.Example.SpaceWars.Scripts
|
|||
|
||||
void Spawn(int amount)
|
||||
{
|
||||
Globals.NumberShips += amount;
|
||||
NativeArray<Entity> entities = new NativeArray<Entity>(amount, Allocator.Temp);
|
||||
manager.Instantiate(prefab, entities);
|
||||
for (int i = 0; i < amount; i++)
|
||||
|
|
Загрузка…
Ссылка в новой задаче