mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-11-11 08:38:45 +00:00
提交
This commit is contained in:
39
JNFrame/Assets/Game/Script/battle/mode/GWorldSceneMode.cs
Normal file
39
JNFrame/Assets/Game/Script/battle/mode/GWorldSceneMode.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Plugins.JNGame.BepuPhysics;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Script.battle.mode
|
||||
{
|
||||
public class GWorldSceneModeInput
|
||||
{
|
||||
|
||||
}
|
||||
public class GWorldSceneMode:GBaseMode<GWorldSceneModeInput>
|
||||
{
|
||||
|
||||
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)
|
||||
{
|
||||
Physics.OnUpdate((float) dt / 1000);
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e57d6502487241f9826136613eff59a2
|
||||
timeCreated: 1706519435
|
||||
Reference in New Issue
Block a user