Huge refactoring v3
parent
61427ff2fd
commit
65f2c63643
|
@ -4,7 +4,6 @@
|
|||
|
||||
#include "Player.h"
|
||||
#include "engine/Screen.h"
|
||||
#include "engine/ResourceManager.h"
|
||||
#include "engine/utils/Log.h"
|
||||
|
||||
Player::Player(ObjectNameTag name) : RigidBody(name) {
|
||||
|
@ -12,7 +11,10 @@ Player::Player(ObjectNameTag name) : RigidBody(name) {
|
|||
setAcceleration(Vec3D{0, -ShooterConsts::GRAVITY, 0});
|
||||
setCollision(true);
|
||||
setVisible(false);
|
||||
setColor({240, 168, 168});
|
||||
|
||||
//setColor({240, 168, 168});
|
||||
Vec3D randColor = Vec3D::Random();
|
||||
setColor({static_cast<sf::Uint8>(randColor.x()*255), static_cast<sf::Uint8>(randColor.y()*255), static_cast<sf::Uint8>(randColor.z()*255)});
|
||||
|
||||
setCollisionCallBack([this](const ObjectNameTag& tag, std::shared_ptr<RigidBody> obj) {collisionWithObject(tag, obj);});
|
||||
}
|
||||
|
|
|
@ -87,3 +87,7 @@ Vec3D Vec3D::cross(const Vec3D& vec) const {
|
|||
Vec4D Vec3D::makePoint4D() const {
|
||||
return Vec4D(x(), y(), z(), 1.0);
|
||||
}
|
||||
|
||||
Vec3D Vec3D::Random() {
|
||||
return Vec3D((double)rand()/RAND_MAX, (double)rand()/RAND_MAX, (double)rand()/RAND_MAX);
|
||||
}
|
||||
|
|
|
@ -45,6 +45,8 @@ public:
|
|||
[[nodiscard]] double abs() const; // Returns vector length
|
||||
[[nodiscard]] Vec3D normalized() const; // Returns normalized vector without changing
|
||||
[[nodiscard]] Vec4D makePoint4D() const;
|
||||
|
||||
static Vec3D Random();
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue