mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交代码
This commit is contained in:
@@ -9,7 +9,7 @@ namespace Script
|
||||
|
||||
public static readonly JNGSocket Socket = new JNGSocket();
|
||||
public static readonly JNGSyncFrame Sync = new JNGSyncFrame();
|
||||
public static readonly JAPI Api = new(new JAPIConfig(){BaseURL = "http://192.168.1.23:8080"});
|
||||
public static readonly JAPI Api = new(new JAPIConfig(){BaseURL = "http://192.168.0.118:8080"});
|
||||
public static readonly EventDispatcher Event = EventDispatcher.Event;
|
||||
|
||||
public static SystemBase[] System()
|
||||
|
@@ -10,7 +10,7 @@ namespace Script.AppImpl
|
||||
protected override async UniTask<string> GetUrl()
|
||||
{
|
||||
await UniTask.NextFrame();
|
||||
return "ws://192.168.1.23:8080/websocket";
|
||||
return "ws://192.168.0.118:8080/websocket";
|
||||
}
|
||||
}
|
||||
}
|
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
8
JNFrame/Assets/Script/demo.meta
Normal file
8
JNFrame/Assets/Script/demo.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34db681fcdc63ef4888cf7b3a07e2eb7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
25
JNFrame/Assets/Script/demo/DemoMain.cs
Normal file
25
JNFrame/Assets/Script/demo/DemoMain.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BepuPhysics;
|
||||
using BepuUtilities.Memory;
|
||||
using Plugins.JNGame.BepuPhysics;
|
||||
using UnityEngine;
|
||||
|
||||
public class DemoMain : MonoBehaviour
|
||||
{
|
||||
private JNBepuPhysics Physics;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Awake()
|
||||
{
|
||||
|
||||
Physics = new JNBepuPhysics();
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
Physics.OnUpdate(Time.deltaTime);
|
||||
}
|
||||
}
|
11
JNFrame/Assets/Script/demo/DemoMain.cs.meta
Normal file
11
JNFrame/Assets/Script/demo/DemoMain.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59ce1e82a0de1ef4281ebd5856759346
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user