You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

71 lines
2.2 KiB

using System.Collections.Generic;
using Entitas;
using Sog;
using UnityEngine;
namespace CoreGame.Render
{
// 子弹来源类型
// 后两位当类型吧, 01 枪
public class HitData : ISptPool
{
public int targetEid;
public float hitTime;
public Vector2 hitPos;
public Vector2 hitDir;
public void Awake(int targetEid, float hitTime, Vector2 hitPos, Vector2 hitDir)
{
this.targetEid = targetEid;
this.hitTime = hitTime;
this.hitPos = hitPos;
this.hitDir = hitDir;
}
public void Reset()
{
}
}
[Combat]
public class BulletComponent : IComponent, IReset
{
public int casterEid;
public ElementType elementType;
public BulletFromType bulletFromType;
public int bulletCfgId;
public Fixed64 existTime;
public Fixed64 maxDistance;
public Fixed64 scale;
public Fixed64 speed;// 变参,子弹类型为direct或curve时为飞行速度,子弹类型是surround时为角速度
public ColliderType colliderType;
public Fixed64 colliderParam1; // colliderType为circle时为半径,为rect时为宽
public Fixed64 colliderParam2; // colliderType为 rect时为长
public int collideWith;
public int collisionCnt; // 撞击次数
public Fixed64 collisionInterval; // 撞击生效间隔
public int abilityId;
public int endAbilityId;
public bool isTriggerHitSkillOnEnd;
public List<HitData> hitDatas;
internal bool hasInvalidated;
internal int invalidatedCount;
internal Fixed64 existTimeAcc;
internal Fixed64 distanceAcc;
internal int collisionTimesAcc;
public void Reset()
{
hasInvalidated = false;
invalidatedCount = 0;
existTimeAcc = 0f;
distanceAcc = 0f;
collisionTimesAcc = 0;
for (int i = 0; i < hitDatas.Count; i++)
{
var hasHitEid = hitDatas[i];
SptPool<HitData>.Free(ref hasHitEid);
}
ListPool<HitData>.Push(ref hitDatas);
}
}
}