JisolGame/JNFrame/Assets/Script/battle/mode/GWorldSceneMode.cs
PC-20230316NUNE\Administrator a0c687b1ed 提交
2024-01-30 19:22:27 +08:00

40 lines
1.2 KiB
C#

using BepuPhysics;
using BepuPhysics.Constraints;
using BepuUtilities.Memory;
using Demos;
using UnityEngine;
namespace Script.battle.mode
{
public class GWorldSceneModeInput
{
}
public class GWorldSceneMode:GBaseMode<GWorldSceneModeInput>
{
public GameObject[] balls = null;
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());
}
public override void OnSyncUpdate(int dt, JNFrameInfo frame, GWorldSceneModeInput input)
{
if (frame.Index > 0)
{
var index = GetSync().nRandomInt(0, balls.Length - 1);
Debug.Log(index);
var ballNode = Instantiate(balls[index],this.transform);
var transformPosition = ballNode.transform.position;
ballNode.transform.position = new Vector3(GetSync().nRandomFloat(-6,6),transformPosition.y,GetSync().nRandomFloat(-6,6));
}
// _simulation.Timestep(dt);
}
}
}