2024-01-30 19:22:27 +08:00
using BepuPhysics ;
using BepuPhysics.Constraints ;
using BepuUtilities.Memory ;
using Demos ;
using UnityEngine ;
2024-01-29 19:07:52 +08:00
namespace Script.battle.mode
{
public class GWorldSceneModeInput
{
}
public class GWorldSceneMode : GBaseMode < GWorldSceneModeInput >
{
2024-01-30 19:22:27 +08:00
public GameObject [ ] balls = null ;
2024-01-29 19:07:52 +08:00
2024-01-30 19:22:27 +08:00
private Simulation _simulation ;
public override void OnSyncLoad ( )
{
// BufferPool pool = new BufferPool();
// Simulation.Create(pool, new DemoNarrowPhaseCallbacks(), new DemoPoseIntegratorCallbacks(new System.Numerics.Vector3(0, -10, 0)), new PositionFirstTimestepper());
}
2024-01-29 19:07:52 +08:00
public override void OnSyncUpdate ( int dt , JNFrameInfo frame , GWorldSceneModeInput input )
{
if ( frame . Index > 0 )
{
2024-01-30 19:22:27 +08:00
var index = GetSync ( ) . nRandomInt ( 0 , balls . Length - 1 ) ;
Debug . Log ( index ) ;
var ballNode = Instantiate ( balls [ index ] , this . transform ) ;
2024-01-29 19:07:52 +08:00
var transformPosition = ballNode . transform . position ;
2024-01-30 19:22:27 +08:00
ballNode . transform . position = new Vector3 ( GetSync ( ) . nRandomFloat ( - 6 , 6 ) , transformPosition . y , GetSync ( ) . nRandomFloat ( - 6 , 6 ) ) ;
2024-01-29 19:07:52 +08:00
}
2024-01-30 19:22:27 +08:00
// _simulation.Timestep(dt);
2024-01-29 19:07:52 +08:00
}
}
}