// Project Lab - NHTV Igad #pragma once #include "Creatures/NetworkCharacter.h" #include "NPCBase.generated.h" /** * */ UCLASS() class UNREALPROJECT_API ANPCBase : public ANetworkCharacter { GENERATED_BODY() public: ANPCBase(); virtual void BeginPlay() override; virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override; virtual void Tick(float deltaTime) override; virtual int32 NativeDealDamage(class ANetworkCharacter* dealer, int32 damage, float armorPercentageIgnore, class UAbilityInfo* ability) override; // Clears all the modifier stat modifications from this character virtual void ResetModifiers(); void SetSpawn(class ASpawnerBase* spawn); void UnsetSpawn(); void SetControlPoint(FVector controlPoint); UPROPERTY(BlueprintAssignable, Category = "Collision") FComponentBeginOverlapSignature OnComponentBeginOverlap; UPROPERTY(BlueprintAssignable, Category = "Collision") FComponentBeginOverlapSignature OnComponentExitOverlap; UPROPERTY(VisibleAnywhere, Category = "Custom Collision") float maxAvoidanceForce; UPROPERTY(BlueprintReadWrite) TArray< class ANPCBase*>collisionList; UPROPERTY(BlueprintReadWrite) class ANetworkCharacter* target; UFUNCTION(BlueprintImplementableEvent, Category = "Animation") void PlayFencAnimation(); UFUNCTION(BlueprintImplementableEvent, Category = "Animation") void PlayNormalAnimation(); UFUNCTION(BlueprintImplementableEvent, Category = "Animation") void PlayClimbingAnimation(); UFUNCTION(BlueprintImplementableEvent, Category = "Animation") void PlayPointAnimation(); UFUNCTION(NetMulticast, Reliable, Category = "Animation") void ChangeNPCAnimation(uint8 state); //Trigger components for the vision of the npcs float patrolTime; float collisionRadius; void CalcAvoidance(const FVector& target); virtual void MoveToPoint(const FVector& target); virtual void MoveToPointSlow(const FVector& target, float dist); void PatrolBetweenLocations(FVector startlocation, FVector endLocation,float deltaTime); ANPCBase* GetClosestObstacle(); FVector CalcAvoidanceVector(); FVector TruncateVector(FVector inVector, float maxForce); FVector GetClosestPathLocation(FVector endlocation); FVector aheadvec1; FVector aheadvec2; protected: virtual void m_OnRep_Team() override; UFUNCTION(BlueprintImplementableEvent, category = "death") void PlayDeathAnimation(UAbilityInfo* ability); virtual void OnDeath(UAbilityInfo* ability) override; UFUNCTION() void OnOverlapBegin(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult); UFUNCTION() void OnOverlapEnd(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex); UPROPERTY() UMaterialInstanceDynamic* m_materialInstance; // Base Stats UPROPERTY(EditDefaultsOnly, Category = "Stats") int32 baseMaxHealth; UPROPERTY(EditDefaultsOnly, Category = "Stats") int32 baseMaxMana; // AKA Attacks per second UPROPERTY(EditDefaultsOnly, Category = "Stats") float baseAttackSpeed; UPROPERTY(BlueprintReadWrite) bool enableVisonCone; bool m_dead; UPROPERTY() class ASpawnerBase* m_spawn; FVector m_targetPoint; bool m_isPulled; bool m_hasGeneral; class UMinionAnimInstance* animInstance; private: FVector m_lastLoc; float m_walkSpeed; bool lastcollision; bool m_reachedStart; FVector previousDirection; float m_patrolTimer; };