Updated TurnBaseCombat for Switching Active Roles
Added Switching Active Roles and Constrained Active Action Points
This commit is contained in:
		
							parent
							
								
									b678c25377
								
							
						
					
					
						commit
						5907d5dbe8
					
				@ -14,6 +14,13 @@ void ATurnBaseCombat::BeginPlay()
 | 
				
			|||||||
void ATurnBaseCombat::useActionPoint()
 | 
					void ATurnBaseCombat::useActionPoint()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	activeActionPoints -= 1;
 | 
						activeActionPoints -= 1;
 | 
				
			||||||
 | 
						activeActionPoints = FMath::Clamp(activeActionPoints, 0, defaultActionPoints);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void ATurnBaseCombat::reuseActionPoint()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						activeActionPoints += 1;
 | 
				
			||||||
 | 
						activeActionPoints = FMath::Clamp(activeActionPoints, 0, defaultActionPoints);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ATurnBaseCombat::revertActionPoints()
 | 
					void ATurnBaseCombat::revertActionPoints()
 | 
				
			||||||
@ -21,4 +28,9 @@ void ATurnBaseCombat::revertActionPoints()
 | 
				
			|||||||
	activeActionPoints = defaultActionPoints;
 | 
						activeActionPoints = defaultActionPoints;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void ATurnBaseCombat::switchTurn()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						activeActor = (isPlayerTurn) ? enemyActor : playerActor;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -27,20 +27,24 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	AActor* playerActor;
 | 
						AActor* playerActor;
 | 
				
			||||||
	AActor* enemyActor;
 | 
						AActor* enemyActor;
 | 
				
			||||||
 | 
						AActor* activeActor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	TODO:
 | 
						TODO:
 | 
				
			||||||
	Reference Blueprint HUD
 | 
						Reference Blueprint HUD
 | 
				
			||||||
	Reference Action Library
 | 
						Reference Action Library
 | 
				
			||||||
	Reference Player Inventory 
 | 
						Reference Player Inventory 
 | 
				
			||||||
 | 
						Reference Combat Logging System
 | 
				
			||||||
	*/
 | 
						*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
	virtual void BeginPlay() override;
 | 
						virtual void BeginPlay() override;
 | 
				
			||||||
	void useActionPoint();
 | 
						void useActionPoint();
 | 
				
			||||||
 | 
						void reuseActionPoint();
 | 
				
			||||||
	void revertActionPoints();
 | 
						void revertActionPoints();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	UPROPERTY(EditDefaultsOnly)
 | 
						UPROPERTY(EditDefaultsOnly)
 | 
				
			||||||
		bool isPlayerTurn = true;
 | 
							bool isPlayerTurn = true;
 | 
				
			||||||
 | 
						void switchTurn();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user