Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Fill out your copyright notice in the Description page of Project Settings.
- #pragma once
- #include "CoreMinimal.h"
- #include "GameFramework/Actor.h"
- #include "Item.generated.h"
- class USphereComponent;
- UENUM(BlueprintType)
- enum class EItemState
- {
- EIS_Hovering,
- EIS_Equipped
- };
- UCLASS()
- class SLASH_API AItem : public AActor
- {
- GENERATED_BODY()
- public:
- // Sets default values for this actor's properties
- AItem();
- // Called every frame
- virtual void Tick(float DeltaTime) override;
- protected:
- /*These are all variables
- UPROPERTY(EditerVisStates) or,
- UPROPERTY(EditerVisStates, BlueprintVisStates) or,
- UPROPERTY(BlueprintVisStates)
- EditerVisStates:
- VisibleAnywhere -internal and external view but not editable
- VisibleInstanceOnly
- VisibleDefaultsOnly
- EditDefaultsOnly -internal blueprint view editable
- EditInstanceOnly -My Perferd Visability editable
- EditAnywhere - editable from anywhere
- BlueprintVisStates:
- BlueprintReadWrite
- BlueprintReadOnly
- BlueprintWriteOnly
- */
- /*These are functions
- UFUNCTION(BlueprintCallable)//input exicution panel
- UFUNCTION(BlueprintPure)//Pure function
- */
- // Called when the game starts or when spawned
- virtual void BeginPlay() override;
- //UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Cat")
- //float catSpeed = 1.f;
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Sine Parameters")
- float Amplitude = 0.25f;
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Sine Parameters")
- float TimeConstant = 5.f;
- UFUNCTION(BlueprintPure)
- float TransformedSin();
- UFUNCTION(BlueprintPure)
- float TransformCos();
- template<typename T>
- T Avg(T First, T Second);
- UFUNCTION()
- virtual void OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
- UFUNCTION()
- virtual void OnSphereEndOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);
- UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
- UStaticMeshComponent* ItemMesh;
- EItemState ItemState = EItemState::EIS_Hovering;
- UPROPERTY(VisibleAnywhere)
- USphereComponent* Sphere;
- private:
- UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
- float RuningTime;
- };
- template<typename T>
- inline T AItem::Avg(T First, T Second)
- {
- return (First + Second) / 2;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement