mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交代码
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
using Unity.Burst;
|
||||
using Unity.Entities;
|
||||
using Unity.Jobs;
|
||||
using Unity.Physics;
|
||||
using Unity.Physics.Systems;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Script.battle.mode
|
||||
{
|
||||
// ISystem version
|
||||
[UpdateInGroup(typeof(FixedStepSimulationSystemGroup))]
|
||||
[UpdateBefore(typeof(PhysicsSystemGroup))] // Make sure that the running order of systems is correct
|
||||
public partial struct GDemo : ISystem
|
||||
{
|
||||
[BurstCompile]
|
||||
public partial struct CastRayJob : IJob
|
||||
{
|
||||
public PhysicsWorldSingleton World;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[BurstCompile]
|
||||
public void OnUpdate(ref SystemState state)
|
||||
{
|
||||
PhysicsWorldSingleton physicsWorldSingleton = SystemAPI.GetSingleton<PhysicsWorldSingleton>();
|
||||
Debug.Log(physicsWorldSingleton.PhysicsWorld.NumBodies);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f5a8b25d8fd548d095bd2915e3e941df
|
||||
timeCreated: 1706651921
|
@@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using Plugins.JNGame.BepuPhysics;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Script.battle.mode
|
||||
{
|
||||
@@ -10,17 +11,21 @@ namespace Script.battle.mode
|
||||
{
|
||||
|
||||
public GameObject[] balls = null;
|
||||
private JNBepuPhysics Physics;
|
||||
|
||||
|
||||
public override void OnSyncLoad()
|
||||
{
|
||||
|
||||
Physics = new();
|
||||
// BufferPool pool = new BufferPool();
|
||||
// Simulation.Create(pool, new DemoNarrowPhaseCallbacks(), new DemoPoseIntegratorCallbacks(new System.Numerics.Vector3(0, -10, 0)), new PositionFirstTimestepper());
|
||||
}
|
||||
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, GWorldSceneModeInput input)
|
||||
{
|
||||
if (frame.Index > 0)
|
||||
Physics.OnUpdate((float) dt / 1000);
|
||||
if (frame.Index > 0 && frame.Index % 4 == 0)
|
||||
{
|
||||
var index = GetSync().nRandomInt(0, balls.Length - 1);
|
||||
Debug.Log(index);
|
||||
@@ -28,7 +33,6 @@ namespace Script.battle.mode
|
||||
var transformPosition = ballNode.transform.position;
|
||||
ballNode.transform.position = new Vector3(GetSync().nRandomFloat(-6,6),transformPosition.y,GetSync().nRandomFloat(-6,6));
|
||||
}
|
||||
// _simulation.Timestep(dt);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user