简单重构拆分 SimulationWorld
This commit is contained in:
+29
-9
@@ -1,5 +1,6 @@
|
||||
using SepCore.Components;
|
||||
using SepCore.Entity;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SepCore.Simulation
|
||||
@@ -25,7 +26,7 @@ namespace SepCore.Simulation
|
||||
|
||||
float attackRange = enemy.AttackRange > 0f
|
||||
? enemy.AttackRange
|
||||
: DefaultAttackRange;
|
||||
: EnemyAttackSim.DefaultAttackRange;
|
||||
|
||||
return new EnemySimData
|
||||
{
|
||||
@@ -38,8 +39,7 @@ namespace SepCore.Simulation
|
||||
AvoidEnemyOverlap = movementComponent != null && movementComponent.AvoidEnemyOverlap,
|
||||
EnemyBodyRadius = movementComponent != null ? movementComponent.EnemyBodyRadius : 0.45f,
|
||||
SeparationIterations = movementComponent != null ? movementComponent.SeparationIterations : 2,
|
||||
TargetType = 0,
|
||||
State = EnemyStateIdle
|
||||
State = EnemyBehaviorSim.StateIdle
|
||||
};
|
||||
}
|
||||
|
||||
@@ -83,12 +83,9 @@ namespace SepCore.Simulation
|
||||
Position = projectileEntity.CachedTransform.position,
|
||||
Forward = forward,
|
||||
Velocity = velocity,
|
||||
Speed = speed,
|
||||
LifeTime = lifeTime,
|
||||
Age = 0f,
|
||||
Active = true,
|
||||
RemainingLifetime = lifeTime,
|
||||
State = ProjectileStateActive
|
||||
Active = true
|
||||
};
|
||||
}
|
||||
|
||||
@@ -98,11 +95,34 @@ namespace SepCore.Simulation
|
||||
{
|
||||
EntityId = pickupEntity.Id,
|
||||
Position = pickupEntity.CachedTransform.position,
|
||||
PickupRadius = 0.35f,
|
||||
State = 0
|
||||
PickupRadius = 0.35f
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Component Conversion
|
||||
|
||||
private static float3 ToFloat3(Vector3 value)
|
||||
{
|
||||
return new float3(value.x, value.y, value.z);
|
||||
}
|
||||
|
||||
private static Vector3 ToVector3(float3 value)
|
||||
{
|
||||
return new Vector3(value.x, value.y, value.z);
|
||||
}
|
||||
|
||||
private static quaternion ToQuaternion(Quaternion value)
|
||||
{
|
||||
return new quaternion(value.x, value.y, value.z, value.w);
|
||||
}
|
||||
|
||||
private static Quaternion ToQuaternion(quaternion value)
|
||||
{
|
||||
return new Quaternion(value.value.x, value.value.y, value.value.z, value.value.w);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user