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.
79 lines
3.3 KiB
79 lines
3.3 KiB
using System.Collections.Generic;
|
|
using Entitas;
|
|
using UnityEngine;
|
|
|
|
namespace CoreGame.Render
|
|
{
|
|
public class CurveBulletSys : IExecuteSystem
|
|
{
|
|
private readonly IGroup<CombatEntity> m_CurveBulletGroup;
|
|
private readonly List<CombatEntity> m_CacheEntities = new List<CombatEntity>();
|
|
|
|
public CurveBulletSys(CombatContext context)
|
|
{
|
|
m_CurveBulletGroup = context.GetGroup(CombatMatcher.CurveBullet);
|
|
}
|
|
|
|
public void Execute(float deltaTime)
|
|
{
|
|
// m_CurveBulletGroup.GetEntities(m_CacheEntities);
|
|
// for (var i = 0; i < m_CacheEntities.Count; i++)
|
|
// {
|
|
// var bulletEnt = m_CacheEntities[i];
|
|
// var bc = bulletEnt.bullet;
|
|
//
|
|
// var curveBullet = bulletEnt.curveBullet;
|
|
// curveBullet.accumulatedTime += deltaTime;
|
|
//
|
|
// var start = curveBullet.origin;
|
|
// var end = curveBullet.destination;
|
|
// var control = curveBullet.control;
|
|
// var t = curveBullet.accumulatedTime / curveBullet.totalTime;
|
|
//
|
|
// var pos = Mathf.Pow(1 - t, 2) * start + 2 * t * (1 - t) * control + Mathf.Pow(t, 2) * end;
|
|
// var transformProxy = bulletEnt.transformProxy;
|
|
// var dir = (pos - transformProxy.position).normalized;
|
|
//
|
|
// transformProxy.SetDirection(dir);
|
|
// transformProxy.SetPosition(pos);
|
|
//
|
|
// if (curveBullet.accumulatedTime >= curveBullet.totalTime)
|
|
// {
|
|
// BulletSrv.InvalidateBullet(bulletEnt);
|
|
// BulletSrv.BulletSkillCast(bulletEnt, 0, transformProxy.position, bc.abilityId);
|
|
// if (bc.endAbilityId != 0)
|
|
// {
|
|
// BulletSrv.BulletSkillCast(bulletEnt, 0, transformProxy.position, bc.endAbilityId);
|
|
// }
|
|
// continue;
|
|
// }
|
|
//
|
|
// var deltaDis = bc.speed * deltaTime;
|
|
// var prop = bulletEnt.property;
|
|
// var disAcc = prop.GetProperty(PropertyDef.BulletFlyDistanceAcc);
|
|
// disAcc += deltaDis;
|
|
// prop.SetProperty(PropertyDef.BulletFlyDistanceAcc, disAcc, true);
|
|
// bc.distanceAcc += deltaDis;
|
|
// if (bc.maxDistance <= bc.distanceAcc)
|
|
// {
|
|
// if (bc.isTriggerHitSkillOnEnd || bc.endAbilityId != 0)
|
|
// {
|
|
// BulletSrv.InvalidateBullet(bulletEnt);
|
|
// if (bc.isTriggerHitSkillOnEnd)
|
|
// {
|
|
// BulletSrv.BulletSkillCast(bulletEnt, 0, transformProxy.position, bc.abilityId);
|
|
// }
|
|
// if (bc.endAbilityId != 0)
|
|
// {
|
|
// BulletSrv.BulletSkillCast(bulletEnt, 0, transformProxy.position, bc.endAbilityId);
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// BulletSrv.DestroyBullet(bulletEnt);
|
|
// }
|
|
// }
|
|
// }
|
|
}
|
|
}
|
|
}
|