2
0
Fork 0

技能参数优化 分帧结算优化

master
cd 2 years ago
parent 9e14c4e222
commit 62be5e82c9

@ -1475,7 +1475,7 @@ PlayableDirector:
m_GameObject: {fileID: 1645380337361164332}
m_Enabled: 1
serializedVersion: 3
m_PlayableAsset: {fileID: 11400000, guid: 8e366474e9fd2bd42a7661307d935cd3, type: 2}
m_PlayableAsset: {fileID: 11400000, guid: c1797a25beab8924885805980777dd56, type: 2}
m_InitialState: 0
m_WrapMode: 2
m_DirectorUpdateMode: 1
@ -1615,6 +1615,20 @@ PlayableDirector:
value: {fileID: 1645380337361164335}
- key: {fileID: 2359698281133013487, guid: 8ade9e6ed33a1ba4c895aac2250ea577, type: 2}
value: {fileID: 1645380337361164335}
- key: {fileID: -4824941642191393376, guid: 43c07429006d87d45bdccfa50b7641b9, type: 2}
value: {fileID: 5972941309607553105}
- key: {fileID: -4750574827767443630, guid: 43c07429006d87d45bdccfa50b7641b9, type: 2}
value: {fileID: 1645380337361164335}
- key: {fileID: -4824941642191393376, guid: 64536f40264920c45a5087983be0ace7, type: 2}
value: {fileID: 5972941309607553105}
- key: {fileID: -4750574827767443630, guid: 64536f40264920c45a5087983be0ace7, type: 2}
value: {fileID: 1645380337361164335}
- key: {fileID: -4824941642191393376, guid: 0e3790cb939be9d41ae7980a540ea01a, type: 2}
value: {fileID: 5972941309607553105}
- key: {fileID: -4750574827767443630, guid: 0e3790cb939be9d41ae7980a540ea01a, type: 2}
value: {fileID: 1645380337361164335}
- key: {fileID: 2359698281133013487, guid: 3288bbd90725c2944a49f99a81cc1fee, type: 2}
value: {fileID: 1645380337361164335}
m_ExposedReferences:
m_References: []
--- !u!212 &89448210413526911

@ -65,7 +65,7 @@ public class SettleSystem : IExecuteSystem, IInitializeSystem
SettleScale(flowSpeed, entity, target); //抖动
SettleGlobalEffect(target, pauseTime); //全局特效
return true;
return !hitInfo.Continue;
}
public struct SettleDamageResult
@ -282,7 +282,7 @@ public class SettleSystem : IExecuteSystem, IInitializeSystem
targetPos = raycastHit.point;
}
move.Position = targetPos;
Util.SetEntityPos(target, targetPos);
return flowSpeed;
}
@ -324,7 +324,7 @@ public class SettleSystem : IExecuteSystem, IInitializeSystem
}
//单次攻击命中多目标:每2帧结算一次
var isLastHit = hitInfo.hitIndex == hitInfo.hitCount - 1;
var isLastHit = hitInfo.HitIndex == hitInfo.HitCount - 1;
if (isLastHit)
Util.EntityPause(entity, pauseTime, false);
else

@ -9,19 +9,21 @@ namespace Game
public AttackBehaviour SkillParam;
public Vector3 HitDir;
public int OwnerEntity;
public int HitEntity; //0为非实体对象
public int HitEntity;
public float AttackRate;
public float StunkRate;
public string SkillId; //是否技能造成的伤害
public bool IsBreak;
public int hitIndex;
public int hitCount;
public int HitIndex;
public int HitCount;
public float Rank;
public bool Continue;
}
public class ClipAttack : TimelineClipBase
{
private AttackClip _mRealAsset;
private List<GameEntity> _tempTargetList = new List<GameEntity>();
private readonly List<SkillHitInfo> _tempHitInfoList = new List<SkillHitInfo>();
public override void OnEnter()
{
@ -33,47 +35,41 @@ namespace Game
var param = _mRealAsset.template;
var skill = Owner.skill;
var castShape = param.Shape;
var castDir = skill.CastDir;
castDir = new Vector3(castDir.x, 0, castDir.z); //忽略y
var castDir = Util.IgnoreY(skill.CastDir);
var rot = Quaternion.FromToRotation(Vector3.right, castDir);
var castPos = rot * castShape.Offset + Owner.Pos();
Util.DrawShape(castShape, castPos, castDir, Color.red);
_tempTargetList.Clear();
_tempHitInfoList.Clear();
var (rankMin, rankMax) = (float.MaxValue, float.MinValue);
Util.ForeachEnemies(Owner.Team(), target =>
{
//检测命中
var isHit = UtilShape.IsOverlap(castShape, castPos, castDir, target.hp.HitBoxShape, target.Pos());
if (!isHit) return;
//排除重复命中
var hitKey = new Tuple<int, int>(target.ID(), param.hitId);
if (skill.HitSet.Contains(hitKey)) return;
skill.HitSet.Add(hitKey);
_tempTargetList.Add(target);
});
_tempTargetList.Sort((l, r) =>
{
var lRank = GetRank(param.hitOrderType, l, castPos, castDir);
var rRank = GetRank(param.hitOrderType, r, castPos, castDir);
return lRank.CompareTo(rRank);
});
var hitNum = _tempTargetList.Count;
for (var i = 0; i < hitNum; i++)
{
var target = _tempTargetList[i];
var targetID = target.ID();
//计算结算顺序rank
var rank = GetRank(param.hitOrderType, target, castPos, castDir);
if (rank < rankMin) rankMin = rank;
if (rank > rankMax) rankMax = rank;
var skillHitInfo = new SkillHitInfo
{
SkillParam = param,
AttackRate = 1,
StunkRate = 1,
OwnerEntity = Owner.ID(),
HitEntity = targetID,
HitEntity = target.ID(),
HitDir = GetHitDir(param.hitDirType, target, castPos, castDir),
SkillId = skill.SkillId.Value,
IsBreak = true,
hitIndex = i,
hitCount = hitNum
Rank = rank,
};
if (!string.IsNullOrEmpty(skillHitInfo.SkillId))
{
@ -86,7 +82,31 @@ namespace Game
}
}
skill.HitInfo.Enqueue(skillHitInfo);
_tempHitInfoList.Add(skillHitInfo);
});
_tempHitInfoList.Sort((l, r) => l.Rank.CompareTo(r.Rank));
var hitNum = _tempHitInfoList.Count;
var rankGroup = 0;
var rankRange = rankMax - rankMin; //rank范围大小
var rankRangeEach = rankRange / GameConst.HitMaxSettle; //单个group的rank范围大小
for (var i = 0; i < hitNum; i++)
{
var info = _tempHitInfoList[i];
info.HitIndex = i;
info.HitCount = hitNum;
var rate = (info.Rank - rankMin) / rankRange;
if (rate > rankGroup * rankRangeEach)
{
rankGroup++;
}
else
{
info.Continue = true;
}
Util.Print(info.Continue);
skill.HitInfo.Enqueue(info);
}
}

