Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "Entity.h"
- #include "Animation.h"
- #include "PlayerJsonReader.h"
- #include "PlayerState.h"
- #include "PlayerStateMachine.h"
- class Map;
- class Sprite;
- class TileCollider;
- class BurstObject;
- class BurstArrow;
- class Tile;
- class Locator;
- class Player final : public Entity
- {
- friend class PlayerJsonReader;
- friend class PlayerStateMachine;
- public:
- void Accept(EntityVisitor& aVisitor) override;
- void InitCollider(Map* aMap);
- void CheckCollision(const std::vector<std::shared_ptr<Entity>>&); // Remove
- void Jump();
- void MoveGrounded();
- void MoveAirBorne();
- void Burst(const VECTOR2F& aDirection);
- void AimArrow(const float aRotation, bool aSetActive);
- void SetVelocity(const VECTOR2F& aVelocity);
- CommonUtilities::RectInt GetRect() const;
- const TileCollider& GetTileCollider() const;
- State GetState() const;
- bool CanBurst() const;
- bool IsGrounded() const;
- int GetCoyoteFrames() const;
- float GetSpeed() const;
- float GetMaxSpeed() const;
- float GetGravity() const;
- float GetAirControl() const;
- float GetBurstSpeed() const;
- VECTOR2F& GetVelocity();
- VECTOR2F& GetAcceleration();
- const VECTOR2F& GetPosition()const;
- private:
- void OnInit() override;
- void Update() override;
- bool HandleSlopes(const Tile& aCollider, const Locator& aLocator);
- void InitAnimations();
- PlayerJsonReader myJsonReader;
- PlayerStateMachine myStateMachine;
- std::shared_ptr<BurstArrow> myBurstArrow;
- std::unordered_map<State, std::shared_ptr<Animation>> myAnimations;
- std::shared_ptr<Animation> myCurrentAnimation;
- void SetState(State aState);
- VECTOR2F myVelocity;
- VECTOR2F myAcceleration;
- int myCoyoteFrames = 0;
- float myAirControl = 0.f;
- float mySpeed = 0.f;
- float myBurstSpeed = 0.f;
- float myGravity = 0.f;
- float myJumpSpeed = 0.f;
- float myMaxSpeed = 0.f;
- float myMaxFallSpeed = 0.f;
- float myMaxSpeedAfterBurst = 0.f;
- float myXVelocityFallOff = 0.f;
- bool myIsGrounded = false;
- bool myInRangeForBurst = false;
- bool myHasBursted = false;
- State myState = State::Idle;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement