mirror of
https://gitee.com/jisol/jisol-game/
synced 2026-08-24 07:26:10 +00:00
提取RVO 寻路
This commit is contained in:
@@ -8,7 +8,7 @@ namespace Game.Plugins.App
|
||||
|
||||
public static readonly JNGSocket Socket = new JNGSocket();
|
||||
public static readonly JNGSyncFrame Sync = new JNGSyncFrame();
|
||||
public static readonly JAPI Api = new(new JAPIConfig(){BaseURL = "http://127.0.0.1:8080"});
|
||||
public static readonly JAPI Api = new(new JAPIConfig(){BaseURL = "http://192.168.0.116:8080"});
|
||||
public static readonly EventDispatcher Event = EventDispatcher.Event;
|
||||
|
||||
public static SystemBase[] System()
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 78fd52a1d23c49618d1da7e84e276adc
|
||||
timeCreated: 1707121689
|
||||
@@ -0,0 +1,28 @@
|
||||
using Game.Plugins.App.Sync;
|
||||
using Game.Plugins.JNGame.Sync.Frame.AstarPath.RVO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Game.Plugins.App.Game.RVO
|
||||
{
|
||||
//RVO 寻路
|
||||
public class JNGRVOManager : JNGSyncFrameDefault
|
||||
{
|
||||
|
||||
private JNRVOSimulator _simulator = new JNRVOSimulator(MovementPlane.XY);
|
||||
public JNRVOSimulator Simulator => _simulator;
|
||||
|
||||
public override void OnSyncLoad()
|
||||
{
|
||||
base.OnSyncLoad();
|
||||
}
|
||||
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
base.OnSyncUpdate(dt, frame, input);
|
||||
Simulator.DesiredDeltaTime = 1.0f / (1000f / dt);
|
||||
Simulator.symmetryBreakingBias = 0.1f;
|
||||
//更新寻路
|
||||
Simulator.Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9ed6c9606e7b4be7844512656ed3b2cd
|
||||
timeCreated: 1707121704
|
||||
@@ -8,7 +8,7 @@ namespace Game.Plugins.App
|
||||
protected override async UniTask<string> GetUrl()
|
||||
{
|
||||
await UniTask.NextFrame();
|
||||
return "ws://127.0.0.1:8080/websocket";
|
||||
return "ws://192.168.0.116:8080/websocket";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ namespace Game.Plugins.App.Sync
|
||||
}
|
||||
|
||||
public override void OnSyncLoad(){}
|
||||
public override void OnSyncStart(){}
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, T input)
|
||||
{
|
||||
|
||||
|
||||
@@ -8,6 +8,12 @@ namespace Game.Plugins.App.Sync
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnSyncStart()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void OnLateSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
}
|
||||
|
||||
+4
-4
@@ -28,18 +28,18 @@ namespace Pathfinding {
|
||||
// This is enough in theory, but this script will also update the destination every
|
||||
// frame as the destination is used for debugging and may be used for other things by other
|
||||
// scripts as well. So it makes sense that it is up to date every frame.
|
||||
if (ai != null) ai.onSearchPath += OnUpdate;
|
||||
if (ai != null) ai.onSearchPath += OnUpdatePos;
|
||||
}
|
||||
|
||||
void OnDisable () {
|
||||
if (ai != null) ai.onSearchPath -= OnUpdate;
|
||||
if (ai != null) ai.onSearchPath -= OnUpdatePos;
|
||||
}
|
||||
|
||||
/// <summary>Updates the AI's destination every frame</summary>
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
base.OnSyncUpdate(dt, frame, input);
|
||||
this.OnUpdate();
|
||||
this.OnUpdatePos();
|
||||
}
|
||||
|
||||
public void SetTarget(Vector3 pos)
|
||||
@@ -47,7 +47,7 @@ namespace Pathfinding {
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
public void OnUpdate()
|
||||
public void OnUpdatePos()
|
||||
{
|
||||
if (ai != null) ai.destination = pos;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,9 @@ namespace Pathfinding {
|
||||
}
|
||||
|
||||
/// <summary>Update is called once per frame</summary>
|
||||
void Update () {
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
base.OnSyncUpdate(dt, frame, input);
|
||||
if (targets.Length == 0) return;
|
||||
|
||||
// Note: using reachedEndOfPath and pathPending instead of reachedDestination here because
|
||||
|
||||
@@ -374,12 +374,9 @@ namespace Pathfinding {
|
||||
Init();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts searching for paths.
|
||||
/// If you override this method you should in most cases call base.Start () at the start of it.
|
||||
/// See: <see cref="Init"/>
|
||||
/// </summary>
|
||||
protected virtual void Start () {
|
||||
public override void OnSyncStart()
|
||||
{
|
||||
base.OnSyncStart();
|
||||
startHasRun = true;
|
||||
Init();
|
||||
}
|
||||
|
||||
@@ -377,13 +377,16 @@ namespace Pathfinding {
|
||||
seeker.startEndModifier.adjustStartPoint = () => simulatedPosition;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Starts searching for paths.
|
||||
/// If you override this function you should in most cases call base.Start () at the start of it.
|
||||
/// See: <see cref="Init"/>
|
||||
/// See: <see cref="RepeatTrySearchPath"/>
|
||||
/// </summary>
|
||||
protected virtual void Start () {
|
||||
public override void OnSyncStart()
|
||||
{
|
||||
base.OnSyncStart();
|
||||
startHasRun = true;
|
||||
Init();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,9 @@ namespace Pathfinding.Examples {
|
||||
public GraphNode targetNode;
|
||||
public BlockManager.TraversalProvider traversalProvider;
|
||||
|
||||
void Start () {
|
||||
public override void OnSyncStart()
|
||||
{
|
||||
base.OnSyncStart();
|
||||
blocker.BlockAtCurrentPosition();
|
||||
}
|
||||
|
||||
|
||||
@@ -988,7 +988,12 @@ public class AstarPath : VersionedMonoBehaviour {
|
||||
// and then processes the graph updates
|
||||
AddWorkItem(new AstarWorkItem(() => {
|
||||
graphUpdatesWorkItemAdded = false;
|
||||
lastGraphUpdate = Time.realtimeSinceStartup;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
lastGraphUpdate = Time.realtimeSinceStartup;
|
||||
#else
|
||||
lastGraphUpdate = GetSync().Time.realtimeSinceStartup;
|
||||
#endif
|
||||
|
||||
workItem.init();
|
||||
}, workItem.update));
|
||||
|
||||
@@ -130,8 +130,11 @@ namespace Pathfinding {
|
||||
[UnityEngine.Serialization.FormerlySerializedAs("useWorldSpace")]
|
||||
private bool legacyUseWorldSpace;
|
||||
|
||||
|
||||
/// <summary>Do some stuff at start</summary>
|
||||
public void Start () {
|
||||
public override void OnSyncStart()
|
||||
{
|
||||
base.OnSyncStart();
|
||||
if (!Application.isPlaying) return;
|
||||
|
||||
// If firstApplied is true, that means the graph was scanned during Awake.
|
||||
@@ -140,7 +143,7 @@ namespace Pathfinding {
|
||||
Apply();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void OnPostScan () {
|
||||
if (applyOnScan) Apply();
|
||||
}
|
||||
|
||||
@@ -91,7 +91,9 @@ namespace Pathfinding {
|
||||
float graphHeight = 100;
|
||||
float graphOffset = 50;
|
||||
|
||||
public void Start () {
|
||||
public override void OnSyncStart()
|
||||
{
|
||||
base.OnSyncStart();
|
||||
useGUILayout = false;
|
||||
|
||||
fpsDrops = new float[fpsDropCounterSize];
|
||||
|
||||
@@ -2,6 +2,7 @@ using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Plugins.JNGame.Sync.Frame.Entity;
|
||||
using UnityEngine.Profiling;
|
||||
|
||||
namespace Pathfinding {
|
||||
@@ -298,7 +299,7 @@ namespace Pathfinding {
|
||||
// One tick is 1/10000 of a millisecond.
|
||||
// We need to check once in a while if the thread should be stopped.
|
||||
long maxTicks = (long)(10*10000);
|
||||
long targetTick = System.DateTime.UtcNow.Ticks + maxTicks;
|
||||
long targetTick = JNTime.Time.Ticks + maxTicks;
|
||||
while (true) {
|
||||
// The path we are currently calculating
|
||||
Path path = queue.Pop();
|
||||
@@ -321,7 +322,7 @@ namespace Pathfinding {
|
||||
}
|
||||
|
||||
// Tick for when the path started, used for calculating how long time the calculation took
|
||||
long startTicks = System.DateTime.UtcNow.Ticks;
|
||||
long startTicks = JNTime.Time.Ticks;
|
||||
|
||||
// Prepare the path
|
||||
ipath.Prepare();
|
||||
@@ -344,7 +345,7 @@ namespace Pathfinding {
|
||||
// or when it has finished calculation
|
||||
ipath.CalculateStep(targetTick);
|
||||
|
||||
targetTick = System.DateTime.UtcNow.Ticks + maxTicks;
|
||||
targetTick = JNTime.Time.Ticks + maxTicks;
|
||||
|
||||
// Cancel function (and thus the thread) if no more paths should be accepted.
|
||||
// This is done when the A* object is about to be destroyed
|
||||
@@ -354,11 +355,11 @@ namespace Pathfinding {
|
||||
}
|
||||
}
|
||||
|
||||
path.duration = (System.DateTime.UtcNow.Ticks - startTicks)*0.0001F;
|
||||
path.duration = (JNTime.Time.Ticks - startTicks)*0.0001F;
|
||||
|
||||
#if ProfileAstar
|
||||
System.Threading.Interlocked.Increment(ref AstarPath.PathsCompleted);
|
||||
System.Threading.Interlocked.Add(ref AstarPath.TotalSearchTime, System.DateTime.UtcNow.Ticks - startTicks);
|
||||
System.Threading.Interlocked.Add(ref AstarPath.TotalSearchTime, JNTime.Time.Ticks - startTicks);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -421,7 +422,7 @@ namespace Pathfinding {
|
||||
IEnumerator CalculatePaths (PathHandler pathHandler) {
|
||||
// Max number of ticks before yielding/sleeping
|
||||
long maxTicks = (long)(astar.maxFrameTime*10000);
|
||||
long targetTick = System.DateTime.UtcNow.Ticks + maxTicks;
|
||||
long targetTick = JNTime.Time.Ticks + maxTicks;
|
||||
|
||||
while (true) {
|
||||
// The path we are currently calculating
|
||||
@@ -463,7 +464,7 @@ namespace Pathfinding {
|
||||
if (tmpOnPathPreSearch != null) tmpOnPathPreSearch(p);
|
||||
|
||||
// Tick for when the path started, used for calculating how long time the calculation took
|
||||
long startTicks = System.DateTime.UtcNow.Ticks;
|
||||
long startTicks = JNTime.Time.Ticks;
|
||||
long totalTicks = 0;
|
||||
|
||||
|
||||
@@ -493,12 +494,12 @@ namespace Pathfinding {
|
||||
// Improves latency
|
||||
if (p.CompleteState != PathCompleteState.NotCalculated) break;
|
||||
|
||||
totalTicks += System.DateTime.UtcNow.Ticks-startTicks;
|
||||
totalTicks += JNTime.Time.Ticks-startTicks;
|
||||
// Yield/sleep so other threads can work
|
||||
|
||||
yield return null;
|
||||
|
||||
startTicks = System.DateTime.UtcNow.Ticks;
|
||||
startTicks = JNTime.Time.Ticks;
|
||||
|
||||
// Cancel function (and thus the thread) if no more paths should be accepted.
|
||||
// This is done when the A* object is about to be destroyed
|
||||
@@ -507,10 +508,10 @@ namespace Pathfinding {
|
||||
p.FailWithError("AstarPath object destroyed");
|
||||
}
|
||||
|
||||
targetTick = System.DateTime.UtcNow.Ticks + maxTicks;
|
||||
targetTick = JNTime.Time.Ticks + maxTicks;
|
||||
}
|
||||
|
||||
totalTicks += System.DateTime.UtcNow.Ticks-startTicks;
|
||||
totalTicks += JNTime.Time.Ticks-startTicks;
|
||||
p.duration = totalTicks*0.0001F;
|
||||
|
||||
#if ProfileAstar
|
||||
@@ -541,9 +542,9 @@ namespace Pathfinding {
|
||||
|
||||
|
||||
// Wait a bit if we have calculated a lot of paths
|
||||
if (System.DateTime.UtcNow.Ticks > targetTick) {
|
||||
if (JNTime.Time.Ticks > targetTick) {
|
||||
yield return null;
|
||||
targetTick = System.DateTime.UtcNow.Ticks + maxTicks;
|
||||
targetTick = JNTime.Time.Ticks + maxTicks;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using Plugins.JNGame.Sync.Frame.Entity;
|
||||
using UnityEngine.Profiling;
|
||||
|
||||
namespace Pathfinding {
|
||||
@@ -36,7 +37,7 @@ namespace Pathfinding {
|
||||
Profiler.BeginSample("Calling Path Callbacks");
|
||||
|
||||
// Hard coded limit on 1.0 ms
|
||||
long targetTick = timeSlice ? System.DateTime.UtcNow.Ticks + 1 * 10000 : 0;
|
||||
long targetTick = timeSlice ? JNTime.Time.Ticks + 1 * 10000 : 0;
|
||||
|
||||
int counter = 0;
|
||||
// Loop through the linked list and return all paths
|
||||
@@ -66,7 +67,7 @@ namespace Pathfinding {
|
||||
// At least 5 paths will be returned, even if timeSlice is enabled
|
||||
if (counter > 5 && timeSlice) {
|
||||
counter = 0;
|
||||
if (System.DateTime.UtcNow.Ticks >= targetTick) {
|
||||
if (JNTime.Time.Ticks >= targetTick) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -446,14 +446,12 @@ namespace Pathfinding.RVO.Sampled {
|
||||
public static VO SegmentObstacle (Vector2 segmentStart, Vector2 segmentEnd, Vector2 offset, float radius, float inverseDt, float inverseDeltaTime) {
|
||||
var vo = new VO();
|
||||
|
||||
// Adjusted so that a parameter weightFactor of 1 will be the default ("natural") weight factor
|
||||
vo.weightFactor = 1;
|
||||
// Just higher than anything else
|
||||
vo.weightBonus = Mathf.Max(radius, 1)*40;
|
||||
|
||||
var closestOnSegment = VectorMath.ClosestPointOnSegment(segmentStart, segmentEnd, Vector2.zero);
|
||||
|
||||
// Collision?
|
||||
if (closestOnSegment.magnitude <= radius) {
|
||||
vo.colliding = true;
|
||||
|
||||
@@ -482,8 +480,6 @@ namespace Pathfinding.RVO.Sampled {
|
||||
vo.cutoffLine = segmentStart + new Vector2(-cutoffTangent.y, cutoffTangent.x) * radius;
|
||||
vo.cutoffLine += offset;
|
||||
|
||||
// See documentation for details
|
||||
// The call to Max is just to prevent floating point errors causing NaNs to appear
|
||||
var startSqrMagnitude = segmentStart.sqrMagnitude;
|
||||
var normal1 = -VectorMath.ComplexMultiply(segmentStart, new Vector2(radius, Mathf.Sqrt(Mathf.Max(0, startSqrMagnitude - radius*radius)))) / startSqrMagnitude;
|
||||
var endSqrMagnitude = segmentEnd.sqrMagnitude;
|
||||
@@ -492,7 +488,6 @@ namespace Pathfinding.RVO.Sampled {
|
||||
vo.line1 = segmentStart + normal1 * radius + offset;
|
||||
vo.line2 = segmentEnd + normal2 * radius + offset;
|
||||
|
||||
// Note that the normals are already normalized
|
||||
vo.dir1 = new Vector2(normal1.y, -normal1.x);
|
||||
vo.dir2 = new Vector2(normal2.y, -normal2.x);
|
||||
|
||||
|
||||
@@ -314,7 +314,10 @@ namespace Pathfinding.RVO {
|
||||
public float DeltaTime { get { return deltaTime; } }
|
||||
|
||||
/// <summary>Is using multithreading</summary>
|
||||
public bool Multithreading { get { return workers != null && workers.Length > 0; } }
|
||||
public bool Multithreading
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Time in seconds between each simulation step.
|
||||
@@ -722,7 +725,7 @@ namespace Pathfinding.RVO {
|
||||
doUpdateObstacles = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Should be called once per frame</summary>
|
||||
public void Update () {
|
||||
// Initialize last step
|
||||
|
||||
+3
-1
@@ -24,7 +24,9 @@ namespace Pathfinding.Examples {
|
||||
|
||||
Camera cam;
|
||||
|
||||
public void Start () {
|
||||
public override void OnSyncStart()
|
||||
{
|
||||
base.OnSyncStart();
|
||||
cam = Camera.main;
|
||||
var simu = RVOSimulator.active;
|
||||
if (simu == null) {
|
||||
|
||||
+7
-2
@@ -89,7 +89,10 @@ namespace Pathfinding.Examples {
|
||||
Vector2[] interpolatedVelocities;
|
||||
Vector2[] interpolatedRotations;
|
||||
|
||||
public void Start () {
|
||||
|
||||
public override void OnSyncStart()
|
||||
{
|
||||
base.OnSyncStart();
|
||||
mesh = new Mesh();
|
||||
RVOSimulator rvoSim = FindObjectOfType(typeof(RVOSimulator)) as RVOSimulator;
|
||||
if (rvoSim == null) {
|
||||
@@ -230,7 +233,9 @@ namespace Pathfinding.Examples {
|
||||
}
|
||||
}
|
||||
|
||||
public void Update () {
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
base.OnSyncUpdate(dt, frame, input);
|
||||
if (agents == null || mesh == null) return;
|
||||
|
||||
if (agents.Count != goals.Count) {
|
||||
|
||||
+6
-5
@@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using Game.Plugins.App.Sync;
|
||||
|
||||
namespace Pathfinding.Examples {
|
||||
/// <summary>
|
||||
@@ -7,7 +8,7 @@ namespace Pathfinding.Examples {
|
||||
/// Used in a example scene
|
||||
/// </summary>
|
||||
[HelpURL("https://arongranberg.com/astar/documentation/stable/class_pathfinding_1_1_examples_1_1_r_v_o_agent_placer.php")]
|
||||
public class RVOAgentPlacer : MonoBehaviour {
|
||||
public class RVOAgentPlacer : JNGSyncFrameDefault {
|
||||
public int agents = 100;
|
||||
|
||||
public float ringSize = 100;
|
||||
@@ -19,9 +20,9 @@ namespace Pathfinding.Examples {
|
||||
|
||||
public float repathRate = 1;
|
||||
|
||||
// Use this for initialization
|
||||
IEnumerator Start () {
|
||||
yield return null;
|
||||
public override void OnSyncStart()
|
||||
{
|
||||
base.OnSyncStart();
|
||||
|
||||
for (int i = 0; i < agents; i++) {
|
||||
float angle = ((float)i / agents)*(float)System.Math.PI*2;
|
||||
@@ -34,7 +35,7 @@ namespace Pathfinding.Examples {
|
||||
|
||||
if (ag == null) {
|
||||
Debug.LogError("Prefab does not have an RVOExampleAgent component attached");
|
||||
yield break;
|
||||
return;
|
||||
}
|
||||
|
||||
//ag.radius = radius;
|
||||
|
||||
+3
-1
@@ -125,7 +125,9 @@ namespace Pathfinding.Examples {
|
||||
}
|
||||
}
|
||||
|
||||
public void Update () {
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
base.OnSyncUpdate(dt, frame, input);
|
||||
if (GetSync().Time.time >= nextRepath && canSearchAgain) {
|
||||
RecalculatePath();
|
||||
}
|
||||
|
||||
+9
-5
@@ -1,11 +1,12 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Game.Plugins.App.Sync;
|
||||
|
||||
namespace Pathfinding.Examples {
|
||||
/// <summary>Example script for generating an infinite procedural world</summary>
|
||||
[HelpURL("https://arongranberg.com/astar/documentation/stable/class_pathfinding_1_1_examples_1_1_procedural_world.php")]
|
||||
public class ProceduralWorld : MonoBehaviour {
|
||||
public class ProceduralWorld : JNGSyncFrameDefault {
|
||||
public Transform target;
|
||||
|
||||
public ProceduralPrefab[] prefabs;
|
||||
@@ -78,17 +79,20 @@ namespace Pathfinding.Examples {
|
||||
Dictionary<Int2, ProceduralTile> tiles = new Dictionary<Int2, ProceduralTile>();
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
public override void OnSyncStart()
|
||||
{
|
||||
base.OnSyncStart();
|
||||
// Calculate the closest tiles
|
||||
// and then recalculate the graph
|
||||
Update();
|
||||
// UnityEngine.PlayerLoop.Update();
|
||||
AstarPath.active.Scan();
|
||||
|
||||
StartCoroutine(GenerateTiles());
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
base.OnSyncUpdate(dt, frame, input);
|
||||
// Calculate the tile the target is standing on
|
||||
Int2 p = new Int2(Mathf.RoundToInt((target.position.x - tileSize*0.5f) / tileSize), Mathf.RoundToInt((target.position.z - tileSize*0.5f) / tileSize));
|
||||
|
||||
|
||||
+3
-2
@@ -48,8 +48,9 @@ namespace Pathfinding.Examples {
|
||||
return Vector3.Cross(derivate, secondDerivative) / (dx*dx*dx);
|
||||
}
|
||||
|
||||
/// <summary>Update is called once per frame</summary>
|
||||
void Update () {
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
base.OnSyncUpdate(dt, frame, input);
|
||||
// Move the agent a small distance along the path, according to its speed
|
||||
float mn = time;
|
||||
float mx = time+1;
|
||||
|
||||
+3
-1
@@ -8,7 +8,9 @@ namespace Pathfinding {
|
||||
Matrix4x4 originalMatrix;
|
||||
public GraphTransform transformation { get; private set; }
|
||||
|
||||
void Start () {
|
||||
public override void OnSyncLoad()
|
||||
{
|
||||
base.OnSyncLoad();
|
||||
originalMatrix = transform.worldToLocalMatrix;
|
||||
transform.hasChanged = true;
|
||||
Refresh();
|
||||
|
||||
+3
-2
@@ -41,9 +41,10 @@ namespace Pathfinding.Examples {
|
||||
movementPlane = graph.transformation;
|
||||
}
|
||||
|
||||
protected override void Start () {
|
||||
public override void OnSyncStart()
|
||||
{
|
||||
RefreshTransform();
|
||||
base.Start();
|
||||
base.OnSyncStart();
|
||||
}
|
||||
|
||||
protected override void CalculatePathRequestEndpoints (out Vector3 start, out Vector3 end) {
|
||||
|
||||
+10
-4
@@ -1,31 +1,37 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Game.Plugins.App.Sync;
|
||||
|
||||
namespace Pathfinding.Examples {
|
||||
/// <summary>Helper script in the example scene 'Turn Based'</summary>
|
||||
[RequireComponent(typeof(Animator))]
|
||||
[RequireComponent(typeof(SingleNodeBlocker))]
|
||||
[HelpURL("https://arongranberg.com/astar/documentation/stable/class_pathfinding_1_1_examples_1_1_turn_based_door.php")]
|
||||
public class TurnBasedDoor : MonoBehaviour {
|
||||
public class TurnBasedDoor : JNGSyncFrameDefault {
|
||||
Animator animator;
|
||||
SingleNodeBlocker blocker;
|
||||
|
||||
bool open;
|
||||
|
||||
void Awake () {
|
||||
|
||||
public override void OnSyncLoad()
|
||||
{
|
||||
base.OnSyncLoad();
|
||||
animator = GetComponent<Animator>();
|
||||
blocker = GetComponent<SingleNodeBlocker>();
|
||||
}
|
||||
|
||||
void Start () {
|
||||
public override void OnSyncStart()
|
||||
{
|
||||
base.OnSyncStart();
|
||||
// Make sure the door starts out blocked
|
||||
blocker.BlockAtCurrentPosition();
|
||||
animator.CrossFade("close", 0.2f);
|
||||
}
|
||||
|
||||
public void Close () {
|
||||
StartCoroutine(WaitAndClose());
|
||||
// StartCoroutine(WaitAndClose());
|
||||
}
|
||||
|
||||
IEnumerator WaitAndClose () {
|
||||
|
||||
+3
-1
@@ -31,7 +31,9 @@ namespace Pathfinding.Examples {
|
||||
eventSystem = FindObjectOfType<EventSystem>();
|
||||
}
|
||||
|
||||
void Update () {
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
base.OnSyncUpdate(dt, frame, input);
|
||||
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
|
||||
// Ignore any input while the mouse is over a UI element
|
||||
|
||||
+11
-4
@@ -1,22 +1,29 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using Game.Plugins.App.Sync;
|
||||
|
||||
namespace Pathfinding.Examples {
|
||||
[HelpURL("https://arongranberg.com/astar/documentation/stable/class_pathfinding_1_1_examples_1_1_example_mover.php")]
|
||||
public class ExampleMover : MonoBehaviour {
|
||||
public class ExampleMover : JNGSyncFrameDefault {
|
||||
RVOExampleAgent agent;
|
||||
public Transform target;
|
||||
|
||||
// Use this for initialization
|
||||
void Awake () {
|
||||
public override void OnSyncLoad()
|
||||
{
|
||||
base.OnSyncLoad();
|
||||
agent = GetComponent<RVOExampleAgent>();
|
||||
}
|
||||
|
||||
void Start () {
|
||||
public override void OnSyncStart()
|
||||
{
|
||||
base.OnSyncStart();
|
||||
agent.SetTarget(target.position);
|
||||
}
|
||||
|
||||
void LateUpdate () {
|
||||
public override void OnLateSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
base.OnLateSyncUpdate(dt, frame, input);
|
||||
if (Input.GetKeyDown(KeyCode.Mouse0)) {
|
||||
agent.SetTarget(target.position);
|
||||
}
|
||||
|
||||
+5
-2
@@ -1,6 +1,7 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Game.Plugins.App.Sync;
|
||||
using Pathfinding.Util;
|
||||
namespace Pathfinding.Examples {
|
||||
/// <summary>
|
||||
@@ -17,7 +18,7 @@ namespace Pathfinding.Examples {
|
||||
/// See: Pathfinding.FloodPathTracer
|
||||
/// </summary>
|
||||
[HelpURL("https://arongranberg.com/astar/documentation/stable/class_pathfinding_1_1_examples_1_1_path_types_demo.php")]
|
||||
public class PathTypesDemo : MonoBehaviour {
|
||||
public class PathTypesDemo : JNGSyncFrameDefault {
|
||||
public DemoMode activeDemo = DemoMode.ABPath;
|
||||
|
||||
public enum DemoMode {
|
||||
@@ -64,7 +65,9 @@ namespace Pathfinding.Examples {
|
||||
List<Vector3> multipoints = new List<Vector3>();
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
base.OnSyncUpdate(dt, frame, input);
|
||||
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
|
||||
// Find the intersection with the y=0 plane
|
||||
|
||||
+5
-2
@@ -1,9 +1,10 @@
|
||||
using Game.Plugins.App.Sync;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Pathfinding.Examples {
|
||||
/// <summary>Example script used in the example scenes</summary>
|
||||
[HelpURL("https://arongranberg.com/astar/documentation/stable/class_pathfinding_1_1_examples_1_1_door_controller.php")]
|
||||
public class DoorController : MonoBehaviour {
|
||||
public class DoorController : JNGSyncFrameDefault {
|
||||
private bool open = false;
|
||||
|
||||
public int opentag = 1;
|
||||
@@ -13,7 +14,9 @@ namespace Pathfinding.Examples {
|
||||
|
||||
Bounds bounds;
|
||||
|
||||
public void Start () {
|
||||
public override void OnSyncStart()
|
||||
{
|
||||
base.OnSyncStart();
|
||||
// Capture the bounds of the collider while it is closed
|
||||
bounds = GetComponent<Collider>().bounds;
|
||||
|
||||
|
||||
+5
-2
@@ -1,3 +1,4 @@
|
||||
using Game.Plugins.App.Sync;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Pathfinding {
|
||||
@@ -19,10 +20,12 @@ namespace Pathfinding {
|
||||
/// </summary>
|
||||
[AddComponentMenu("Pathfinding/Navmesh/RecastTileUpdate")]
|
||||
[HelpURL("https://arongranberg.com/astar/documentation/stable/class_pathfinding_1_1_recast_tile_update.php")]
|
||||
public class RecastTileUpdate : MonoBehaviour {
|
||||
public class RecastTileUpdate : JNGSyncFrameDefault {
|
||||
public static event System.Action<Bounds> OnNeedUpdates;
|
||||
|
||||
void Start () {
|
||||
public override void OnSyncStart()
|
||||
{
|
||||
base.OnSyncStart();
|
||||
ScheduleUpdate();
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using Game.Plugins.App.Sync;
|
||||
using Pathfinding;
|
||||
|
||||
namespace Pathfinding.Examples {
|
||||
@@ -9,8 +10,10 @@ namespace Pathfinding.Examples {
|
||||
/// </summary>
|
||||
[ExecuteInEditMode]
|
||||
[HelpURL("https://arongranberg.com/astar/documentation/stable/class_snap_to_node.php")]
|
||||
public class SnapToNode : MonoBehaviour {
|
||||
void Update () {
|
||||
public class SnapToNode : JNGSyncFrameDefault {
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
base.OnSyncUpdate(dt, frame, input);
|
||||
if (transform.hasChanged && AstarPath.active != null) {
|
||||
var node = AstarPath.active.GetNearest(transform.position, NNConstraint.None).node;
|
||||
if (node != null) {
|
||||
|
||||
+7
-3
@@ -25,7 +25,9 @@ namespace Pathfinding {
|
||||
|
||||
Camera cam;
|
||||
|
||||
public void Start () {
|
||||
public override void OnSyncStart()
|
||||
{
|
||||
base.OnSyncStart();
|
||||
//Cache the Main Camera
|
||||
cam = Camera.main;
|
||||
// Slightly inefficient way of finding all AIs, but this is just an example script, so it doesn't matter much.
|
||||
@@ -41,12 +43,14 @@ namespace Pathfinding {
|
||||
}
|
||||
|
||||
/// <summary>Update is called once per frame</summary>
|
||||
void Update () {
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
base.OnSyncUpdate(dt, frame, input);
|
||||
if (!onlyOnDoubleClick && cam != null) {
|
||||
UpdateTargetPosition();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void UpdateTargetPosition () {
|
||||
Vector3 newPosition = Vector3.zero;
|
||||
bool positionFound = false;
|
||||
|
||||
+2
-2
@@ -211,9 +211,9 @@ namespace Pathfinding {
|
||||
/// <param name="label">Label to display</param>
|
||||
/// <param name="selected">Current LayerMask</param>
|
||||
public static LayerMask LayerMaskField (string label, LayerMask selected) {
|
||||
if (Event.current.type == EventType.Layout && System.DateTime.UtcNow.Ticks - lastUpdateTick > 10000000L) {
|
||||
if (Event.current.type == EventType.Layout && JNTime.Time.Ticks - lastUpdateTick > 10000000L) {
|
||||
layerNames.Clear();
|
||||
lastUpdateTick = System.DateTime.UtcNow.Ticks;
|
||||
lastUpdateTick = JNTime.Time.Ticks;
|
||||
}
|
||||
|
||||
string[] currentLayerNames;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using Plugins.JNGame.Sync.Frame.Entity;
|
||||
|
||||
namespace Pathfinding {
|
||||
/// <summary>
|
||||
@@ -613,7 +614,7 @@ namespace Pathfinding {
|
||||
/// <summary>
|
||||
/// Calculates the path until completed or until the time has passed targetTick.
|
||||
/// Usually a check is only done every 500 nodes if the time has passed targetTick.
|
||||
/// Time/Ticks are got from System.DateTime.UtcNow.Ticks.
|
||||
/// Time/Ticks are got from JNTime.Time.Ticks.
|
||||
///
|
||||
/// Basic outline of what the function does for the standard path (Pathfinding.ABPath).
|
||||
/// <code>
|
||||
@@ -670,7 +671,7 @@ namespace Pathfinding {
|
||||
// Check for time every 500 nodes, roughly every 0.5 ms usually
|
||||
if (counter > 500) {
|
||||
// Have we exceded the maxFrameTime, if so we should wait one frame before continuing the search since we don't want the game to lag
|
||||
if (System.DateTime.UtcNow.Ticks >= targetTick) {
|
||||
if (JNTime.Time.Ticks >= targetTick) {
|
||||
// Return instead of yield'ing, a separate function handles the yield (CalculatePaths)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using Plugins.JNGame.Sync.Frame.Entity;
|
||||
|
||||
namespace Pathfinding {
|
||||
/// <summary>
|
||||
@@ -598,7 +599,7 @@ namespace Pathfinding {
|
||||
// Check for time every 500 nodes, roughly every 0.5 ms usually
|
||||
if (counter > 500) {
|
||||
// Have we exceded the maxFrameTime, if so we should wait one frame before continuing the search since we don't want the game to lag
|
||||
if (System.DateTime.UtcNow.Ticks >= targetTick) {
|
||||
if (JNTime.Time.Ticks >= targetTick) {
|
||||
// Return instead of yield'ing, a separate function handles the yield (CalculatePaths)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Plugins.JNGame.Sync.Frame.Entity;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Pathfinding {
|
||||
@@ -260,7 +261,7 @@ namespace Pathfinding {
|
||||
// Check for time every 500 nodes, roughly every 0.5 ms usually
|
||||
if (counter > 500) {
|
||||
// Have we exceded the maxFrameTime, if so we should wait one frame before continuing the search since we don't want the game to lag
|
||||
if (System.DateTime.UtcNow.Ticks >= targetTick) {
|
||||
if (JNTime.Time.Ticks >= targetTick) {
|
||||
// Return instead of yield'ing, a separate function handles the yield (CalculatePaths)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Plugins.JNGame.Sync.Frame.Entity;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Pathfinding {
|
||||
@@ -102,7 +103,7 @@ namespace Pathfinding {
|
||||
// Check for time every 500 nodes, roughly every 0.5 ms usually
|
||||
if (counter > 500) {
|
||||
// Have we exceded the maxFrameTime, if so we should wait one frame before continuing the search since we don't want the game to lag
|
||||
if (System.DateTime.UtcNow.Ticks >= targetTick) {
|
||||
if (JNTime.Time.Ticks >= targetTick) {
|
||||
//Return instead of yield'ing, a separate function handles the yield (CalculatePaths)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -201,7 +201,9 @@ namespace Pathfinding.RVO {
|
||||
}
|
||||
|
||||
/// <summary>Creates obstacles</summary>
|
||||
public void Start () {
|
||||
public override void OnSyncStart()
|
||||
{
|
||||
base.OnSyncStart();
|
||||
addedObstacles = new List<ObstacleVertex>();
|
||||
sourceObstacles = new List<Vector3[]>();
|
||||
prevUpdateMatrix = GetMatrix();
|
||||
@@ -212,7 +214,9 @@ namespace Pathfinding.RVO {
|
||||
/// Updates obstacle if required.
|
||||
/// Checks for if the obstacle should be updated (e.g if it has moved)
|
||||
/// </summary>
|
||||
public void Update () {
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
base.OnSyncUpdate(dt, frame, input);
|
||||
Matrix4x4 m = GetMatrix();
|
||||
|
||||
if (m != prevUpdateMatrix) {
|
||||
@@ -223,7 +227,6 @@ namespace Pathfinding.RVO {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Finds a simulator in the scene.
|
||||
///
|
||||
|
||||
@@ -75,7 +75,9 @@ namespace Pathfinding {
|
||||
#endregion
|
||||
}
|
||||
|
||||
void Start () {
|
||||
public override void OnSyncStart()
|
||||
{
|
||||
base.OnSyncStart();
|
||||
if (!AstarPath.active)
|
||||
throw new System.Exception("No AstarPath object in the scene");
|
||||
}
|
||||
|
||||
+7
-3
@@ -69,7 +69,9 @@ namespace Pathfinding {
|
||||
[HideInInspector]
|
||||
public int graphIndex;
|
||||
|
||||
void Start () {
|
||||
public override void OnSyncStart()
|
||||
{
|
||||
base.OnSyncStart();
|
||||
if (AstarPath.active == null) throw new System.Exception("There is no AstarPath object in the scene");
|
||||
|
||||
// If one creates this component via a script then they may have already set the graph field.
|
||||
@@ -84,9 +86,11 @@ namespace Pathfinding {
|
||||
|
||||
UpdateGraph();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Update is called once per frame</summary>
|
||||
void Update () {
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
base.OnSyncUpdate(dt, frame, input);
|
||||
if (graph == null) return;
|
||||
|
||||
// Calculate where the graph center and the target position is in graph space
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb52241f50642ec4481571bf105f15cc
|
||||
guid: 9fcc24a8c5f74ee29f3ae27768122f30
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Game.Plugins.JNGame.Sync.Frame.AstarPath
|
||||
{
|
||||
public class JNAStarBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3417f25b3114ecc8e596be23f70851f
|
||||
timeCreated: 1707104675
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
namespace Game.Plugins.JNGame.Sync.Frame.AstarPath
|
||||
{
|
||||
/**
|
||||
* 寻路类
|
||||
*/
|
||||
public class JNAStarPath
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79d7cad08d874b6aba4388770d624c79
|
||||
timeCreated: 1707104391
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a19843b56634bfca2b3e6234c425d8a
|
||||
timeCreated: 1707102377
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 821e5ded88f4428a9b5aad0aed6ffd1a
|
||||
timeCreated: 1707114274
|
||||
@@ -0,0 +1,45 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Game.Plugins.JNGame.Sync.Frame.AstarPath.RVO
|
||||
{
|
||||
/// <summary>
|
||||
/// 一个障碍物中的顶点。
|
||||
/// 这是一个链表,因此一个顶点可以用来引用整个障碍物。
|
||||
/// </summary>
|
||||
public class JNObstacleVertex {
|
||||
/// <summary>
|
||||
/// 指示是否忽略此顶点的布尔值。
|
||||
/// </summary>
|
||||
public bool ignore;
|
||||
|
||||
/// <summary>
|
||||
/// 顶点的位置。
|
||||
/// </summary>
|
||||
public Vector3 position; // 顶点的三维位置。
|
||||
|
||||
/// <summary>
|
||||
/// 顶点的方向或法线。
|
||||
/// </summary>
|
||||
public Vector2 dir; // 顶点的二维方向或法线。
|
||||
|
||||
/// <summary>
|
||||
/// 在此顶点上的障碍物的高度。
|
||||
/// </summary>
|
||||
public float height; // 障碍物的高度。
|
||||
|
||||
/// <summary>
|
||||
/// 此障碍物的碰撞层。
|
||||
/// </summary>
|
||||
public JNRVOLayer layer = JNRVOLayer.DefaultObstacle; // 障碍物的碰撞层,默认为默认障碍物层。
|
||||
|
||||
/// <summary>
|
||||
/// 在障碍物中指向下一个顶点的引用。
|
||||
/// </summary>
|
||||
public JNObstacleVertex next; // 指向下一个顶点的引用。
|
||||
|
||||
/// <summary>
|
||||
/// 在障碍物中指向上一个顶点的引用。
|
||||
/// </summary>
|
||||
public JNObstacleVertex prev; // 指向上一个顶点的引用。
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4aedb5e02e7a44d38eea97702c35fdc7
|
||||
timeCreated: 1707113948
|
||||
@@ -0,0 +1,246 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Game.Plugins.JNGame.Sync.Frame.AstarPath.RVO
|
||||
{
|
||||
/// <summary>
|
||||
/// 用于快速寻找RVO代理的最近邻居的四叉树。
|
||||
/// 详见:Pathfinding.RVO.Simulator
|
||||
/// </summary>
|
||||
public class JNRVOQuadtree
|
||||
{
|
||||
|
||||
const int LeafSize = 15;
|
||||
float maxRadius = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 用于存储RVO代理的四叉树的节点。
|
||||
/// 详见:Pathfinding.GraphNode,该节点类用于存储路径查找数据。
|
||||
/// </summary>
|
||||
struct Node {
|
||||
|
||||
public int child00; // 可能是一个指向子节点的引用或索引。
|
||||
public JNRVOAgent linkedList; // 代理链表的头节点。
|
||||
public byte count; // 该节点中的代理数量。
|
||||
public float maxSpeed; // 该节点中的代理的最大速度。
|
||||
|
||||
public void Add(JNRVOAgent agent) { // 添加新的代理到链表的尾部的方法。
|
||||
agent.next = linkedList; // 将新代理的next指向当前的链表头。
|
||||
linkedList = agent; // 将链表头更新为新代理。
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将代理分配到子节点中。
|
||||
/// 用于将一个节点中的代理分发到其子节点中。通常在节点被分割后使用。
|
||||
/// </summary>
|
||||
public void Distribute(Node[] nodes, Rect r) {
|
||||
Vector2 c = r.center; // 获取矩形的中心点
|
||||
|
||||
while (linkedList != null) { // 当代理链表不为空时
|
||||
JNRVOAgent nx = linkedList.next; // 保存下一个代理的引用
|
||||
var index = child00 + (linkedList.position.x > c.x ? 2 : 0) + (linkedList.position.y > c.y ? 1 : 0); // 计算代理应该分配到的子节点的索引
|
||||
nodes[index].Add(linkedList); // 将代理添加到对应的子节点中
|
||||
linkedList = nx; // 移动到链表中的下一个代理
|
||||
}
|
||||
count = 0; // 重置代理计数器
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算节点的最大速度。
|
||||
/// 用于计算一个节点及其所有子节点的最大速度。
|
||||
/// </summary>
|
||||
public float CalculateMaxSpeed(Node[] nodes, int index) {
|
||||
if (child00 == index) { // 如果当前节点是叶节点
|
||||
// 遍历叶节点中的所有代理,找到最大的速度
|
||||
for (var agent = linkedList; agent != null; agent = agent.next) {
|
||||
maxSpeed = Math.Max(maxSpeed, agent.CalculatedSpeed);
|
||||
}
|
||||
} else { // 如果当前节点不是叶节点
|
||||
maxSpeed = Math.Max(nodes[child00].CalculateMaxSpeed(nodes, child00), nodes[child00+1].CalculateMaxSpeed(nodes, child00+1)); // 分别计算两个子节点的最大速度,取两者中的最大值
|
||||
maxSpeed = Math.Max(maxSpeed, nodes[child00+2].CalculateMaxSpeed(nodes, child00+2)); // 计算第三个子节点的最大速度,并与之前的最大值比较并更新
|
||||
maxSpeed = Math.Max(maxSpeed, nodes[child00+3].CalculateMaxSpeed(nodes, child00+3)); // 计算第四个子节点的最大速度,并与之前的最大值比较并更新
|
||||
}
|
||||
return maxSpeed; // 返回计算得到的最大速度
|
||||
}
|
||||
}
|
||||
|
||||
Node[] nodes = new Node[16];
|
||||
int filledNodes = 1;
|
||||
|
||||
Rect bounds;
|
||||
|
||||
/// <summary>从树中移除所有代理</summary>
|
||||
public void Clear() {
|
||||
nodes[0] = new Node();
|
||||
filledNodes = 1;
|
||||
maxRadius = 0;
|
||||
}
|
||||
|
||||
public void SetBounds(Rect r) {
|
||||
bounds = r;
|
||||
}
|
||||
|
||||
int GetNodeIndex() {
|
||||
if (filledNodes + 4 >= nodes.Length) {
|
||||
var nds = new Node[nodes.Length * 2];
|
||||
for (int i = 0; i < nodes.Length; i++) nds[i] = nodes[i];
|
||||
nodes = nds;
|
||||
}
|
||||
nodes[filledNodes] = new Node();
|
||||
nodes[filledNodes].child00 = filledNodes;
|
||||
filledNodes++;
|
||||
nodes[filledNodes] = new Node();
|
||||
nodes[filledNodes].child00 = filledNodes;
|
||||
filledNodes++;
|
||||
nodes[filledNodes] = new Node();
|
||||
nodes[filledNodes].child00 = filledNodes;
|
||||
filledNodes++;
|
||||
nodes[filledNodes] = new Node();
|
||||
nodes[filledNodes].child00 = filledNodes;
|
||||
filledNodes++;
|
||||
return filledNodes - 4;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将一个代理添加到树中。
|
||||
/// 注意:代理不能被多次添加到同一棵树中。
|
||||
/// </summary>
|
||||
public void Insert(JNRVOAgent agent) {
|
||||
int i = 0;
|
||||
Rect r = bounds;
|
||||
Vector2 p = new Vector2(agent.position.x, agent.position.y);
|
||||
|
||||
agent.next = null;
|
||||
|
||||
maxRadius = System.Math.Max(agent.radius, maxRadius);
|
||||
|
||||
int depth = 0;
|
||||
|
||||
while (true) {
|
||||
depth++;
|
||||
|
||||
if (nodes[i].child00 == i) {
|
||||
// 叶节点。如果代理数量大于等于LeafSize,则深度超过10时停止(避免过多的代理在同一位置)
|
||||
if (nodes[i].count < LeafSize || depth > 10) {
|
||||
nodes[i].Add(agent);
|
||||
nodes[i].count++;
|
||||
break;
|
||||
} else {
|
||||
// 拆分节点
|
||||
nodes[i].child00 = GetNodeIndex();
|
||||
nodes[i].Distribute(nodes, r);
|
||||
}
|
||||
}
|
||||
// 注意,这里没有else子句
|
||||
if (nodes[i].child00 != i) {
|
||||
// 非叶节点
|
||||
Vector2 c = r.center;
|
||||
if (p.x > c.x) {
|
||||
if (p.y > c.y) {
|
||||
i = nodes[i].child00 + 3;
|
||||
r = Rect.MinMaxRect(c.x, c.y, r.xMax, r.yMax);
|
||||
} else {
|
||||
i = nodes[i].child00 + 2;
|
||||
r = Rect.MinMaxRect(c.x, r.yMin, r.xMax, c.y);
|
||||
}
|
||||
} else {
|
||||
if (p.y > c.y) {
|
||||
i = nodes[i].child00 + 1;
|
||||
r = Rect.MinMaxRect(r.xMin, c.y, c.x, r.yMax);
|
||||
} else {
|
||||
i = nodes[i].child00;
|
||||
r = Rect.MinMaxRect(r.xMin, r.yMin, c.x, c.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CalculateSpeeds () {
|
||||
nodes[0].CalculateMaxSpeed(nodes, 0);
|
||||
}
|
||||
|
||||
public void Query (Vector2 p, float speed, float timeHorizon, float agentRadius, JNRVOAgent agent) {
|
||||
new QuadtreeQuery {
|
||||
p = p, speed = speed, timeHorizon = timeHorizon, maxRadius = float.PositiveInfinity,
|
||||
agentRadius = agentRadius, agent = agent, nodes = nodes
|
||||
}.QueryRec(0, bounds);
|
||||
}
|
||||
|
||||
struct QuadtreeQuery {
|
||||
public Vector2 p;
|
||||
public float speed, timeHorizon, agentRadius, maxRadius;
|
||||
public JNRVOAgent agent;
|
||||
public Node[] nodes;
|
||||
|
||||
public void QueryRec(int i, Rect r) {
|
||||
// 确定需要搜索的半径,以便将所有代理考虑在内
|
||||
// 注意:第二个agentRadius的使用实际上应该是其他代理的半径,而不是此代理的半径
|
||||
// 但是出于性能和简化的考虑,我们假设代理具有大致相同的半径
|
||||
// 因此,具有非常小半径的代理在某些情况下可能会过晚地检测到具有非常大半径的代理
|
||||
// 但是这种效果应该是次要的。
|
||||
var radius = System.Math.Min(System.Math.Max((nodes[i].maxSpeed + speed)*timeHorizon, agentRadius) + agentRadius, maxRadius);
|
||||
|
||||
if (nodes[i].child00 == i) {
|
||||
// 叶节点
|
||||
for (JNRVOAgent a = nodes[i].linkedList; a != null; a = a.next) {
|
||||
float v = agent.InsertAgentNeighbour(a, radius*radius);
|
||||
// 如果代理达到了附近代理的最大数量阈值,则限制搜索
|
||||
if (v < maxRadius*maxRadius) {
|
||||
maxRadius = Mathf.Sqrt(v);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 非叶节点
|
||||
Vector2 c = r.center;
|
||||
if (p.x-radius < c.x) {
|
||||
if (p.y-radius < c.y) {
|
||||
QueryRec(nodes[i].child00, Rect.MinMaxRect(r.xMin, r.yMin, c.x, c.y));
|
||||
radius = System.Math.Min(radius, maxRadius);
|
||||
}
|
||||
if (p.y+radius > c.y) {
|
||||
QueryRec(nodes[i].child00+1, Rect.MinMaxRect(r.xMin, c.y, c.x, r.yMax));
|
||||
radius = System.Math.Min(radius, maxRadius);
|
||||
}
|
||||
}
|
||||
|
||||
if (p.x+radius > c.x) {
|
||||
if (p.y-radius < c.y) {
|
||||
QueryRec(nodes[i].child00+2, Rect.MinMaxRect(c.x, r.yMin, r.xMax, c.y));
|
||||
radius = System.Math.Min(radius, maxRadius);
|
||||
}
|
||||
if (p.y+radius > c.y) {
|
||||
QueryRec(nodes[i].child00+3, Rect.MinMaxRect(c.x, c.y, r.xMax, r.yMax));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void DebugDraw () {
|
||||
DebugDrawRec(0, bounds);
|
||||
}
|
||||
|
||||
void DebugDrawRec (int i, Rect r) {
|
||||
Debug.DrawLine(new Vector3(r.xMin, 0, r.yMin), new Vector3(r.xMax, 0, r.yMin), Color.white);
|
||||
Debug.DrawLine(new Vector3(r.xMax, 0, r.yMin), new Vector3(r.xMax, 0, r.yMax), Color.white);
|
||||
Debug.DrawLine(new Vector3(r.xMax, 0, r.yMax), new Vector3(r.xMin, 0, r.yMax), Color.white);
|
||||
Debug.DrawLine(new Vector3(r.xMin, 0, r.yMax), new Vector3(r.xMin, 0, r.yMin), Color.white);
|
||||
|
||||
if (nodes[i].child00 != i) {
|
||||
// Not a leaf node
|
||||
Vector2 c = r.center;
|
||||
DebugDrawRec(nodes[i].child00+3, Rect.MinMaxRect(c.x, c.y, r.xMax, r.yMax));
|
||||
DebugDrawRec(nodes[i].child00+2, Rect.MinMaxRect(c.x, r.yMin, r.xMax, c.y));
|
||||
DebugDrawRec(nodes[i].child00+1, Rect.MinMaxRect(r.xMin, c.y, c.x, r.yMax));
|
||||
DebugDrawRec(nodes[i].child00+0, Rect.MinMaxRect(r.xMin, r.yMin, c.x, c.y));
|
||||
}
|
||||
|
||||
for (JNRVOAgent a = nodes[i].linkedList; a != null; a = a.next) {
|
||||
var p = nodes[i].linkedList.position;
|
||||
Debug.DrawLine(new Vector3(p.x, 0, p.y)+Vector3.up, new Vector3(a.position.x, 0, a.position.y)+Vector3.up, new Color(1, 1, 0, 0.5f));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 660414f56e8b4287a616f5c4144acced
|
||||
timeCreated: 1707116244
|
||||
@@ -0,0 +1,485 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Plugins.JNGame.Sync.Frame.Entity;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Game.Plugins.JNGame.Sync.Frame.AstarPath.RVO
|
||||
{
|
||||
/// <summary>
|
||||
/// 代理类的属性暴露。
|
||||
/// </summary>
|
||||
public interface JNIAgent
|
||||
{
|
||||
/// <summary>
|
||||
/// 代理的位置。
|
||||
/// 代理本身不会移动,需要一个移动脚本负责读取CalculatedTargetPoint和CalculatedSpeed属性,并以该速度朝该点移动。
|
||||
/// 该属性应每帧设置一次。
|
||||
///
|
||||
/// 注意:这是一个Vector2,而不是Vector3,因为RVO在内部以2D模拟一切。 position3D = new Vector3(agent.Position.x, agent.ElevationCoordinate, agent.Position.y);
|
||||
/// </code>
|
||||
/// </summary>
|
||||
Vector2 Position { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 在高度方向上分隔角色的坐标。
|
||||
/// 由于RVO可以在2D或3D中使用,所以仅仅使用3D位置的y坐标并不简单。
|
||||
/// 在3D中,这很可能会被设置为y坐标,但在2D(俯视)中,在大多数情况下应该设置为0,因为所有角色总是在同一平面上,但是它可以被设置为其他值,例如如果游戏是2D等距的。
|
||||
///
|
||||
/// 该位置假定在角色的基础部分(靠近脚部)。
|
||||
/// </summary>
|
||||
float ElevationCoordinate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 避免碰撞的最优移动点。
|
||||
/// 移动脚本应以<see cref="CalculatedSpeed"/>的速度朝此点移动。
|
||||
///
|
||||
/// 注意:这是一个Vector2,而不是Vector3,因为SetTarget方法接受的是Vector2。
|
||||
///
|
||||
/// 参考:RVOController.CalculateMovementDelta。
|
||||
/// </summary>
|
||||
Vector2 CalculatedTargetPoint { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 代理避免碰撞的最优速度。
|
||||
/// 移动脚本应以此速度朝向<see cref="CalculatedTargetPoint"/>移动。
|
||||
/// </summary>
|
||||
float CalculatedSpeed { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 代理应朝向移动的点。
|
||||
/// 通常每帧设置一次。代理将尽量接近目标点。将在下一个模拟步骤中生效。
|
||||
///
|
||||
/// 注意:系统假定代理在到达目标点时会停止,
|
||||
/// 因此,如果您只想向特定方向移动代理,请确保将目标点设置在角色前方一段距离处,
|
||||
/// 否则系统可能无法很好地避免碰撞。简而言之,系统(以简化方式)会认为代理会在碰撞前停止,
|
||||
/// 因此不会减速或改变方向。请参阅下面的图片。在图片中,desiredSpeed 是蓝色箭头的长度,
|
||||
/// 目标点是黑色箭头指向的点。在上图中,代理没有避免红色代理(您可以假设红色代理的速度非常小以简化问题),
|
||||
/// 而在下图中它确实避免了。normalized * remainingPathDistance
|
||||
/// </code>
|
||||
/// 其中 remainingPathDistance 是角色到达路径终点之前的距离。这很好用,因为在路径的终点处,
|
||||
/// 到下一个路点的方向将只是到路径上最后一个点的方向,而 remainingPathDistance 将是到路径上最后一个点的距离,
|
||||
/// 因此 targetPoint 将被设置为简单地设置为路径上的最后一个点。但是,当 remainingPathDistance 很大时,
|
||||
/// targetPoint 将设置得如此远,以至于代理基本上会被指示朝某个方向移动,这正是我们想要的。
|
||||
/// [打开在线文档查看图片]
|
||||
/// </summary>
|
||||
/// <param name="targetPoint">世界空间中的目标点(XZ平面或XY平面,取决于模拟是否配置为2D或3D)。
|
||||
/// 请注意,这是一个Vector2,而不是Vector3,因为系统内部以2D方式模拟一切。因此,如果您的代理在XZ平面上移动,您必须将其提供为具有(x,z)坐标的Vector2。</param>
|
||||
/// <param name="desiredSpeed">代理的期望速度。以世界单位每秒为单位。代理将尽量以这个速度移动。</param>
|
||||
/// <param name="maxSpeed">代理的最大速度。以世界单位每秒为单位。如果必要(例如,如果另一个代理正朝向此代理的碰撞轨迹移动),代理可以以这个速度移动。
|
||||
/// 应该至少与desiredSpeed一样高,但建议使用比desiredSpeed稍高的值(例如desiredSpeed*1.2)。</param>
|
||||
void SetTarget(Vector2 targetPoint, float desiredSpeed, float maxSpeed);
|
||||
|
||||
/// <summary>被锁定的代理将被假定为不会移动</summary>
|
||||
bool Locked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 代理在世界单位中的半径。
|
||||
/// 代理被建模为圆形/圆柱形。
|
||||
/// </summary>
|
||||
float Radius { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 代理在世界单位中的高度。
|
||||
/// 代理被建模为圆形/圆柱形。
|
||||
/// </summary>
|
||||
float Height { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 估计用于查看未来与代理发生碰撞的最大秒数。
|
||||
/// 事实证明,此变量也非常适合用于控制代理的避免优先级。
|
||||
/// 值较低的代理会较少避免其他代理,因此可以通过赋予它们较低的值来创建“高优先级代理”。
|
||||
/// </summary>
|
||||
float AgentTimeHorizon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 估计用于查看未来与障碍物发生碰撞的最大秒数。
|
||||
/// </summary>
|
||||
float ObstacleTimeHorizon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 要考虑的最大代理数量。
|
||||
/// 减少此值可以提高性能,增加它可以提高模拟的质量。
|
||||
/// </summary>
|
||||
int MaxNeighbours { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上一个模拟步骤中代理考虑的邻居数量。
|
||||
/// </summary>
|
||||
int NeighbourCount { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 指定此代理的避障层。
|
||||
/// 其他代理上的<see cref="CollidesWith"/>掩码将决定它们是否会避开此代理。
|
||||
/// </summary>
|
||||
JNRVOLayer Layer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用于指定该代理会避开的图层掩码。
|
||||
/// 可以将其设置为CollidesWith = RVOLayer.DefaultAgent | RVOLayer.Layer3 | RVOLayer.Layer6 ...
|
||||
///
|
||||
/// 参考:http://en.wikipedia.org/wiki/Mask_(computing)
|
||||
/// </summary>
|
||||
JNRVOLayer CollidesWith { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 绘制调试信息。
|
||||
///
|
||||
/// 注意:即使<see cref="Pathfinding.RVO.Simulator.movementPlane"/>设置为XY平面,也将在XZ平面上始终绘制调试信息。
|
||||
/// 注意:如果模拟器组件启用了多线程,则忽略此属性。
|
||||
/// 因为Unity的调试API只能从主线程调用。
|
||||
/// </summary>
|
||||
bool DebugDraw { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 在上一个模拟步骤中与代理近距离接触的障碍物段落的列表。
|
||||
/// 例如,可以用于施加额外的墙壁避免力。
|
||||
/// 段落由障碍物的顶点及其.next属性形成。
|
||||
///
|
||||
/// 错误:始终返回null。
|
||||
/// </summary>
|
||||
List<JNObstacleVertex> NeighbourObstacles { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他代理避免此代理的强烈程度。
|
||||
/// 通常是一个介于0和1之间的值。
|
||||
/// 具有相似优先级的代理将以相同的强度相互避免。
|
||||
/// 如果一个代理看到另一个优先级高于自己的代理,它会更加强烈地避免该代理。
|
||||
/// 在极端情况下(例如,此代理的优先级为0,而另一个代理的优先级为1),它会将另一个代理视为移动障碍物。
|
||||
/// 类似地,如果一个代理看到另一个优先级低于自己的代理,它会避免该代理的强度较小。0:
|
||||
/// avoidanceStrength = other.priority / (this.priority + other.priority);
|
||||
/// 否则:
|
||||
/// avoidanceStrength = 0.5
|
||||
/// </code>
|
||||
/// </summary>
|
||||
float Priority { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 在避障计算开始之前将被调用的回调函数。
|
||||
/// 用于使用最新值更新其他属性。
|
||||
/// </summary>
|
||||
System.Action PreCalculationCallback { set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设置代理当前与之碰撞的墙壁(或其他物体)的法线。
|
||||
/// 这用于使RVO系统能够感知物理或其他代理被夹在导航网格上的情况。
|
||||
/// 其他代理观察到的此代理的速度将被修改,因此不会产生撞墙的分量。
|
||||
/// 但是,代理不会开始避开墙壁,要实现这一点,您需要添加RVO障碍物。
|
||||
///
|
||||
/// 在下一个模拟步骤之后,此值将被清除,通常应在碰撞仍在发生时每个帧设置此值。
|
||||
/// </summary>
|
||||
void SetCollisionNormal(Vector2 normal);
|
||||
|
||||
/// <summary>
|
||||
/// 设置代理的当前速度。
|
||||
/// 这将完全覆盖本地避障输入。
|
||||
/// 如果您有一个由玩家控制的角色,并希望其他代理避开它,这很有用。
|
||||
///
|
||||
/// 调用此方法将使代理在下一个模拟步骤中被标记为外部控制。
|
||||
/// 下一个模拟步骤中的本地避障计算将被跳过,但之后将恢复,除非再次调用此方法。
|
||||
/// </summary>
|
||||
void ForceSetVelocity(Vector2 velocity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 描述物体主要在哪个平面上移动的枚举类型。
|
||||
/// </summary>
|
||||
public enum MovementPlane {
|
||||
/// <summary>
|
||||
/// 物体主要在XZ平面上移动(3D环境)。
|
||||
/// </summary>
|
||||
XZ,
|
||||
/// <summary>
|
||||
/// 物体主要在XY平面上移动(2D环境)。
|
||||
/// </summary>
|
||||
XY
|
||||
}
|
||||
|
||||
[System.Flags]
|
||||
public enum JNRVOLayer {
|
||||
DefaultAgent = 1 << 0,
|
||||
DefaultObstacle = 1 << 1,
|
||||
Layer2 = 1 << 2,
|
||||
Layer3 = 1 << 3,
|
||||
Layer4 = 1 << 4,
|
||||
Layer5 = 1 << 5,
|
||||
Layer6 = 1 << 6,
|
||||
Layer7 = 1 << 7,
|
||||
Layer8 = 1 << 8,
|
||||
Layer9 = 1 << 9,
|
||||
Layer10 = 1 << 10,
|
||||
Layer11 = 1 << 11,
|
||||
Layer12 = 1 << 12,
|
||||
Layer13 = 1 << 13,
|
||||
Layer14 = 1 << 14,
|
||||
Layer15 = 1 << 15,
|
||||
Layer16 = 1 << 16,
|
||||
Layer17 = 1 << 17,
|
||||
Layer18 = 1 << 18,
|
||||
Layer19 = 1 << 19,
|
||||
Layer20 = 1 << 20,
|
||||
Layer21 = 1 << 21,
|
||||
Layer22 = 1 << 22,
|
||||
Layer23 = 1 << 23,
|
||||
Layer24 = 1 << 24,
|
||||
Layer25 = 1 << 25,
|
||||
Layer26 = 1 << 26,
|
||||
Layer27 = 1 << 27,
|
||||
Layer28 = 1 << 28,
|
||||
Layer29 = 1 << 29,
|
||||
Layer30 = 1 << 30
|
||||
}
|
||||
|
||||
|
||||
internal class WorkerContext {
|
||||
public JNRVOAgent.VOBuffer vos = new JNRVOAgent.VOBuffer(16);
|
||||
|
||||
public const int KeepCount = 3;
|
||||
public Vector2[] bestPos = new Vector2[KeepCount];
|
||||
public float[] bestSizes = new float[KeepCount];
|
||||
public float[] bestScores = new float[KeepCount+1];
|
||||
|
||||
public Vector2[] samplePos = new Vector2[50];
|
||||
public float[] sampleSize = new float[50];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// RVO 模拟器
|
||||
/// 本地避障模拟器。
|
||||
/// 这个类使用Reciprocal Velocity Obstacles (RVO) 和 Optimal Reciprocal Collision Avoidance (ORCA) 方法处理多个代理的本地避障模拟。
|
||||
///
|
||||
/// 这个类负责根据脚本提供的期望速度计算速度。然而,它不负责在Unity场景中移动任何物体。对于这个功能,还有其他脚本可用(详见下文)。
|
||||
///
|
||||
/// 可以向模拟器添加和移除障碍物,也可以随时添加和移除代理。
|
||||
/// 参考:RVOSimulator
|
||||
/// 参考:RVOAgent
|
||||
/// 参考:Pathfinding.RVO.IAgent
|
||||
///
|
||||
/// 该实现使用基于采样的算法,结合梯度下降法来找到避障速度。
|
||||
///
|
||||
/// 你可能主要会使用包装类RVOSimulator。
|
||||
/// </summary>
|
||||
public class JNRVOSimulator
|
||||
{
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 使用双缓冲技术。
|
||||
// /// 双缓冲技术是一种图形渲染技术,用于减少屏幕撕裂和闪烁现象。
|
||||
// /// </summary>
|
||||
// private readonly bool doubleBuffering = true;
|
||||
|
||||
/// <summary>模拟中的代理</summary>
|
||||
/// 代理可以理解为模拟中的实体或对象,它们会根据模拟规则进行移动或交互。
|
||||
List<JNRVOAgent> agents = new List<JNRVOAgent>();
|
||||
|
||||
/// <summary>模拟中的障碍物</summary>
|
||||
/// 障碍物是模拟环境中的静态对象,代理在移动时需要避免与障碍物发生碰撞。
|
||||
public List<JNObstacleVertex> obstacles = new List<JNObstacleVertex>();
|
||||
|
||||
/// <summary>
|
||||
/// 用于此模拟的四叉树。
|
||||
/// 四叉树是一种数据结构,用于高效地管理和查询空间信息。在此模拟中,四叉树用于快速查找代理的邻居。
|
||||
/// </summary>
|
||||
public JNRVOQuadtree Quadtree = new JNRVOQuadtree();
|
||||
|
||||
private float deltaTime;
|
||||
/// <summary>上次模拟的时间步长</summary>
|
||||
private float lastStep = -99999;
|
||||
|
||||
/// <summary>是否需要更新障碍物的状态</summary>
|
||||
private bool doUpdateObstacles = false;
|
||||
/// <summary>是否需要清除障碍物</summary>
|
||||
private bool doCleanObstacles = false;
|
||||
|
||||
/// <summary>当前时间步长的持续时间</summary>
|
||||
public float DeltaTime { get { return deltaTime; } }
|
||||
|
||||
/// <summary>是否使用多线程进行模拟</summary>
|
||||
public bool Multithreading
|
||||
{
|
||||
get { return false; } // 目前未启用多线程模拟功能。
|
||||
}
|
||||
|
||||
private WorkerContext context = new WorkerContext();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Inverse desired simulation fps.
|
||||
/// See: DesiredDeltaTime
|
||||
/// </summary>
|
||||
private float desiredDeltaTime = 0.05f;
|
||||
|
||||
/// <summary>
|
||||
/// Time in seconds between each simulation step.
|
||||
/// This is the desired delta time, the simulation will never run at a higher fps than
|
||||
/// the rate at which the Update function is called.
|
||||
/// </summary>
|
||||
public float DesiredDeltaTime { get { return desiredDeltaTime; } set { desiredDeltaTime = Math.Max(value, 0.0f); } }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 使代理在彼此之间通过右侧。
|
||||
/// 如果一个代理的期望速度使其与另一个代理或障碍物处于碰撞航线上,
|
||||
/// 其期望速度将向右旋转这个弧度数(1弧度约等于57°)。
|
||||
/// 这有助于打破对称性,并使更快地解决某些情况成为可能。
|
||||
///
|
||||
/// 当许多代理具有相同的目标时,这可能会产生副作用,即围绕目标点的群体
|
||||
/// 可能会作为一个整体开始围绕目标点旋转。
|
||||
///
|
||||
/// 推荐的值范围是0到0.2。
|
||||
///
|
||||
/// 如果此值为负数,代理将偏向于在左侧彼此通过。
|
||||
/// </summary>
|
||||
public float symmetryBreakingBias = 0.1f;
|
||||
|
||||
/// <summary>
|
||||
/// 判断用于移动的是XY(2D)平面还是XZ(3D)平面。
|
||||
/// </summary>
|
||||
public readonly MovementPlane movementPlane = MovementPlane.XZ;
|
||||
|
||||
public JNRVOSimulator (MovementPlane movementPlane) {
|
||||
this.movementPlane = movementPlane;
|
||||
Quadtree = new JNRVOQuadtree();
|
||||
|
||||
agents = new List<JNRVOAgent>();
|
||||
obstacles = new List<JNObstacleVertex>();
|
||||
}
|
||||
|
||||
|
||||
void PreCalculation () {
|
||||
for (int i = 0; i < agents.Count; i++) agents[i].PreCalculation();
|
||||
}
|
||||
|
||||
void CleanAndUpdateObstaclesIfNecessary () {
|
||||
if (doCleanObstacles) {
|
||||
CleanObstacles();
|
||||
doCleanObstacles = false;
|
||||
doUpdateObstacles = true;
|
||||
}
|
||||
|
||||
if (doUpdateObstacles) {
|
||||
doUpdateObstacles = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void CleanObstacles () {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从模拟中移除所有代理。
|
||||
/// </summary>
|
||||
public void ClearAgents () {
|
||||
// 遍历代理列表,将每个代理的模拟器设置为 null。
|
||||
for (int i = 0; i < agents.Count; i++) {
|
||||
agents[i].simulator = null;
|
||||
}
|
||||
// 清空代理列表。
|
||||
agents.Clear();
|
||||
}
|
||||
/// <summary>
|
||||
/// 在指定位置添加一个代理。
|
||||
/// 您可以使用返回的接口来读取和写入参数,并设置例如半径和要移动到的目标点。
|
||||
///
|
||||
/// 查看:RemoveAgent
|
||||
/// </summary>
|
||||
/// <param name="position">参见IAgent.Position</param>
|
||||
/// <param name="elevationCoordinate">参见IAgent.ElevationCoordinate</param>
|
||||
public JNIAgent AddAgent (Vector2 position, float elevationCoordinate) {
|
||||
// 创建一个新的代理实例,并传入位置和海拔坐标。
|
||||
JNRVOAgent agent = new JNRVOAgent(position, elevationCoordinate);
|
||||
// 调用另一个AddAgent方法来添加代理。
|
||||
return AddAgent(agent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加先前已从模拟中移除的代理到模拟中。
|
||||
/// 查看:RemoveAgent
|
||||
/// </summary>
|
||||
public JNIAgent AddAgent (JNIAgent agent) {
|
||||
// 检查代理是否为空,如果为空则抛出异常
|
||||
if (agent == null) throw new System.ArgumentNullException("Agent must not be null");
|
||||
|
||||
// 尝试将代理转换为 Agent 类型,并检查转换是否成功
|
||||
JNRVOAgent agentReal = agent as JNRVOAgent;
|
||||
if (agentReal == null) throw new System.ArgumentException("The agent must be of type Agent. Agent was of type "+agent.GetType());
|
||||
|
||||
// 检查代理是否已经存在于模拟中,如果存在则抛出异常
|
||||
if (agentReal.simulator != null && agentReal.simulator == this) throw new System.ArgumentException("The agent is already in the simulation");
|
||||
else if (agentReal.simulator != null) throw new System.ArgumentException("The agent is already added to another simulation");
|
||||
|
||||
// 如果代理当前没有模拟器,则为该代理设置当前模拟器
|
||||
agentReal.simulator = this;
|
||||
|
||||
// 将代理添加到代理列表中
|
||||
agents.Add(agentReal);
|
||||
return agent; // 返回添加的代理对象
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 每帧调用一次
|
||||
/// </summary>
|
||||
public void Update()
|
||||
{
|
||||
if (lastStep < 0) {
|
||||
lastStep = 0;
|
||||
deltaTime = DesiredDeltaTime;
|
||||
}
|
||||
|
||||
if (JNTime.Time.time - lastStep >= DesiredDeltaTime)
|
||||
{
|
||||
deltaTime = JNTime.Time.time - lastStep;
|
||||
lastStep = JNTime.Time.time;
|
||||
|
||||
deltaTime = Math.Max(deltaTime, 1.0f / 2000f);
|
||||
|
||||
PreCalculation(); // 预计算
|
||||
CleanAndUpdateObstaclesIfNecessary(); // 清理并更新障碍物
|
||||
BuildQuadtree(); // 构建四叉树
|
||||
|
||||
// 遍历所有代理,切换缓冲区
|
||||
for (int i = 0; i < agents.Count; i++)
|
||||
{
|
||||
agents[i].BufferSwitch();
|
||||
}
|
||||
|
||||
// 遍历所有代理,计算邻居和速度
|
||||
for (int i = 0; i < agents.Count; i++)
|
||||
{
|
||||
agents[i].CalculateNeighbours();
|
||||
agents[i].CalculateVelocity(context);
|
||||
}
|
||||
|
||||
// 遍历所有代理,后计算
|
||||
for (int i = 0; i < agents.Count; i++)
|
||||
{
|
||||
agents[i].PostCalculation();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 构建四叉树
|
||||
/// </summary>
|
||||
void BuildQuadtree()
|
||||
{
|
||||
Quadtree.Clear(); // 清除四叉树中的所有元素
|
||||
if (agents.Count > 0) // 如果代理数量大于0
|
||||
{
|
||||
Rect bounds = Rect.MinMaxRect(agents[0].position.x, agents[0].position.y, agents[0].position.x, agents[0].position.y); // 获取第一个代理的位置作为矩形边界的初始值
|
||||
for (int i = 1; i < agents.Count; i++) // 遍历所有代理,更新矩形边界的最小和最大值
|
||||
{
|
||||
Vector2 p = agents[i].position;
|
||||
bounds = Rect.MinMaxRect(Mathf.Min(bounds.xMin, p.x), Mathf.Min(bounds.yMin, p.y), Mathf.Max(bounds.xMax, p.x), Mathf.Max(bounds.yMax, p.y));
|
||||
}
|
||||
Quadtree.SetBounds(bounds); // 设置四叉树的边界
|
||||
for (int i = 0; i < agents.Count; i++) // 遍历所有代理,将代理插入四叉树中
|
||||
{
|
||||
Quadtree.Insert(agents[i]);
|
||||
}
|
||||
//quadtree.DebugDraw(); // 可选:绘制四叉树用于调试(如果需要)
|
||||
}
|
||||
Quadtree.CalculateSpeeds(); // 计算四叉树中所有元素的速度(用于碰撞检测等)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 11e5d1e71ebb4bc2982a35fe3a32eab1
|
||||
timeCreated: 1707104628
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 064be9ef1f5e4efbb820dd632b98d5be
|
||||
timeCreated: 1707118794
|
||||
@@ -0,0 +1,320 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Game.Plugins.JNGame.Sync.Frame.AStar.Util {
|
||||
/// <summary>Holds a coordinate in integers</summary>
|
||||
public struct Int3 : System.IEquatable<Int3> {
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
|
||||
//These should be set to the same value (only PrecisionFactor should be 1 divided by Precision)
|
||||
|
||||
/// <summary>
|
||||
/// Precision for the integer coordinates.
|
||||
/// One world unit is divided into [value] pieces. A value of 1000 would mean millimeter precision, a value of 1 would mean meter precision (assuming 1 world unit = 1 meter).
|
||||
/// This value affects the maximum coordinates for nodes as well as how large the cost values are for moving between two nodes.
|
||||
/// A higher value means that you also have to set all penalty values to a higher value to compensate since the normal cost of moving will be higher.
|
||||
/// </summary>
|
||||
public const int Precision = 1000;
|
||||
|
||||
/// <summary><see cref="Precision"/> as a float</summary>
|
||||
public const float FloatPrecision = 1000F;
|
||||
|
||||
/// <summary>1 divided by <see cref="Precision"/></summary>
|
||||
public const float PrecisionFactor = 0.001F;
|
||||
|
||||
public static Int3 zero { get { return new Int3(); } }
|
||||
|
||||
public Int3 (Vector3 position) {
|
||||
x = (int)System.Math.Round(position.x*FloatPrecision);
|
||||
y = (int)System.Math.Round(position.y*FloatPrecision);
|
||||
z = (int)System.Math.Round(position.z*FloatPrecision);
|
||||
}
|
||||
|
||||
public Int3 (int _x, int _y, int _z) {
|
||||
x = _x;
|
||||
y = _y;
|
||||
z = _z;
|
||||
}
|
||||
|
||||
public static bool operator == (Int3 lhs, Int3 rhs) {
|
||||
return lhs.x == rhs.x &&
|
||||
lhs.y == rhs.y &&
|
||||
lhs.z == rhs.z;
|
||||
}
|
||||
|
||||
public static bool operator != (Int3 lhs, Int3 rhs) {
|
||||
return lhs.x != rhs.x ||
|
||||
lhs.y != rhs.y ||
|
||||
lhs.z != rhs.z;
|
||||
}
|
||||
|
||||
public static explicit operator Int3 (Vector3 ob) {
|
||||
return new Int3(
|
||||
(int)System.Math.Round(ob.x*FloatPrecision),
|
||||
(int)System.Math.Round(ob.y*FloatPrecision),
|
||||
(int)System.Math.Round(ob.z*FloatPrecision)
|
||||
);
|
||||
}
|
||||
|
||||
public static explicit operator Vector3 (Int3 ob) {
|
||||
return new Vector3(ob.x*PrecisionFactor, ob.y*PrecisionFactor, ob.z*PrecisionFactor);
|
||||
}
|
||||
|
||||
public static Int3 operator - (Int3 lhs, Int3 rhs) {
|
||||
lhs.x -= rhs.x;
|
||||
lhs.y -= rhs.y;
|
||||
lhs.z -= rhs.z;
|
||||
return lhs;
|
||||
}
|
||||
|
||||
public static Int3 operator - (Int3 lhs) {
|
||||
lhs.x = -lhs.x;
|
||||
lhs.y = -lhs.y;
|
||||
lhs.z = -lhs.z;
|
||||
return lhs;
|
||||
}
|
||||
|
||||
public static Int3 operator + (Int3 lhs, Int3 rhs) {
|
||||
lhs.x += rhs.x;
|
||||
lhs.y += rhs.y;
|
||||
lhs.z += rhs.z;
|
||||
return lhs;
|
||||
}
|
||||
|
||||
public static Int3 operator * (Int3 lhs, int rhs) {
|
||||
lhs.x *= rhs;
|
||||
lhs.y *= rhs;
|
||||
lhs.z *= rhs;
|
||||
|
||||
return lhs;
|
||||
}
|
||||
|
||||
public static Int3 operator * (Int3 lhs, float rhs) {
|
||||
lhs.x = (int)System.Math.Round(lhs.x * rhs);
|
||||
lhs.y = (int)System.Math.Round(lhs.y * rhs);
|
||||
lhs.z = (int)System.Math.Round(lhs.z * rhs);
|
||||
|
||||
return lhs;
|
||||
}
|
||||
|
||||
public static Int3 operator * (Int3 lhs, double rhs) {
|
||||
lhs.x = (int)System.Math.Round(lhs.x * rhs);
|
||||
lhs.y = (int)System.Math.Round(lhs.y * rhs);
|
||||
lhs.z = (int)System.Math.Round(lhs.z * rhs);
|
||||
|
||||
return lhs;
|
||||
}
|
||||
|
||||
public static Int3 operator / (Int3 lhs, float rhs) {
|
||||
lhs.x = (int)System.Math.Round(lhs.x / rhs);
|
||||
lhs.y = (int)System.Math.Round(lhs.y / rhs);
|
||||
lhs.z = (int)System.Math.Round(lhs.z / rhs);
|
||||
return lhs;
|
||||
}
|
||||
|
||||
public int this[int i] {
|
||||
get {
|
||||
return i == 0 ? x : (i == 1 ? y : z);
|
||||
}
|
||||
set {
|
||||
if (i == 0) x = value;
|
||||
else if (i == 1) y = value;
|
||||
else z = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Angle between the vectors in radians</summary>
|
||||
public static float Angle (Int3 lhs, Int3 rhs) {
|
||||
double cos = Dot(lhs, rhs)/ ((double)lhs.magnitude*(double)rhs.magnitude);
|
||||
|
||||
cos = cos < -1 ? -1 : (cos > 1 ? 1 : cos);
|
||||
return (float)System.Math.Acos(cos);
|
||||
}
|
||||
|
||||
public static int Dot (Int3 lhs, Int3 rhs) {
|
||||
return
|
||||
lhs.x * rhs.x +
|
||||
lhs.y * rhs.y +
|
||||
lhs.z * rhs.z;
|
||||
}
|
||||
|
||||
public static long DotLong (Int3 lhs, Int3 rhs) {
|
||||
return
|
||||
(long)lhs.x * (long)rhs.x +
|
||||
(long)lhs.y * (long)rhs.y +
|
||||
(long)lhs.z * (long)rhs.z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Normal in 2D space (XZ).
|
||||
/// Equivalent to Cross(this, Int3(0,1,0) )
|
||||
/// except that the Y coordinate is left unchanged with this operation.
|
||||
/// </summary>
|
||||
public Int3 Normal2D () {
|
||||
return new Int3(z, y, -x);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the magnitude of the vector. The magnitude is the 'length' of the vector from 0,0,0 to this point. Can be used for distance calculations:
|
||||
/// <code> Debug.Log ("Distance between 3,4,5 and 6,7,8 is: "+(new Int3(3,4,5) - new Int3(6,7,8)).magnitude); </code>
|
||||
/// </summary>
|
||||
public float magnitude {
|
||||
get {
|
||||
//It turns out that using doubles is just as fast as using ints with Mathf.Sqrt. And this can also handle larger numbers (possibly with small errors when using huge numbers)!
|
||||
|
||||
double _x = x;
|
||||
double _y = y;
|
||||
double _z = z;
|
||||
|
||||
return (float)System.Math.Sqrt(_x*_x+_y*_y+_z*_z);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Magnitude used for the cost between two nodes. The default cost between two nodes can be calculated like this:
|
||||
/// <code> int cost = (node1.position-node2.position).costMagnitude; </code>
|
||||
///
|
||||
/// This is simply the magnitude, rounded to the nearest integer
|
||||
/// </summary>
|
||||
public int costMagnitude {
|
||||
get {
|
||||
return (int)System.Math.Round(magnitude);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The squared magnitude of the vector</summary>
|
||||
public float sqrMagnitude {
|
||||
get {
|
||||
double _x = x;
|
||||
double _y = y;
|
||||
double _z = z;
|
||||
return (float)(_x*_x+_y*_y+_z*_z);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The squared magnitude of the vector</summary>
|
||||
public long sqrMagnitudeLong {
|
||||
get {
|
||||
long _x = x;
|
||||
long _y = y;
|
||||
long _z = z;
|
||||
return (_x*_x+_y*_y+_z*_z);
|
||||
}
|
||||
}
|
||||
|
||||
public static implicit operator string (Int3 obj) {
|
||||
return obj.ToString();
|
||||
}
|
||||
|
||||
/// <summary>Returns a nicely formatted string representing the vector</summary>
|
||||
public override string ToString () {
|
||||
return "( "+x+", "+y+", "+z+")";
|
||||
}
|
||||
|
||||
public override bool Equals (System.Object obj) {
|
||||
if (obj == null) return false;
|
||||
|
||||
var rhs = (Int3)obj;
|
||||
|
||||
return x == rhs.x &&
|
||||
y == rhs.y &&
|
||||
z == rhs.z;
|
||||
}
|
||||
|
||||
#region IEquatable implementation
|
||||
|
||||
public bool Equals (Int3 other) {
|
||||
return x == other.x && y == other.y && z == other.z;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public override int GetHashCode () {
|
||||
return x*73856093 ^ y*19349669 ^ z*83492791;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Two Dimensional Integer Coordinate Pair</summary>
|
||||
public struct Int2 : System.IEquatable<Int2> {
|
||||
public int x;
|
||||
public int y;
|
||||
|
||||
public Int2 (int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public long sqrMagnitudeLong {
|
||||
get {
|
||||
return (long)x*(long)x+(long)y*(long)y;
|
||||
}
|
||||
}
|
||||
|
||||
public static Int2 operator - (Int2 lhs) {
|
||||
lhs.x = -lhs.x;
|
||||
lhs.y = -lhs.y;
|
||||
return lhs;
|
||||
}
|
||||
|
||||
public static Int2 operator + (Int2 a, Int2 b) {
|
||||
return new Int2(a.x+b.x, a.y+b.y);
|
||||
}
|
||||
|
||||
public static Int2 operator - (Int2 a, Int2 b) {
|
||||
return new Int2(a.x-b.x, a.y-b.y);
|
||||
}
|
||||
|
||||
public static bool operator == (Int2 a, Int2 b) {
|
||||
return a.x == b.x && a.y == b.y;
|
||||
}
|
||||
|
||||
public static bool operator != (Int2 a, Int2 b) {
|
||||
return a.x != b.x || a.y != b.y;
|
||||
}
|
||||
|
||||
/// <summary>Dot product of the two coordinates</summary>
|
||||
public static long DotLong (Int2 a, Int2 b) {
|
||||
return (long)a.x*(long)b.x + (long)a.y*(long)b.y;
|
||||
}
|
||||
|
||||
public override bool Equals (System.Object o) {
|
||||
if (o == null) return false;
|
||||
var rhs = (Int2)o;
|
||||
|
||||
return x == rhs.x && y == rhs.y;
|
||||
}
|
||||
|
||||
#region IEquatable implementation
|
||||
|
||||
public bool Equals (Int2 other) {
|
||||
return x == other.x && y == other.y;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public override int GetHashCode () {
|
||||
return x*49157+y*98317;
|
||||
}
|
||||
|
||||
public static Int2 Min (Int2 a, Int2 b) {
|
||||
return new Int2(System.Math.Min(a.x, b.x), System.Math.Min(a.y, b.y));
|
||||
}
|
||||
|
||||
public static Int2 Max (Int2 a, Int2 b) {
|
||||
return new Int2(System.Math.Max(a.x, b.x), System.Math.Max(a.y, b.y));
|
||||
}
|
||||
|
||||
public static Int2 FromInt3XZ (Int3 o) {
|
||||
return new Int2(o.x, o.z);
|
||||
}
|
||||
|
||||
public static Int3 ToInt3XZ (Int2 o) {
|
||||
return new Int3(o.x, 0, o.y);
|
||||
}
|
||||
|
||||
public override string ToString () {
|
||||
return "("+x+", " +y+")";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0dfda11c977a492fb003ee4fee3f47b1
|
||||
timeCreated: 1707118870
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3fa8e1f5ed4b49ceb6a2f9dc9288eee7
|
||||
timeCreated: 1707118797
|
||||
@@ -1,4 +1,6 @@
|
||||
|
||||
using System;
|
||||
|
||||
namespace Plugins.JNGame.Sync.Frame.Entity
|
||||
{
|
||||
public class JNTime
|
||||
@@ -45,8 +47,13 @@ namespace Plugins.JNGame.Sync.Frame.Entity
|
||||
/// Time.timeSinceLevelLoad是一个表示从当前场景开始到现在所经过的时间的属性,单位是秒。这个属性通常用于计算从加载关卡开始到当前帧的时间,并且会随着游戏的暂停而停止计算
|
||||
/// </summary>
|
||||
public float timeSinceLevelLoad => _sync == null ? UnityEngine.Time.timeSinceLevelLoad : ((float)_sync.NSyncTime / _sync.NDivideFrame) / 1000;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// System.DateTime.UtcNow.Ticks
|
||||
/// </summary>
|
||||
public long Ticks => _sync == null ? DateTime.UtcNow.Ticks : _sync.NSyncTime * _sync.NLocalRunFrame;
|
||||
|
||||
public JNTime(JNSyncFrame sync)
|
||||
{
|
||||
Time = this;
|
||||
|
||||
@@ -10,6 +10,12 @@ namespace Plugins.JNGame.Sync.Frame.game
|
||||
public int _nId;
|
||||
[HideInInspector]
|
||||
public int NID => _nId;
|
||||
|
||||
//是否执行Start方法
|
||||
[HideInInspector]
|
||||
public Boolean IsRunStart = false;
|
||||
|
||||
public abstract void OnSyncStart();
|
||||
|
||||
public abstract Boolean IsInput();
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace Plugins.JNGame.Sync.Frame
|
||||
|
||||
public override Task OnInit()
|
||||
{
|
||||
Physics.simulationMode = SimulationMode.Script;
|
||||
Physics.autoSimulation = false;
|
||||
Physics.autoSyncTransforms = false;
|
||||
this.OnReset();
|
||||
return Task.CompletedTask;
|
||||
@@ -127,10 +127,11 @@ namespace Plugins.JNGame.Sync.Frame
|
||||
this.dtInputTotal = 0;
|
||||
this._isRequestServerData = false;
|
||||
|
||||
Physics.SyncTransforms();
|
||||
|
||||
//清除定时器
|
||||
SingletonUtil<JNFrameTime>.Clean();
|
||||
|
||||
// Physics.SyncTransforms();
|
||||
EventDispatcher.Event.Dispatch(JNSyncFrameEvent.CREATE);
|
||||
|
||||
}
|
||||
@@ -145,10 +146,11 @@ namespace Plugins.JNGame.Sync.Frame
|
||||
dtInputTotal += dt;
|
||||
|
||||
int nSyncTime = this.DyTime();
|
||||
|
||||
this._isLoop = this._nFrameQueue.Count > 20;
|
||||
|
||||
if(nSyncTime > 0){
|
||||
while(nSyncTime != 0 && this.dtTotal > nSyncTime){
|
||||
this._isLoop = false;
|
||||
this.OnUpdate();
|
||||
this.dtTotal -= nSyncTime;
|
||||
nSyncTime = this.DyTime();
|
||||
@@ -158,7 +160,6 @@ namespace Plugins.JNGame.Sync.Frame
|
||||
long endTime = (new DateTimeOffset(DateTime.UtcNow).ToUnixTimeMilliseconds()) + 66;
|
||||
while(this.DyTime() == 0 && (new DateTimeOffset(DateTime.UtcNow).ToUnixTimeMilliseconds()) < endTime)
|
||||
{
|
||||
this._isLoop = true;
|
||||
this.OnUpdate();
|
||||
}
|
||||
dtTotal = 0;
|
||||
@@ -224,6 +225,16 @@ namespace Plugins.JNGame.Sync.Frame
|
||||
|
||||
// Debug.Log(inputs.Count);
|
||||
|
||||
//运行生命周期
|
||||
this._nSyncActors.ToList().ForEach(child =>
|
||||
{
|
||||
if (!child.IsRunStart)
|
||||
{
|
||||
child.IsRunStart = true;
|
||||
child.OnSyncStart();
|
||||
}
|
||||
});
|
||||
|
||||
//运行之前帧
|
||||
this._nSyncActors.ToList().ForEach(child =>
|
||||
{
|
||||
@@ -256,10 +267,9 @@ namespace Plugins.JNGame.Sync.Frame
|
||||
|
||||
//执行定时器
|
||||
SingletonUtil<JNFrameTime>.Instance.Update(dt);
|
||||
// //执行下一帧物理
|
||||
//执行下一帧物理
|
||||
// Physics.Simulate((float)dt / 1000);
|
||||
// Physics.SyncTransforms();
|
||||
|
||||
Physics.SyncTransforms();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Plugins.JNGame.Util
|
||||
|
||||
public async UniTask<T> Post<T,TA>(string url,TA data)
|
||||
{
|
||||
var request = UnityWebRequest.PostWwwForm($"{this._config.BaseURL}/{url}",JsonConvert.SerializeObject(data));
|
||||
var request = UnityWebRequest.Post($"{this._config.BaseURL}/{url}",JsonConvert.SerializeObject(data));
|
||||
return JsonConvert.DeserializeObject<T>((await request.SendWebRequest()).downloadHandler.text);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 669eee4013ad2664a8466d082a58aba7
|
||||
@@ -0,0 +1,613 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 0
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 12
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 1
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 256
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 2
|
||||
m_BakeBackend: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 512
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 256
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 1
|
||||
m_PVRDenoiserTypeDirect: 1
|
||||
m_PVRDenoiserTypeIndirect: 1
|
||||
m_PVRDenoiserTypeAO: 1
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 1
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_LightingSettings: {fileID: 0}
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 2
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666667
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
accuratePlacement: 0
|
||||
maxJobWorkers: 0
|
||||
preserveTilesOutsideBounds: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &150562471
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 150562474}
|
||||
- component: {fileID: 150562473}
|
||||
- component: {fileID: 150562472}
|
||||
m_Layer: 0
|
||||
m_Name: Plane
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 4294967295
|
||||
m_IsActive: 1
|
||||
--- !u!23 &150562472
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 150562471}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 8f4d5503fdeab441e8c6c041504cf535, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 0.8
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!33 &150562473
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 150562471}
|
||||
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!4 &150562474
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 150562471}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: -0.1, z: 0}
|
||||
m_LocalScale: {x: 62.87725, y: 1, z: 62.87725}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &963821750
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 963821753}
|
||||
- component: {fileID: 963821752}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!20 &963821752
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963821750}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &963821753
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963821750}
|
||||
m_LocalRotation: {x: -0.0065903203, y: 0.7045085, z: -0.70962507, w: -0.0075322096}
|
||||
m_LocalPosition: {x: -34.862534, y: 264.16022, z: -2.0391257}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &988048031
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 988048033}
|
||||
- component: {fileID: 988048032}
|
||||
m_Layer: 0
|
||||
m_Name: Directional Light
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!108 &988048032
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 988048031}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 10
|
||||
m_Type: 1
|
||||
m_Shape: 0
|
||||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
|
||||
m_Intensity: 1
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
m_InnerSpotAngle: 21.80208
|
||||
m_CookieSize: 10
|
||||
m_Shadows:
|
||||
m_Type: 2
|
||||
m_Resolution: -1
|
||||
m_CustomResolution: -1
|
||||
m_Strength: 1
|
||||
m_Bias: 0.05
|
||||
m_NormalBias: 0.4
|
||||
m_NearPlane: 0.2
|
||||
m_CullingMatrixOverride:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
m_UseCullingMatrixOverride: 0
|
||||
m_Cookie: {fileID: 0}
|
||||
m_DrawHalo: 0
|
||||
m_Flare: {fileID: 0}
|
||||
m_RenderMode: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingLayerMask: 1
|
||||
m_Lightmapping: 4
|
||||
m_LightShadowCasterMode: 0
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 1
|
||||
m_ColorTemperature: 6570
|
||||
m_UseColorTemperature: 0
|
||||
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_UseBoundingSphereOverride: 0
|
||||
m_UseViewFrustumForShadowCasterCull: 1
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
--- !u!4 &988048033
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 988048031}
|
||||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
|
||||
m_LocalPosition: {x: 0, y: 3, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||
--- !u!1 &1102796830
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1102796832}
|
||||
- component: {fileID: 1102796831}
|
||||
- component: {fileID: 1102796833}
|
||||
m_Layer: 0
|
||||
m_Name: GMode
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1102796831
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1102796830}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e5b7cdf57c8619a40b108b66c4308c5e, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_nId: 0
|
||||
IsRunStart: 0
|
||||
isSyncInitSuccess: 0
|
||||
agentCount: 150
|
||||
exampleScale: 100
|
||||
renderingOffset: {x: 0, y: 0.1, z: 0}
|
||||
agentTimeHorizon: 10
|
||||
obstacleTimeHorizon: 10
|
||||
maxNeighbours: 10
|
||||
--- !u!4 &1102796832
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1102796830}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1572356217}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1102796833
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1102796830}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9ed6c9606e7b4be7844512656ed3b2cd, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_nId: 0
|
||||
IsRunStart: 0
|
||||
isSyncInitSuccess: 0
|
||||
--- !u!1 &1237569553
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1237569556}
|
||||
- component: {fileID: 1237569555}
|
||||
- component: {fileID: 1237569554}
|
||||
m_Layer: 0
|
||||
m_Name: Plane (1)
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 4294967295
|
||||
m_IsActive: 1
|
||||
--- !u!23 &1237569554
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1237569553}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: b71b71b0a1f9a48768a27ca6eefcfbdf, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 0.8
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!33 &1237569555
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1237569553}
|
||||
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!4 &1237569556
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1237569553}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: -0.2, z: 0}
|
||||
m_LocalScale: {x: 62.877247, y: 1, z: 62.87725}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1572356216
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1572356217}
|
||||
- component: {fileID: 1572356220}
|
||||
- component: {fileID: 1572356218}
|
||||
m_Layer: 0
|
||||
m_Name: RVOSimulator
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1572356217
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1572356216}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1102796832}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &1572356218
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1572356216}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 6ac95c099f0e2ad4d90aa8dbf92a6f5d, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!33 &1572356220
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1572356216}
|
||||
m_Mesh: {fileID: 0}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 745bbb026c1abb64fa4063dd14cf313e
|
||||
guid: 6601635721611064e92978155e3f0134
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f098cad60c0316a4e8a36644a48953fb
|
||||
@@ -0,0 +1,631 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 3
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &4
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 12
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 1
|
||||
m_BakeResolution: 50
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 0
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 0
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 1024
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 1
|
||||
m_BakeBackend: 0
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 500
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 500
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 0
|
||||
m_PVRDenoiserTypeDirect: 0
|
||||
m_PVRDenoiserTypeIndirect: 0
|
||||
m_PVRDenoiserTypeAO: 0
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 0
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_LightingSettings: {fileID: 4890085278179872738, guid: afb103952459d2c46985f02d8c603b2e, type: 2}
|
||||
--- !u!196 &5
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 2
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666666
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
accuratePlacement: 0
|
||||
maxJobWorkers: 0
|
||||
preserveTilesOutsideBounds: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &157608482
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 157608483}
|
||||
- component: {fileID: 157608487}
|
||||
- component: {fileID: 157608485}
|
||||
- component: {fileID: 157608486}
|
||||
- component: {fileID: 157608484}
|
||||
m_Layer: 0
|
||||
m_Name: RVOSimulator
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &157608483
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 157608482}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &157608484
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 157608482}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 6ac95c099f0e2ad4d90aa8dbf92a6f5d, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!33 &157608485
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 157608482}
|
||||
m_Mesh: {fileID: 0}
|
||||
--- !u!114 &157608486
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 157608482}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: cd22169e5a88449fca9e480b59dae980, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_nId: 0
|
||||
IsRunStart: 0
|
||||
isSyncInitSuccess: 0
|
||||
agentCount: 300
|
||||
exampleScale: 80
|
||||
type: 0
|
||||
radius: 1.5
|
||||
maxSpeed: 5
|
||||
agentTimeHorizon: 2
|
||||
obstacleTimeHorizon: 10
|
||||
maxNeighbours: 10
|
||||
renderingOffset: {x: 0, y: 1, z: 0}
|
||||
debug: 0
|
||||
--- !u!114 &157608487
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 157608482}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1764de1de43cc4d19af52679d3eaae06, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_nId: 3
|
||||
IsRunStart: 0
|
||||
isSyncInitSuccess: 0
|
||||
version: 1
|
||||
desiredSimulationFPS: 20
|
||||
workerThreads: 0
|
||||
doubleBuffering: 1
|
||||
symmetryBreakingBias: 0.1
|
||||
movementPlane: 0
|
||||
drawObstacles: 0
|
||||
--- !u!1 &687969035
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 687969039}
|
||||
- component: {fileID: 687969038}
|
||||
- component: {fileID: 687969037}
|
||||
- component: {fileID: 687969036}
|
||||
m_Layer: 0
|
||||
m_Name: Plane
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 4294967295
|
||||
m_IsActive: 1
|
||||
--- !u!23 &687969036
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 687969035}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 8f4d5503fdeab441e8c6c041504cf535, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 0.8
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!64 &687969037
|
||||
MeshCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 687969035}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 4
|
||||
m_Convex: 0
|
||||
m_CookingOptions: 30
|
||||
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!33 &687969038
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 687969035}
|
||||
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!4 &687969039
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 687969035}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: -0.1, z: 0}
|
||||
m_LocalScale: {x: 62.87725, y: 1, z: 62.87725}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &910242485
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 910242486}
|
||||
- component: {fileID: 910242488}
|
||||
- component: {fileID: 910242489}
|
||||
- component: {fileID: 910242487}
|
||||
m_Layer: 0
|
||||
m_Name: Plane
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 4294967295
|
||||
m_IsActive: 1
|
||||
--- !u!4 &910242486
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 910242485}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: -0.2, z: 0}
|
||||
m_LocalScale: {x: 62.877247, y: 1, z: 62.87725}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &910242487
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 910242485}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 0
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: b71b71b0a1f9a48768a27ca6eefcfbdf, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 0.8
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!33 &910242488
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 910242485}
|
||||
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!64 &910242489
|
||||
MeshCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 910242485}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 4
|
||||
m_Convex: 0
|
||||
m_CookingOptions: 30
|
||||
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!1 &924212660
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 924212661}
|
||||
- component: {fileID: 924212662}
|
||||
- component: {fileID: 924212665}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &924212661
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 924212660}
|
||||
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 0, y: 151.15788, z: 0.000018019422}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!20 &924212662
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 924212660}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0.019607844}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 10
|
||||
far clip plane: 1400
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 100
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 0
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!124 &924212665
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 924212660}
|
||||
m_Enabled: 1
|
||||
--- !u!1 &1813726531
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1813726532}
|
||||
- component: {fileID: 1813726533}
|
||||
m_Layer: 0
|
||||
m_Name: Directional light
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1813726532
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1813726531}
|
||||
m_LocalRotation: {x: 0.3535534, y: 0.3535534, z: -0.14644665, w: 0.85355335}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!108 &1813726533
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1813726531}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 10
|
||||
m_Type: 1
|
||||
m_Shape: 0
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Intensity: 1.4
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
m_InnerSpotAngle: 21.80208
|
||||
m_CookieSize: 10
|
||||
m_Shadows:
|
||||
m_Type: 2
|
||||
m_Resolution: -1
|
||||
m_CustomResolution: -1
|
||||
m_Strength: 1
|
||||
m_Bias: 0.05
|
||||
m_NormalBias: 0.4
|
||||
m_NearPlane: 0.2
|
||||
m_CullingMatrixOverride:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
m_UseCullingMatrixOverride: 0
|
||||
m_Cookie: {fileID: 0}
|
||||
m_DrawHalo: 0
|
||||
m_Flare: {fileID: 0}
|
||||
m_RenderMode: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingLayerMask: 1
|
||||
m_Lightmapping: 1
|
||||
m_LightShadowCasterMode: 0
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 2
|
||||
m_ColorTemperature: 6570
|
||||
m_UseColorTemperature: 0
|
||||
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_UseBoundingSphereOverride: 0
|
||||
m_UseViewFrustumForShadowCasterCull: 1
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 10
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e0330a3995e1f64baf253a026021f09
|
||||
@@ -0,0 +1,64 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!850595691 &4890085278179872738
|
||||
LightingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: RVOLightweightSettings
|
||||
serializedVersion: 4
|
||||
m_GIWorkflowMode: 1
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_RealtimeEnvironmentLighting: 1
|
||||
m_BounceScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_UsingShadowmask: 0
|
||||
m_BakeBackend: 0
|
||||
m_LightmapMaxSize: 1024
|
||||
m_BakeResolution: 50
|
||||
m_Padding: 2
|
||||
m_LightmapCompression: 0
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 0
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAO: 0
|
||||
m_MixedBakeMode: 1
|
||||
m_LightmapsBakeMode: 1
|
||||
m_FilterMode: 1
|
||||
m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_RealtimeResolution: 1
|
||||
m_ForceWhiteAlbedo: 0
|
||||
m_ForceUpdates: 0
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherRayCount: 1024
|
||||
m_FinalGatherFiltering: 1
|
||||
m_PVRCulling: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 500
|
||||
m_PVREnvironmentSampleCount: 500
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_PVRBounces: 2
|
||||
m_PVRMinBounces: 2
|
||||
m_PVREnvironmentMIS: 0
|
||||
m_PVRFilteringMode: 0
|
||||
m_PVRDenoiserTypeDirect: 0
|
||||
m_PVRDenoiserTypeIndirect: 0
|
||||
m_PVRDenoiserTypeAO: 0
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_PVRTiledBaking: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afb103952459d2c46985f02d8c603b2e
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 4890085278179872738
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -17,7 +17,7 @@ GameObject:
|
||||
- component: {fileID: 4780769471509017217}
|
||||
- component: {fileID: 345950735762528131}
|
||||
- component: {fileID: 8400891744945266613}
|
||||
m_Layer: 8
|
||||
m_Layer: 0
|
||||
m_Name: Bot
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@@ -31,7 +31,6 @@ Transform:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 505715710780844734}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -18.12931, y: 0.049999997, z: 5.9419875}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
@@ -39,6 +38,7 @@ Transform:
|
||||
m_Children:
|
||||
- {fileID: 1290744670267477074}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &860618204808115368
|
||||
MonoBehaviour:
|
||||
@@ -53,9 +53,9 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_nId: 0
|
||||
IsRunStart: 0
|
||||
isSyncInitSuccess: 0
|
||||
allow:
|
||||
- {fileID: 6805233412966097210}
|
||||
allow: []
|
||||
--- !u!114 &5015953210996162854
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -69,6 +69,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_nId: 0
|
||||
IsRunStart: 0
|
||||
isSyncInitSuccess: 0
|
||||
version: 1
|
||||
drawGizmos: 1
|
||||
@@ -99,6 +100,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_nId: 0
|
||||
IsRunStart: 0
|
||||
isSyncInitSuccess: 0
|
||||
version: 1
|
||||
anim: {fileID: 1290744670276772796}
|
||||
@@ -111,17 +113,9 @@ CharacterController:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 505715710780844734}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
serializedVersion: 2
|
||||
m_Height: 0.87
|
||||
m_Radius: 0.35
|
||||
m_SlopeLimit: 45
|
||||
@@ -142,6 +136,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_nId: 0
|
||||
IsRunStart: 0
|
||||
isSyncInitSuccess: 0
|
||||
version: 1
|
||||
unwrap: 1
|
||||
@@ -159,6 +154,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_nId: 0
|
||||
IsRunStart: 0
|
||||
isSyncInitSuccess: 0
|
||||
version: 1
|
||||
target: {fileID: 0}
|
||||
@@ -176,6 +172,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_nId: 0
|
||||
IsRunStart: 0
|
||||
isSyncInitSuccess: 0
|
||||
key: 0
|
||||
isRobot: 0
|
||||
@@ -193,6 +190,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_nId: 0
|
||||
IsRunStart: 0
|
||||
isSyncInitSuccess: 0
|
||||
version: 5
|
||||
radius: 0.35
|
||||
@@ -229,28 +227,27 @@ PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 4954587615955870202}
|
||||
m_Modifications:
|
||||
- target: {fileID: 2402233671515968579, guid: 0b9c68ddd67ee5b9e8aeca86ac0fbc03, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 8
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2402233671515968581, guid: 0b9c68ddd67ee5b9e8aeca86ac0fbc03, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 8
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2402233671515968583, guid: 0b9c68ddd67ee5b9e8aeca86ac0fbc03, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 8
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2402233671515968585, guid: 0b9c68ddd67ee5b9e8aeca86ac0fbc03, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 8
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2402233671515968587, guid: 0b9c68ddd67ee5b9e8aeca86ac0fbc03, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 8
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2402233671515968589, guid: 0b9c68ddd67ee5b9e8aeca86ac0fbc03, type: 3}
|
||||
propertyPath: m_Name
|
||||
@@ -258,23 +255,23 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2402233671515968589, guid: 0b9c68ddd67ee5b9e8aeca86ac0fbc03, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 8
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2402233671515968591, guid: 0b9c68ddd67ee5b9e8aeca86ac0fbc03, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 8
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2402233671515968593, guid: 0b9c68ddd67ee5b9e8aeca86ac0fbc03, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 8
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2402233671515968595, guid: 0b9c68ddd67ee5b9e8aeca86ac0fbc03, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 8
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2402233671515968599, guid: 0b9c68ddd67ee5b9e8aeca86ac0fbc03, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 8
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2402233671516325997, guid: 0b9c68ddd67ee5b9e8aeca86ac0fbc03, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
@@ -320,17 +317,15 @@ PrefabInstance:
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2402233671523264387, guid: 0b9c68ddd67ee5b9e8aeca86ac0fbc03, type: 3}
|
||||
propertyPath: m_Enabled
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3959037364930862539, guid: 0b9c68ddd67ee5b9e8aeca86ac0fbc03, type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 8
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents:
|
||||
- targetCorrespondingSourceObject: {fileID: 2402233671515968589, guid: 0b9c68ddd67ee5b9e8aeca86ac0fbc03, type: 3}
|
||||
insertIndex: 1
|
||||
addedObject: {fileID: 8507333172764042117}
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 0b9c68ddd67ee5b9e8aeca86ac0fbc03, type: 3}
|
||||
--- !u!1 &1290744670267248754 stripped
|
||||
GameObject:
|
||||
@@ -350,6 +345,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_nId: 0
|
||||
IsRunStart: 0
|
||||
isSyncInitSuccess: 0
|
||||
allow: []
|
||||
--- !u!4 &1290744670267477074 stripped
|
||||
|
||||
@@ -0,0 +1,303 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 0
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 12
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 1
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 256
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 2
|
||||
m_BakeBackend: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 512
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 256
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 1
|
||||
m_PVRDenoiserTypeDirect: 1
|
||||
m_PVRDenoiserTypeIndirect: 1
|
||||
m_PVRDenoiserTypeAO: 1
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 1
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_LightingSettings: {fileID: 0}
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 2
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666667
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
accuratePlacement: 0
|
||||
maxJobWorkers: 0
|
||||
preserveTilesOutsideBounds: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &177470336
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 177470339}
|
||||
- component: {fileID: 177470338}
|
||||
- component: {fileID: 177470337}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &177470337
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 177470336}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &177470338
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 177470336}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &177470339
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 177470336}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1699817521
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1699817523}
|
||||
- component: {fileID: 1699817522}
|
||||
m_Layer: 0
|
||||
m_Name: Directional Light
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!108 &1699817522
|
||||
Light:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1699817521}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 10
|
||||
m_Type: 1
|
||||
m_Shape: 0
|
||||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
|
||||
m_Intensity: 1
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
m_InnerSpotAngle: 21.80208
|
||||
m_CookieSize: 10
|
||||
m_Shadows:
|
||||
m_Type: 2
|
||||
m_Resolution: -1
|
||||
m_CustomResolution: -1
|
||||
m_Strength: 1
|
||||
m_Bias: 0.05
|
||||
m_NormalBias: 0.4
|
||||
m_NearPlane: 0.2
|
||||
m_CullingMatrixOverride:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
m_UseCullingMatrixOverride: 0
|
||||
m_Cookie: {fileID: 0}
|
||||
m_DrawHalo: 0
|
||||
m_Flare: {fileID: 0}
|
||||
m_RenderMode: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingLayerMask: 1
|
||||
m_Lightmapping: 4
|
||||
m_LightShadowCasterMode: 0
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 1
|
||||
m_ColorTemperature: 6570
|
||||
m_UseColorTemperature: 0
|
||||
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_UseBoundingSphereOverride: 0
|
||||
m_UseViewFrustumForShadowCasterCull: 1
|
||||
m_ShadowRadius: 0
|
||||
m_ShadowAngle: 0
|
||||
--- !u!4 &1699817523
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1699817521}
|
||||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
|
||||
m_LocalPosition: {x: 0, y: 3, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 83bff39e9c87b454fa155d86020ca0bf
|
||||
guid: e7793c2a31991de4ba4d03f36dc06366
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -104,7 +104,7 @@ NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 3
|
||||
serializedVersion: 2
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
@@ -117,7 +117,7 @@ NavMeshSettings:
|
||||
cellSize: 0.16666667
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
buildHeightMesh: 0
|
||||
accuratePlacement: 0
|
||||
maxJobWorkers: 0
|
||||
preserveTilesOutsideBounds: 0
|
||||
debug:
|
||||
@@ -156,6 +156,7 @@ RectTransform:
|
||||
m_Children:
|
||||
- {fileID: 1291200674}
|
||||
m_Father: {fileID: 878636056}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0}
|
||||
m_AnchorMax: {x: 0.5, y: 0}
|
||||
@@ -287,6 +288,7 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2008468464}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
@@ -366,6 +368,7 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 878636056}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
@@ -414,6 +417,90 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 178957019}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &788835563
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 788835564}
|
||||
- component: {fileID: 788835566}
|
||||
- component: {fileID: 788835565}
|
||||
m_Layer: 5
|
||||
m_Name: Camera
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &788835564
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 788835563}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1911778722}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!81 &788835565
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 788835563}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &788835566
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 788835563}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 3
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 32
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!1 &878636052
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -490,9 +577,7 @@ Canvas:
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_VertexColorAlwaysGammaSpace: 0
|
||||
m_AdditionalShaderChannelsFlag: 0
|
||||
m_UpdateRectTransformForStandalone: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
@@ -514,99 +599,13 @@ RectTransform:
|
||||
- {fileID: 1188520222}
|
||||
- {fileID: 178957020}
|
||||
m_Father: {fileID: 1911778722}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!1 &923265418
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 923265421}
|
||||
- component: {fileID: 923265420}
|
||||
m_Layer: 5
|
||||
m_Name: Camera
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!20 &923265420
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 923265418}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 3
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_Iso: 200
|
||||
m_ShutterSpeed: 0.005
|
||||
m_Aperture: 16
|
||||
m_FocusDistance: 10
|
||||
m_FocalLength: 50
|
||||
m_BladeCount: 5
|
||||
m_Curvature: {x: 2, y: 11}
|
||||
m_BarrelClipping: 0.25
|
||||
m_Anamorphism: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!224 &923265421
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 923265418}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1911778722}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 197.5, y: 257}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &1035522521
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -618,7 +617,7 @@ GameObject:
|
||||
- component: {fileID: 1035522524}
|
||||
- component: {fileID: 1035522523}
|
||||
- component: {fileID: 1035522522}
|
||||
m_Layer: 0
|
||||
m_Layer: 5
|
||||
m_Name: EventSystem
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@@ -667,13 +666,13 @@ Transform:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1035522521}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1911778722}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1039426509
|
||||
GameObject:
|
||||
@@ -707,6 +706,7 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 878636056}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
@@ -840,6 +840,7 @@ RectTransform:
|
||||
m_Children:
|
||||
- {fileID: 1282136035}
|
||||
m_Father: {fileID: 878636056}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0}
|
||||
m_AnchorMax: {x: 0.5, y: 0}
|
||||
@@ -971,6 +972,7 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1188520222}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
@@ -1050,6 +1052,7 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 81288985}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
@@ -1109,7 +1112,7 @@ GameObject:
|
||||
- component: {fileID: 1911778722}
|
||||
- component: {fileID: 1911778721}
|
||||
- component: {fileID: 1911778723}
|
||||
m_Layer: 0
|
||||
m_Layer: 5
|
||||
m_Name: UIScene
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
@@ -1136,16 +1139,16 @@ Transform:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1911778720}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 878636056}
|
||||
- {fileID: 923265421}
|
||||
- {fileID: 788835564}
|
||||
- {fileID: 1035522524}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1911778723
|
||||
MonoBehaviour:
|
||||
@@ -1154,7 +1157,7 @@ MonoBehaviour:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1911778720}
|
||||
m_Enabled: 1
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e61b94b311b605b4195e022f5370e558, type: 3}
|
||||
m_Name:
|
||||
@@ -1196,6 +1199,7 @@ RectTransform:
|
||||
m_Children:
|
||||
- {fileID: 121702109}
|
||||
m_Father: {fileID: 878636056}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0}
|
||||
m_AnchorMax: {x: 0.5, y: 0}
|
||||
@@ -1296,8 +1300,3 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2008468463}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1660057539 &9223372036854775807
|
||||
SceneRoots:
|
||||
m_ObjectHideFlags: 0
|
||||
m_Roots:
|
||||
- {fileID: 1911778722}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Script.battle
|
||||
public class GBattleModeManager : SingletonScene<GBattleModeManager>
|
||||
{
|
||||
|
||||
private static readonly string[] Worlds = { "WorldSync01", };
|
||||
private static readonly string[] Worlds = { "GRVO01World", };
|
||||
|
||||
//当前模式
|
||||
private GBattleMode _current = GBattleMode.Not;
|
||||
@@ -65,6 +65,7 @@ namespace Script.battle
|
||||
await this.UnloadScene();
|
||||
await UniTask.NextFrame();
|
||||
App.Sync.OnReset();
|
||||
await UniTask.NextFrame();
|
||||
await this.LoadScene();
|
||||
_current = GBattleMode.Not;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f094965b882503b40a02f68c61d299bc
|
||||
guid: ee7bc7d3ccb485e48aa2fcfdaad83327
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -0,0 +1,270 @@
|
||||
using System.Collections.Generic;
|
||||
using Game.Plugins.App.Game.RVO;
|
||||
using Game.Plugins.App.Util;
|
||||
using Game.Plugins.JNGame.Sync.Frame.AStar.Util;
|
||||
using Game.Plugins.JNGame.Sync.Frame.AstarPath.RVO;
|
||||
using Pathfinding.Examples;
|
||||
using Pathfinding.RVO;
|
||||
using Script.battle;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Game.Script.battle.mode.Example11_RVO
|
||||
{
|
||||
|
||||
|
||||
public enum GRVO01WorldModeType {
|
||||
Circle,
|
||||
Line,
|
||||
Point,
|
||||
RandomStreams,
|
||||
Crossing
|
||||
}
|
||||
|
||||
public class GRVO01WorldMode : GBaseMode<Object>
|
||||
{
|
||||
|
||||
/// <summary>Number of agents created at start</summary>
|
||||
public int agentCount = 100;
|
||||
/// <summary>All agents handled by this script</summary>
|
||||
List<JNIAgent> agents;
|
||||
/// <summary>Goals for each agent</summary>
|
||||
List<Vector3> goals;
|
||||
/// <summary>Color for each agent</summary>
|
||||
List<Color> colors;
|
||||
|
||||
/// <summary>
|
||||
/// How large is the area where agents are placed.
|
||||
/// For e.g the circle example, it corresponds
|
||||
/// </summary>
|
||||
public float exampleScale = 100;
|
||||
/// <summary>Agent radius</summary>
|
||||
private float radius = 3;
|
||||
/// <summary>Max speed for an agent</summary>
|
||||
private float maxSpeed = 10;
|
||||
|
||||
/// <summary>
|
||||
/// Offset from the agent position the actual drawn postition.
|
||||
/// Used to get rid of z-buffer issues
|
||||
/// </summary>
|
||||
public Vector3 renderingOffset = Vector3.up*0.1f;
|
||||
|
||||
private GRVO01WorldModeType _type = GRVO01WorldModeType.Circle;
|
||||
|
||||
Vector3[] verts;
|
||||
Vector2[] uv;
|
||||
int[] tris;
|
||||
Color[] meshColors;
|
||||
Vector2[] interpolatedVelocities;
|
||||
Vector2[] interpolatedRotations;
|
||||
|
||||
|
||||
|
||||
/// <summary>How far in the future too look for agents</summary>
|
||||
public float agentTimeHorizon = 10;
|
||||
|
||||
[HideInInspector]
|
||||
/// <summary>How far in the future too look for obstacles</summary>
|
||||
public float obstacleTimeHorizon = 10;
|
||||
|
||||
/// <summary>Max number of neighbour agents to take into account</summary>
|
||||
public int maxNeighbours = 10;
|
||||
|
||||
public JNRVOSimulator Simulator => GetComponent<JNGRVOManager>().Simulator;
|
||||
|
||||
/// <summary>Mesh for rendering</summary>
|
||||
Mesh mesh;
|
||||
|
||||
public override void OnSyncLoad()
|
||||
{
|
||||
base.OnSyncLoad();
|
||||
mesh = new Mesh();
|
||||
GetComponentInChildren<MeshFilter>().mesh = mesh;
|
||||
CreateAgents(agentCount);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Create a number of agents in circle and restart simulation</summary>
|
||||
public void CreateAgents (int num) {
|
||||
this.agentCount = num;
|
||||
|
||||
agents = new List<JNIAgent>(agentCount);
|
||||
goals = new List<Vector3>(agentCount);
|
||||
colors = new List<Color>(agentCount);
|
||||
|
||||
Simulator.ClearAgents();
|
||||
|
||||
if (_type == GRVO01WorldModeType.Circle) {
|
||||
float circleRad = Mathf.Sqrt(agentCount * radius * radius * 4 / Mathf.PI) * exampleScale * 0.05f;
|
||||
|
||||
for (int i = 0; i < agentCount; i++) {
|
||||
Vector3 pos = new Vector3(Mathf.Cos(i * Mathf.PI * 2.0f / agentCount), 0, Mathf.Sin(i * Mathf.PI * 2.0f / agentCount)) * circleRad * (1 + JNRandom.value * 0.01f);
|
||||
JNIAgent agent = Simulator.AddAgent(new Vector2(pos.x, pos.z), pos.y);
|
||||
agents.Add(agent);
|
||||
goals.Add(-pos);
|
||||
colors.Add(AstarMath.HSVToRGB(i * 360.0f / agentCount, 0.8f, 0.6f));
|
||||
}
|
||||
} else if (_type == GRVO01WorldModeType.Line) {
|
||||
for (int i = 0; i < agentCount; i++) {
|
||||
Vector3 pos = new Vector3((i % 2 == 0 ? 1 : -1) * exampleScale, 0, (i / 2) * radius * 2.5f);
|
||||
JNIAgent agent = Simulator.AddAgent(new Vector2(pos.x, pos.z), pos.y);
|
||||
agents.Add(agent);
|
||||
goals.Add(new Vector3(-pos.x, pos.y, pos.z));
|
||||
colors.Add(i % 2 == 0 ? Color.red : Color.blue);
|
||||
}
|
||||
} else if (_type == GRVO01WorldModeType.Point) {
|
||||
for (int i = 0; i < agentCount; i++) {
|
||||
Vector3 pos = new Vector3(Mathf.Cos(i * Mathf.PI * 2.0f / agentCount), 0, Mathf.Sin(i * Mathf.PI * 2.0f / agentCount)) * exampleScale;
|
||||
JNIAgent agent = Simulator.AddAgent(new Vector2(pos.x, pos.z), pos.y);
|
||||
agents.Add(agent);
|
||||
goals.Add(new Vector3(0, pos.y, 0));
|
||||
colors.Add(AstarMath.HSVToRGB(i * 360.0f / agentCount, 0.8f, 0.6f));
|
||||
}
|
||||
} else if (_type == GRVO01WorldModeType.RandomStreams) {
|
||||
float circleRad = Mathf.Sqrt(agentCount * radius * radius * 4 / Mathf.PI) * exampleScale * 0.05f;
|
||||
|
||||
for (int i = 0; i < agentCount; i++) {
|
||||
float angle = JNRandom.value * Mathf.PI * 2.0f;
|
||||
float targetAngle = JNRandom.value * Mathf.PI * 2.0f;
|
||||
Vector3 pos = new Vector3(Mathf.Cos(angle), 0, Mathf.Sin(angle)) * uniformDistance(circleRad);
|
||||
JNIAgent agent = Simulator.AddAgent(new Vector2(pos.x, pos.z), pos.y);
|
||||
agents.Add(agent);
|
||||
goals.Add(new Vector3(Mathf.Cos(targetAngle), 0, Mathf.Sin(targetAngle)) * uniformDistance(circleRad));
|
||||
colors.Add(AstarMath.HSVToRGB(targetAngle * Mathf.Rad2Deg, 0.8f, 0.6f));
|
||||
}
|
||||
} else if (_type == GRVO01WorldModeType.Crossing) {
|
||||
float distanceBetweenGroups = exampleScale * radius * 0.5f;
|
||||
int directions = (int)Mathf.Sqrt(agentCount / 25f);
|
||||
directions = Mathf.Max(directions, 2);
|
||||
|
||||
const int AgentsPerDistance = 10;
|
||||
for (int i = 0; i < agentCount; i++) {
|
||||
float angle = ((i % directions)/(float)directions) * Mathf.PI * 2.0f;
|
||||
var dist = distanceBetweenGroups * ((i/(directions*AgentsPerDistance) + 1) + 0.3f*JNRandom.value);
|
||||
Vector3 pos = new Vector3(Mathf.Cos(angle), 0, Mathf.Sin(angle)) * dist;
|
||||
JNIAgent agent = Simulator.AddAgent(new Vector2(pos.x, pos.z), pos.y);
|
||||
agent.Priority = (i % directions) == 0 ? 1 : 0.01f;
|
||||
agents.Add(agent);
|
||||
goals.Add(-pos.normalized * distanceBetweenGroups * 3);
|
||||
colors.Add(AstarMath.HSVToRGB(angle * Mathf.Rad2Deg, 0.8f, 0.6f));
|
||||
}
|
||||
}
|
||||
|
||||
SetAgentSettings();
|
||||
|
||||
verts = new Vector3[4*agents.Count];
|
||||
uv = new Vector2[verts.Length];
|
||||
tris = new int[agents.Count*2*3];
|
||||
meshColors = new Color[verts.Length];
|
||||
}
|
||||
|
||||
void SetAgentSettings () {
|
||||
for (int i = 0; i < agents.Count; i++) {
|
||||
JNIAgent agent = agents[i];
|
||||
agent.Radius = radius;
|
||||
agent.AgentTimeHorizon = agentTimeHorizon;
|
||||
agent.ObstacleTimeHorizon = obstacleTimeHorizon;
|
||||
agent.MaxNeighbours = maxNeighbours;
|
||||
// agent.DebugDraw = i == 0 && debug;
|
||||
}
|
||||
}
|
||||
|
||||
private float uniformDistance (float radius) {
|
||||
float v = JNRandom.value + JNRandom.value;
|
||||
|
||||
if (v > 1) return radius * (2-v);
|
||||
else return radius * v;
|
||||
}
|
||||
|
||||
|
||||
public override void OnSyncUpdate(int dt, JNFrameInfo frame, Object input)
|
||||
{
|
||||
base.OnSyncUpdate(dt, frame, input);
|
||||
if (agents == null || mesh == null) return;
|
||||
|
||||
if (agents.Count != goals.Count) {
|
||||
Debug.LogError("Agent count does not match goal count");
|
||||
return;
|
||||
}
|
||||
|
||||
SetAgentSettings();
|
||||
|
||||
// Make sure the array is large enough
|
||||
if (interpolatedVelocities == null || interpolatedVelocities.Length < agents.Count) {
|
||||
var velocities = new Vector2[agents.Count];
|
||||
var directions = new Vector2[agents.Count];
|
||||
// Copy over the old velocities
|
||||
if (interpolatedVelocities != null) for (int i = 0; i < interpolatedVelocities.Length; i++) velocities[i] = interpolatedVelocities[i];
|
||||
if (interpolatedRotations != null) for (int i = 0; i < interpolatedRotations.Length; i++) directions[i] = interpolatedRotations[i];
|
||||
interpolatedVelocities = velocities;
|
||||
interpolatedRotations = directions;
|
||||
}
|
||||
|
||||
for (int i = 0; i < agents.Count; i++) {
|
||||
JNIAgent agent = agents[i];
|
||||
|
||||
// Move agent
|
||||
// This is the responsibility of this script, not the RVO system
|
||||
Vector2 pos = agent.Position;
|
||||
var deltaPosition = Vector2.ClampMagnitude(agent.CalculatedTargetPoint - pos, agent.CalculatedSpeed * GetSync().Time.deltaTime);
|
||||
pos += deltaPosition;
|
||||
agent.Position = pos;
|
||||
|
||||
// All agents are on the same plane
|
||||
agent.ElevationCoordinate = 0;
|
||||
|
||||
// Set the desired velocity for all agents
|
||||
var target = new Vector2(goals[i].x, goals[i].z);
|
||||
var dist = (target - pos).magnitude;
|
||||
agent.SetTarget(target, Mathf.Min(dist, maxSpeed), maxSpeed*1.1f);
|
||||
|
||||
interpolatedVelocities[i] += deltaPosition;
|
||||
if (interpolatedVelocities[i].magnitude > maxSpeed*0.1f) {
|
||||
interpolatedVelocities[i] = Vector2.ClampMagnitude(interpolatedVelocities[i], maxSpeed*0.1f);
|
||||
interpolatedRotations[i] = Vector2.Lerp(interpolatedRotations[i], interpolatedVelocities[i], agent.CalculatedSpeed * GetSync().Time.deltaTime*4f);
|
||||
}
|
||||
|
||||
//Debug.DrawRay(new Vector3(pos.x, 0, pos.y), new Vector3(interpolatedVelocities[i].x, 0, interpolatedVelocities[i].y) * 10);
|
||||
// Create a square with the "forward" direction along the agent's velocity
|
||||
Vector3 forward = new Vector3(interpolatedRotations[i].x, 0, interpolatedRotations[i].y).normalized * agent.Radius;
|
||||
if (forward == Vector3.zero) forward = new Vector3(0, 0, agent.Radius);
|
||||
Vector3 right = Vector3.Cross(Vector3.up, forward);
|
||||
Vector3 orig = new Vector3(agent.Position.x, agent.ElevationCoordinate, agent.Position.y) + renderingOffset;
|
||||
|
||||
|
||||
int vc = 4*i;
|
||||
int tc = 2*3*i;
|
||||
verts[vc+0] = (orig + forward - right);
|
||||
verts[vc+1] = (orig + forward + right);
|
||||
verts[vc+2] = (orig - forward + right);
|
||||
verts[vc+3] = (orig - forward - right);
|
||||
|
||||
uv[vc+0] = (new Vector2(0, 1));
|
||||
uv[vc+1] = (new Vector2(1, 1));
|
||||
uv[vc+2] = (new Vector2(1, 0));
|
||||
uv[vc+3] = (new Vector2(0, 0));
|
||||
|
||||
meshColors[vc+0] = colors[i];
|
||||
meshColors[vc+1] = colors[i];
|
||||
meshColors[vc+2] = colors[i];
|
||||
meshColors[vc+3] = colors[i];
|
||||
|
||||
tris[tc+0] = (vc + 0);
|
||||
tris[tc+1] = (vc + 1);
|
||||
tris[tc+2] = (vc + 2);
|
||||
|
||||
tris[tc+3] = (vc + 0);
|
||||
tris[tc+4] = (vc + 2);
|
||||
tris[tc+5] = (vc + 3);
|
||||
}
|
||||
|
||||
//Update the mesh
|
||||
mesh.Clear();
|
||||
mesh.vertices = verts;
|
||||
mesh.uv = uv;
|
||||
mesh.colors = meshColors;
|
||||
mesh.triangles = tris;
|
||||
mesh.RecalculateNormals();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5b7cdf57c8619a40b108b66c4308c5e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -83,7 +83,7 @@ public class GWorldSync01UI : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if(this.Cam != null)
|
||||
this.Cam.enabled = !App.Sync.IsLoop;
|
||||
// if(this.Cam != null)
|
||||
// this.Cam.enabled = !App.Sync.IsLoop;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,16 +56,5 @@ namespace Game.Script.battle.mode.GWorldSync01ModeScript
|
||||
|
||||
}
|
||||
|
||||
|
||||
//这里直接每帧调用更新位置 理论上 下面这些代码是写在UI上的 现在为了方便直接调了
|
||||
private void Update()
|
||||
{
|
||||
UpdateTargetPosition();
|
||||
}
|
||||
|
||||
public void UpdateTargetPosition () {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>BepuPhysics</id>
|
||||
<version>2.3.4</version>
|
||||
<authors>Ross Nordby</authors>
|
||||
<license type="expression">Apache-2.0</license>
|
||||
<licenseUrl>https://licenses.nuget.org/Apache-2.0</licenseUrl>
|
||||
<icon>bepuphysicslogo256.png</icon>
|
||||
<projectUrl>https://github.com/bepu/bepuphysics2</projectUrl>
|
||||
<description>Speedy real time physics simulation library.</description>
|
||||
<copyright>© Bepu Entertainment LLC</copyright>
|
||||
<tags>physics 3d rigid body real time simulation</tags>
|
||||
<repository url="https://github.com/bepu/bepuphysics2" />
|
||||
<dependencies>
|
||||
<group targetFramework=".NETStandard2.0">
|
||||
<dependency id="BepuUtilities" version="2.3.4" exclude="Build,Analyzers" />
|
||||
</group>
|
||||
</dependencies>
|
||||
</metadata>
|
||||
</package>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 41 KiB |
@@ -1,140 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d0d461b18d011e4e96f4e2bd53f9a9d
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
-23
@@ -1,23 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67bae28016d9a154c8de54a1228de0bf
|
||||
labels:
|
||||
- NuGetForUnity
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
-6303
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>BepuUtilities</id>
|
||||
<version>2.3.4</version>
|
||||
<authors>Ross Nordby</authors>
|
||||
<license type="expression">Apache-2.0</license>
|
||||
<licenseUrl>https://licenses.nuget.org/Apache-2.0</licenseUrl>
|
||||
<icon>bepuphysicslogo256.png</icon>
|
||||
<projectUrl>https://github.com/bepu/bepuphysics2</projectUrl>
|
||||
<description>Supporting utilities library for BEPUphysics v2.</description>
|
||||
<copyright>© Bepu Entertainment LLC</copyright>
|
||||
<repository url="https://github.com/bepu/bepuphysics2" />
|
||||
<dependencies>
|
||||
<group targetFramework=".NETStandard2.0">
|
||||
<dependency id="System.Memory" version="4.5.4" exclude="Build,Analyzers" />
|
||||
<dependency id="System.Numerics.Vectors" version="4.5.0" exclude="Build,Analyzers" />
|
||||
<dependency id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" exclude="Build,Analyzers" />
|
||||
</group>
|
||||
</dependencies>
|
||||
</metadata>
|
||||
</package>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 41 KiB |
@@ -1,140 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e408c137718b826488a2a60c35e88a4b
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 12
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Server
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Binary file not shown.
-23
@@ -1,23 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3581c68fb30ce4641af7b64238201135
|
||||
labels:
|
||||
- NuGetForUnity
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
-4105
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user