浏览代码

Updated Goal check system to use new syntax

/main
mikegeig 4 年前
当前提交
e73aaf15
共有 2 个文件被更改,包括 14 次插入8 次删除
  1. 2
      DOTS_Pong/Assets/Ball.prefab
  2. 20
      DOTS_Pong/Assets/Scripts/Systems/BallGoalCheckSystem.cs

2
DOTS_Pong/Assets/Ball.prefab


m_GameObject: {fileID: 6887475011426345520}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalScale: {x: 0.7, y: 0.7, z: 0.7}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0

20
DOTS_Pong/Assets/Scripts/Systems/BallGoalCheckSystem.cs


using UnityEngine;
using Unity.Collections;
using Unity.Mathematics;
using Unity.Jobs;
public class BallGoalCheckSystem : ComponentSystem
public class BallGoalCheckSystem : JobComponentSystem
protected override void OnUpdate()
protected override JobHandle OnUpdate(JobHandle inputDeps)
Entities.WithAll<BallTag>().ForEach((Entity entity, ref Translation trans) =>
{
Entities
.WithAll<BallTag>()
.WithStructuralChanges()
.ForEach((Entity entity, ref Translation trans) =>
{
float3 pos = trans.Value;
float bound = GameManager.main.xBound;

PostUpdateCommands.DestroyEntity(entity);
EntityManager.DestroyEntity(entity);
PostUpdateCommands.DestroyEntity(entity);
EntityManager.DestroyEntity(entity);
});
}).Run();
return inputDeps;
}
}
正在加载...
取消
保存