66 lines
2.1 KiB
C++
66 lines
2.1 KiB
C++
#pragma once
|
|
|
|
struct GridCell;
|
|
class Entity;
|
|
class Room;
|
|
class Obstacle;
|
|
class VirtualBullet : public IBullet
|
|
{
|
|
public:
|
|
int shot_uniid = 0;
|
|
int bullet_uniid = 0;
|
|
long long weapon_uniid = 0;
|
|
const mt::Skill* skill_meta = nullptr;
|
|
const mt::Equip* gun_meta = nullptr;
|
|
const mt::Equip* bullet_meta = nullptr;
|
|
CreatureWeakPtr sender;
|
|
CreatureWeakPtr passenger;
|
|
Room* room = nullptr;
|
|
bool is_pre_battle_bullet = false;
|
|
glm::vec3 dir = GlmHelper::ZERO;
|
|
Position born_pos;
|
|
glm::vec3 born_dir = GlmHelper::ZERO;
|
|
float strengthen_wall = 0;
|
|
|
|
virtual const glm::vec3& GetDir() override { return dir; };
|
|
virtual float GetStrengthenWall() override;
|
|
virtual long long GetWeaponUniId() override;
|
|
virtual const mt::Skill* GetSkillMeta() override;
|
|
virtual const mt::Equip* GetGunMeta() override;
|
|
virtual const mt::Equip* GetBulletMeta() override;
|
|
virtual CreatureWeakPtr GetSender() override;
|
|
virtual CreatureWeakPtr GetPassenger() override;
|
|
virtual bool IsBomb() override;
|
|
virtual bool IsPreBattleBullet() override;
|
|
virtual Room* GetRoom() override;
|
|
virtual float GetHitRadius() override;
|
|
virtual void ProcRequestBulletDmg(int shield_hit, int strength_wall_uniid, int target_uniid, const glm::vec3& pos) override;
|
|
virtual bool NoAdjustPos() override;
|
|
|
|
virtual void Update(int delta_time);
|
|
virtual bool IsDone();
|
|
|
|
void Init();
|
|
void SetPos(Position pos) { pos_ = pos; };
|
|
virtual const Position& GetPos() override { return pos_; }
|
|
Position& GetMutablePos() { return pos_; };
|
|
|
|
private:
|
|
void Check(float distance);
|
|
void ForceRemove();
|
|
void OnHit(std::set<Entity*>& objects);
|
|
std::set<GridCell*>& GetGridList() { return grid_list_; };
|
|
void OnStrengthen(Obstacle* ob);
|
|
void OnKillTarget(Entity* target);
|
|
void GetHitThings(BulletCheckResult& result);
|
|
void GetHitCreatures(BulletCheckResult& result);
|
|
|
|
private:
|
|
bool later_removed_ = false;
|
|
Position pos_;
|
|
std::set<GridCell*> grid_list_;
|
|
std::set<int> hit_objects_;
|
|
float strengthened_ = 0.0f;
|
|
|
|
};
|