1
This commit is contained in:
parent
3cf10d5836
commit
0f82887e44
@ -898,3 +898,8 @@ float Bullet::GetHitRadius()
|
||||
}
|
||||
return gun_meta->bullet_rad();
|
||||
}
|
||||
|
||||
const Position& Bullet::GetPos()
|
||||
{
|
||||
return Entity::GetPos();
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ class Bullet : public MoveableEntity, public IBullet
|
||||
virtual bool IsPreBattleBullet();
|
||||
virtual Room* GetRoom() { return room; };
|
||||
virtual float GetHitRadius() override;
|
||||
virtual const Position& GetPos() override;
|
||||
|
||||
protected:
|
||||
Bullet();
|
||||
|
@ -1,10 +1,17 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include <a8/collision.h>
|
||||
|
||||
#include "collision.h"
|
||||
#include "creature.h"
|
||||
|
||||
bool Collision::CheckBullet(IBullet* bullet, Creature* c)
|
||||
{
|
||||
return false;
|
||||
return a8::IntersectCylinderCylinder
|
||||
(
|
||||
bullet->GetPos().ToGlmVec3(), bullet->GetHitRadius(), 10,
|
||||
c->GetPos().ToGlmVec3(), c->GetHitRadius(), 10
|
||||
);
|
||||
}
|
||||
|
||||
bool Collision::CheckBullet(IBullet* bullet, Entity* c)
|
||||
|
@ -45,7 +45,7 @@ class Entity
|
||||
void BroadcastFullState(Room* room);
|
||||
void BroadcastDeleteState(Room* room);
|
||||
void RemoveFromAroundPlayers(Room* room);
|
||||
const Position& GetPos() { return pos_; };
|
||||
virtual const Position& GetPos() { return pos_; };
|
||||
Position& GetMutablePos() { return pos_; };
|
||||
virtual void SetPos(Position pos) { pos_ = pos; }
|
||||
EntityWeakPtrChunk* GetEntityWeakPtrChunk() { return &entity_weak_ptr_chunk_; };
|
||||
|
@ -37,21 +37,6 @@ struct BulletCheckResult
|
||||
std::set<Entity*> objects;
|
||||
};
|
||||
|
||||
class IBullet
|
||||
{
|
||||
public:
|
||||
virtual float GetStrengthenWall() = 0;
|
||||
virtual long long GetWeaponUniId() = 0;
|
||||
virtual const mt::Skill* GetSkillMeta() = 0;
|
||||
virtual const mt::Equip* GetGunMeta() = 0;
|
||||
virtual const mt::Equip* GetBulletMeta() = 0;
|
||||
virtual CreatureWeakPtr GetSender() = 0;
|
||||
virtual CreatureWeakPtr GetPassenger() = 0;
|
||||
virtual bool IsBomb() = 0;
|
||||
virtual bool IsPreBattleBullet() = 0;
|
||||
virtual Room* GetRoom() = 0;
|
||||
};
|
||||
|
||||
class ITask
|
||||
{
|
||||
public:
|
||||
@ -99,3 +84,20 @@ struct Position
|
||||
|
||||
const Position& AddGlmVec3(const glm::vec3& v);
|
||||
};
|
||||
|
||||
class IBullet
|
||||
{
|
||||
public:
|
||||
virtual const Position& GetPos() = 0;
|
||||
virtual float GetStrengthenWall() = 0;
|
||||
virtual long long GetWeaponUniId() = 0;
|
||||
virtual const mt::Skill* GetSkillMeta() = 0;
|
||||
virtual const mt::Equip* GetGunMeta() = 0;
|
||||
virtual const mt::Equip* GetBulletMeta() = 0;
|
||||
virtual CreatureWeakPtr GetSender() = 0;
|
||||
virtual CreatureWeakPtr GetPassenger() = 0;
|
||||
virtual bool IsBomb() = 0;
|
||||
virtual bool IsPreBattleBullet() = 0;
|
||||
virtual Room* GetRoom() = 0;
|
||||
virtual float GetHitRadius() = 0;
|
||||
};
|
||||
|
@ -310,3 +310,8 @@ void VirtualBullet::GetHitCreatures(BulletCheckResult& result)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
float VirtualBullet::GetHitRadius()
|
||||
{
|
||||
return gun_meta->bullet_rad();
|
||||
}
|
||||
|
@ -31,13 +31,14 @@ class VirtualBullet : public IBullet, public ITask
|
||||
virtual bool IsBomb() override;
|
||||
virtual bool IsPreBattleBullet() override;
|
||||
virtual Room* GetRoom() override;
|
||||
virtual float GetHitRadius() override;
|
||||
|
||||
virtual void Update(int delta_time) override;
|
||||
virtual bool IsDone() override;
|
||||
|
||||
void Init();
|
||||
void SetPos(Position pos) { pos_ = pos; };
|
||||
const Position& GetPos() { return pos_; };
|
||||
virtual const Position& GetPos() override { return pos_; }
|
||||
Position& GetMutablePos() { return pos_; };
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user