@ -11,6 +11,11 @@ namespace Game
var rot = Quaternion.FromToRotation(vector, Vector3.right);
return rot.eulerAngles.y;
}
public static Vector3 IgnoreY(Vector3 vector)
{
return new Vector3(vector.x, 0, vector.z);
}
public static Quaternion Rot2Quaternion(float rot)
{
return Quaternion.AngleAxis(rot, Vector3.forward);

@ -22,6 +22,7 @@ namespace Game
public const float AIDirectorTick = 1.0f; //导演ai更新频率
public const float MasterSoulShootTime = 0.1f; //麻薯射击间隔 秒
public const float MasterSoulShootPreTime = 0.5f; //麻薯射击前摇 秒
public const int HitMaxSettle = 4; //单次hit结算最大数量
//表现 全局
public const float DyingTime = 1f; //死亡到实体删除的时间 用于死亡表现 秒

File diff suppressed because it is too large Load Diff

@ -875,7 +875,7 @@ MonoBehaviour:
m_Name: AttackClip
m_EditorClassIdentifier:
template:
flowSpeed: {x: 2, y: 2, z: 0}
flowSpeed: {x: 2, y: 3, z: 0}
flowTime: 0
isFlow: 1
damageRate: 1

@ -500,7 +500,7 @@ MonoBehaviour:
m_Children: []
m_Clips:
- m_Version: 1
m_Start: 0.3
m_Start: 0.31666666666666665
m_ClipIn: 0
m_Asset: {fileID: 4898924959087489963}
m_Duration: 0.09999999999999995
@ -592,7 +592,7 @@ MonoBehaviour:
m_Children: []
m_Clips:
- m_Version: 1
m_Start: 0.26666666666666666
m_Start: 0.2833333333333333
m_ClipIn: 0
m_Asset: {fileID: -7113577540930210310}
m_Duration: 0.11666666666666668
@ -875,7 +875,7 @@ MonoBehaviour:
m_Name: AttackClip
m_EditorClassIdentifier:
template:
flowSpeed: {x: 2, y: 3, z: 0}
flowSpeed: {x: 2, y: 3.5, z: 0}
flowTime: 0
isFlow: 1
damageRate: 1

@ -657,7 +657,7 @@ MonoBehaviour:
damageRate: 0
stunRate: 0
staggerLevel: 2
pauseTime: 10
pauseTime: 5
hitId: 0
hitType: 0
hitOrderType: 3

@ -718,7 +718,7 @@ MonoBehaviour:
damageRate: 1
stunRate: 1
staggerLevel: 2
pauseTime: 3
pauseTime: 1
hitId: 0
hitType: 0
hitOrderType: 3

@ -695,7 +695,7 @@ MonoBehaviour:
damageRate: 1
stunRate: 1
staggerLevel: 2
pauseTime: 2
pauseTime: 1
hitId: 0
hitType: 0
hitOrderType: 4

@ -906,7 +906,7 @@ MonoBehaviour:
damageRate: 0.8
stunRate: 0.6
staggerLevel: 2
pauseTime: 2
pauseTime: 1
hitId: 0
hitType: 0
hitOrderType: 3

@ -817,7 +817,7 @@ MonoBehaviour:
damageRate: 0.2
stunRate: 0
staggerLevel: 2
pauseTime: 5
pauseTime: 4
hitId: 0
hitType: 1
hitOrderType: 1
@ -1061,7 +1061,7 @@ MonoBehaviour:
damageRate: 2
stunRate: 3
staggerLevel: 3
pauseTime: 10
pauseTime: 8
hitId: 5
hitType: 0
hitOrderType: 1

@ -566,7 +566,6 @@ MonoBehaviour:
- {fileID: -7181903175280796925}
- {fileID: 4060734623337436353}
- {fileID: -8975061038928450328}
- {fileID: 2185900465168802046}
m_FixedDuration: 0.9
m_EditorSettings:
m_Framerate: 60

@ -67,7 +67,7 @@ MonoBehaviour:
hitId: 1
hitType: 0
hitOrderType: 3
hitDirType: 7
hitDirType: 1
Type: 2
Offset: {x: 0, y: 0, z: 0}
Height: 2.5

@ -815,7 +815,7 @@ MonoBehaviour:
damageRate: 0
stunRate: 0
staggerLevel: 2
pauseTime: 0
pauseTime: 10
hitId: 0
hitType: 0
hitOrderType: 4

Loading…
Cancel
Save