mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 10:46:17 +00:00
no message
This commit is contained in:
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