mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
no message
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Game.Plugins.App;
|
||||
using Google.Protobuf;
|
||||
using Plugins.JNGame;
|
||||
@@ -21,6 +22,8 @@ namespace Script
|
||||
async void Start()
|
||||
{
|
||||
|
||||
Application.targetFrameRate = 120;
|
||||
|
||||
//创建UI
|
||||
SceneManager.LoadScene("UIScene", LoadSceneMode.Additive);
|
||||
|
||||
@@ -51,7 +54,6 @@ namespace Script
|
||||
|
||||
public void OnNSyncFrameBack(JNFrameInfo info)
|
||||
{
|
||||
Debug.Log(info.Index);
|
||||
App.Sync.AddInput(info);
|
||||
}
|
||||
|
||||
|
@@ -10,21 +10,10 @@ namespace Script
|
||||
public class UIMain : MonoBehaviour
|
||||
{
|
||||
public Text frameLabel;
|
||||
float f = 1.23456789f;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
DontDestroyOnLoad(this.gameObject);
|
||||
}
|
||||
|
||||
//重置
|
||||
public void OnClickReset()
|
||||
{
|
||||
GBattleModeManager.Instance.Open(GBattleMode.Default).Forget();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
float f = 1.23456789f;
|
||||
for (int i = 1000 - 1; i >= 0; i--)
|
||||
{
|
||||
// 进行一些基本的浮点数运算
|
||||
@@ -38,7 +27,18 @@ namespace Script
|
||||
f = (float)Math.Log10(f);
|
||||
f = (float)Math.Exp(f);
|
||||
}
|
||||
this.frameLabel.text = $"浮点数计算: {f} 服务器帧数: {App.Sync.NServerFrame} 本地运行帧 {App.Sync.NLocalFrame} 本地已执行帧 {App.Sync.NLocalRunFrame} 是否正在请求{App.Sync.IsRequestServerData} FPS:{1f/Time.deltaTime} this.DyTime():{App.Sync.DyTime()}";
|
||||
DontDestroyOnLoad(this.gameObject);
|
||||
}
|
||||
|
||||
//重置
|
||||
public void OnClickReset()
|
||||
{
|
||||
GBattleModeManager.Instance.Open(GBattleMode.Default).Forget();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
this.frameLabel.text = $"{Application.identifier} 浮点数计算: {f} 服务器帧数: {App.Sync.NServerFrame} 本地运行帧 {App.Sync.NLocalFrame} 本地已执行帧 {App.Sync.NLocalRunFrame} 是否正在请求{App.Sync.IsRequestServerData} \nFPS:{1f/Time.deltaTime} \nthis.DyTime():{App.Sync.DyTime()} \n一帧执行时间:{App.Sync.frameTime} \n是否追帧:{App.Sync.IsLoop}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ namespace Script.battle
|
||||
public class GBattleModeManager : SingletonScene<GBattleModeManager>
|
||||
{
|
||||
|
||||
private static readonly string[] Worlds = { "GRVO02World", };
|
||||
private static readonly string[] Worlds = { "RVODemoMode", };
|
||||
|
||||
//当前模式
|
||||
private GBattleMode _current = GBattleMode.Not;
|
||||
|
@@ -24,7 +24,7 @@ namespace Game.Script.battle.mode.Example11_RVO
|
||||
{
|
||||
|
||||
/// <summary>Number of agents created at start</summary>
|
||||
public int agentCount = 100;
|
||||
public int agentCount = 500;
|
||||
/// <summary>All agents handled by this script</summary>
|
||||
List<JNIAgent> agents;
|
||||
/// <summary>Goals for each agent</summary>
|
||||
|
@@ -2,6 +2,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Game.Plugins.JNGame.Sync.Frame.AstarPath.RVO;
|
||||
using Plugins.JNGame.Sync.Frame.AStar;
|
||||
using Plugins.JNGame.Sync.Frame.AStar.Entity;
|
||||
using Script.battle;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -14,8 +15,16 @@ public class GRVO02WorldMode : GBaseMode<Object>
|
||||
|
||||
//初始化寻路
|
||||
[HideInInspector]
|
||||
public JNAStarPath AStar = new();
|
||||
public JNAStarPath AStar;
|
||||
|
||||
//寻路数据
|
||||
public AStarData aStarData;
|
||||
|
||||
|
||||
|
||||
public override void OnSyncLoad()
|
||||
{
|
||||
base.OnSyncLoad();
|
||||
//初始化寻路
|
||||
AStar = new(aStarData);
|
||||
}
|
||||
}
|
||||
|
8
JNFrame/Assets/Game/Script/battle/mode/NavDemo.meta
Normal file
8
JNFrame/Assets/Game/Script/battle/mode/NavDemo.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3003c5de0741eb5469be576d175235d4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,11 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Script.battle;
|
||||
using UnityEngine;
|
||||
|
||||
public class NavDemo1Mode : GBaseMode<Object>
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8ab58234d87b0b49a69949613d0f31e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Game.Plugins.App.Sync;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
|
||||
public class PlayerController : JNGSyncFrameDefault
|
||||
{
|
||||
public override void OnSyncLoad()
|
||||
{
|
||||
this.GetComponent<NavMeshAgent>().SetDestination(new Vector3(10, 0, 10));
|
||||
}
|
||||
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48594c1dc3fb5aa49a018db20d994801
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
JNFrame/Assets/Game/Script/battle/mode/RVO.meta
Normal file
8
JNFrame/Assets/Game/Script/battle/mode/RVO.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3dba20acb72e94d43b26da3e8fdd4938
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
37
JNFrame/Assets/Game/Script/battle/mode/RVO/RVODemoMode.cs
Normal file
37
JNFrame/Assets/Game/Script/battle/mode/RVO/RVODemoMode.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Game.Plugins.App.Game.RVO;
|
||||
using Game.Plugins.JNGame.Sync.Frame.AstarPath.RVO;
|
||||
using Script.battle;
|
||||
using UnityEngine;
|
||||
|
||||
public class RVODemoMode : GBaseMode<Object>
|
||||
{
|
||||
|
||||
//初始化避障
|
||||
public JNRVOSimulator Simulator => GetComponent<JNGRVOManager>().Simulator;
|
||||
|
||||
//随机间隔
|
||||
private int time = 0;
|
||||
|
||||
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
base.OnSyncUpdate(dt, frame, input);
|
||||
|
||||
//随机目标点
|
||||
time -= dt;
|
||||
if (time <= 0)
|
||||
{
|
||||
time = 5000;
|
||||
|
||||
//随机
|
||||
foreach (var child in this.GetComponentsInChildren<JNGRVOAgent>())
|
||||
{
|
||||
child.SetTarget(new Vector2(GetSync().nRandomFloat(-30,30),GetSync().nRandomFloat(-30,30)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4fcb4b90eedbcc4a879eeab339b5b24
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user