public static void CreateBattleBullet(DataConfig.BULLET_TYPE type, UnitFire.ShootParam shoot) { string resName = AppConfig.FOLDER_PROFAB + "bullet/bullet" + (int)type; GameObject obj = ResourceHelper.Load(resName); AddUnitToLayer(obj, BattleConfig.LAYER.BULLET); obj.GetComponent <Bullet> ().Create(shoot); }
// ================================================== // HUD public static void CreateHUDDamageText(UnitFire.ShootParam shoot) { // GameObject miss = ResourceHelper.Load (AppConfig.FOLDER_PROFAB_EFFECT + "Ctrl"); // miss.transform.position = shoot.target.transform.position + new Vector3 (0, HINT_TEXT_HEIGHT, 0); string text = "-" + Mathf.FloorToInt(shoot.damage); Vector3 position = shoot.target.transform.position + new Vector3(0, HINT_TEXT_HEIGHT, 0); float scale = shoot.isDoubleDamage ? 1.5f : 1; new PopupNumber(text, PopupNumber.COLOR.RED, position, scale); }
public void BeHurt(UnitFire.ShootParam shootParam) { if (!isDead) { BattleFactory.CreateHUDDamageText(shootParam); unit.currentHp = Mathf.Max(unit.currentHp - shootParam.damage, 0); if (unit.currentHp <= 0) { ToDead(); } _targetSelect.BeHurt(shootParam); } }
private void CreateDamage() { List <Unit> enemies = BattleGame.instance.unitGroup.enemyUnits; foreach (Unit tank in enemies) { if (!tank.isDead) { if (UnitHelper.IsTouchEdge(tank, transform.position, _skill.GetDataSkill().effectRange)) { UnitFire.ShootParam param = new UnitFire.ShootParam(); param.damage = _skill.GetDataSkill().effect; param.target = tank; new BulletDamage(param, transform.position); } } } }
public BulletDamage(UnitFire.ShootParam shoot, Vector3 position) { if (shoot.attacker != null && shoot.attacker.unit.dataUnit.damageRange > 0) { List <Unit> enemy = BattleGame.instance.unitGroup.GetOpponents(shoot.attacker.team); foreach (Unit u in enemy) { Vector3 v = u.transform.position - position; if (v.magnitude <= shoot.attacker.unit.dataUnit.damageRange) { u.BeHurt(shoot); } } } else { shoot.target.BeHurt(shoot); } }
// ========================================================================== // create flow public void Create(UnitFire.ShootParam shoot) { _shoot = shoot; ShootBegan(); }