osb/source/game/interfaces/StarBeamItem.hpp

76 lines
1.9 KiB
C++
Raw Normal View History

#pragma once
2023-06-20 04:33:09 +00:00
#include "StarSpline.hpp"
#include "StarGameTypes.hpp"
#include "StarNonRotatedDrawablesItem.hpp"
#include "StarToolUserItem.hpp"
namespace Star {
STAR_CLASS(Item);
STAR_CLASS(ToolUserEntity);
STAR_CLASS(World);
STAR_CLASS(BeamItem);
class BeamItem : public virtual NonRotatedDrawablesItem, public virtual ToolUserItem {
public:
enum class EndType { Invalid = -1, Object, Tile, TileGroup, Wire };
BeamItem(Json config);
virtual ~BeamItem() = default;
virtual void init(ToolUserEntity* owner, ToolHand hand) override;
virtual void update(float dt, FireMode fireMode, bool shifting, HashSet<MoveControlType> const& moves) override;
2023-06-20 04:33:09 +00:00
virtual List<Drawable> nonRotatedDrawables() const override;
virtual float getAngle(float angle);
virtual List<Drawable> drawables() const;
virtual Vec2F handPosition() const;
virtual Vec2F firePosition() const;
virtual void setRange(float range);
virtual float getAppropriateOpacity() const;
virtual void setEnd(EndType type);
protected:
List<Drawable> beamDrawables(bool canPlace = true) const;
String m_image;
StringList m_endImages;
EndType m_endType;
float m_segmentsPerUnit;
float m_nearControlPointElasticity;
float m_farControlPointElasticity;
float m_nearControlPointDistance;
Vec2F m_handPosition;
Vec2F m_firePosition;
float m_range;
float m_targetSegmentRun;
float m_minBeamWidth;
float m_maxBeamWidth;
float m_beamWidthDev;
float m_minBeamJitter;
float m_maxBeamJitter;
float m_beamJitterDev;
float m_minBeamTrans;
float m_maxBeamTrans;
float m_beamTransDev;
int m_minBeamLines;
int m_maxBeamLines;
float m_innerBrightnessScale;
float m_firstStripeThickness;
float m_secondStripeThickness;
2024-03-19 14:53:34 +00:00
Color m_color;
2023-06-20 04:33:09 +00:00
mutable bool m_inRangeLastUpdate;
2024-03-19 14:53:34 +00:00
mutable Color m_lastUpdateColor;
2023-06-20 04:33:09 +00:00
mutable float m_particleGenerateCooldown;
CSplineF m_beamCurve;
};
}