コード例 #1
0
ファイル: GameObject.cpp プロジェクト: superwills/Wryv
void AGameObject::SetSize( FVector size )
{
  float maxDimen = GetComponentsBoundingBox().GetSize().GetMax();
  if( !maxDimen )
  {
    LOG( "::SetSize(): %s had %f size bounding box", *GetName(), maxDimen );
    SetActorScale3D( size );
  }
  else
    SetActorScale3D( size/maxDimen );
}
コード例 #2
0
void ABrainNormalInteractiveObject::Tick(float deltaTime)
{
	Super::Tick(deltaTime);

	if (_canBeRotate)
	{
		_currentRotation += (_deltaRotation * (deltaTime / _animDuration));
		_durationRotation += deltaTime;
		if (_durationRotation > _animDuration)
		{
			_currentRotation = _targetRotation;
			_deltaRotation = FRotator(0, 0, 0); // Annulation du deltaRotation
		}

		SetActorRotation(_currentRotation);
	}

	if (_canBeTranslate)
	{
		_currentTranslation += (_deltaTranslation * deltaTime / _animDuration);
		_durationTranslation += deltaTime;
		if (_durationTranslation > _animDuration)
		{
			_currentTranslation = _targetTranslation;
			_deltaTranslation = FVector(0, 0, 0); // Annulation du deltaSize
		}

		SetActorLocation(_currentTranslation,true);
	}

	if (_canBeScale)
	{
		_currentScale += (_deltaScale * deltaTime / _animDuration);
		_durationScale += deltaTime;
		if (_durationScale > _animDuration)
		{
			_currentScale = _targetScale;
			_deltaScale = FVector(0,0,0); // Annulation du deltaSize
		}

		SetActorScale3D(_currentScale);
	}

	if (_canBeShear)
	{
		_currentShearFirstAxis += (_deltaShearFirstAxis * deltaTime / _animDuration);
		_currentShearSecondAxis += (_deltaShearSecondAxis * deltaTime / _animDuration);
		_durationShear += deltaTime;
		if (_durationShear > _animDuration)
		{
			_currentShearFirstAxis = _targetShearFirstAxis;
			_currentShearSecondAxis = _targetShearSecondAxis;
			_deltaShearFirstAxis = 0;
			_deltaShearSecondAxis = 0;
		}

		FTransform sTrans = FTransform(Shear(_currentShearFirstAxis, _currentShearSecondAxis));
		SetActorTransform(sTrans*_cachedTransform);
	}
}
コード例 #3
0
ファイル: Cargo.cpp プロジェクト: dupersaurus/redolent-tanuki
// Sets default values
ACargo::ACargo()
{
    // Structure to hold one-time initialization
    struct FConstructorStatics
    {
        ConstructorHelpers::FObjectFinderOptional<UStaticMesh> CargoMesh;
        ConstructorHelpers::FObjectFinderOptional<UStaticMesh> DockingPortMesh;
        
        FConstructorStatics()
        : CargoMesh(TEXT("/Game/Flying/Meshes/FlyingCub_Rounded")),
          DockingPortMesh(TEXT("/Engine/BasicShapes/Cylinder"))
        {
        }
    };
    static FConstructorStatics ConstructorStatics;
    
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

    CargoMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("CargoBody"));
    CargoMesh->SetStaticMesh(ConstructorStatics.CargoMesh.Get());
    CargoMesh->SetSimulatePhysics(true);
    RootComponent = CargoMesh;

	SetActorScale3D(FVector(1, 0.5f, 0.5f));
    
    /*DockingPort = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("DockingPort"));
    DockingPort->SetStaticMesh(ConstructorStatics.DockingPortMesh.Get());
    DockingPort->AttachTo(RootComponent);*/
}
コード例 #4
0
ASmallMilitaryBuilding::ASmallMilitaryBuilding() : Super()
{
	DefaultMaxLife = 1000;
	DefaultHeal = 10;
	DefaultFieldOfSight = 15.f;

	ActualMaxLife = DefaultMaxLife;
	CurrentLife = ActualMaxLife;
	ActualHeal = DefaultHeal;
	ActualFieldOfSight = DefaultFieldOfSight;

	CostInFood = { 150, 300 };
	CostInCells = { 400, 800 };
	CostInMetal = { 1000, 2000 };
	CostInCristals = { 50, 250 };

	SetActorScale3D(FVector(1.f));

	LevelMax = 3;

	static ConstructorHelpers::FObjectFinder<UStaticMesh> StaticMeshRessource(TEXT("StaticMesh'/Game/Meshes/LittleMilitaryBuilding.LittleMilitaryBuilding'"));
	StaticMesh = StaticMeshRessource.Object;

	BuildingMesh->SetStaticMesh(StaticMesh);
}
コード例 #5
0
void AEyeXSimpleInteractorPawn::UpdateFocus(float DeltaTime)
{
	if (IsFocused)
		CurScalingAlpha += DeltaTime;
	else
		CurScalingAlpha -= DeltaTime;

	CurScalingAlpha = FMath::Clamp(CurScalingAlpha, 0.0f, 1.0f);
	SetActorScale3D(FMath::Lerp<FVector, float>(BaseScale, FocusedScale, CurScalingAlpha));
}
コード例 #6
0
void ABrainNormalInteractiveObject::Load()
{
	FString name = GetName();
	FBrainNIOSaveData savedData = Cast<UBrainGameInstance>(GetGameInstance())->GetSaveManager()->GetDataFromSave<FBrainNIOSaveData>(name);
	if (savedData._loadFromfile)
	{
		// Load Translation
		SetActorLocation(savedData._location);
		_currentTranslation = savedData._location;
		_targetTranslation = savedData._location;

		SetActorRotation(savedData._rotation);
		_currentRotation = savedData._rotation;
		_targetRotation = savedData._rotation;

		SetActorScale3D(savedData._scale);
		_currentScale = savedData._scale;
		_targetScale = savedData._scale;

		_cachedTransform = GetTransform();
		SetActorTransform(FTransform(Shear(savedData._shearFirstAxis, savedData._shearSecondAxis))*_cachedTransform);
	}
}
コード例 #7
0
void ABrainNormalInteractiveObject::Load()
{
	if (!GetName().IsEmpty())
	{
		if (UBrainGameInstance* gameInstance = Cast<UBrainGameInstance>(GetGameInstance()))
		{
			if (UBrainSaveManager* saveManager = gameInstance->GetSaveManager())
			{
				FBrainNIOSaveData savedData = saveManager->GetDataFromSave<FBrainNIOSaveData>(GetName());
				if (savedData._loadFromfile)
				{
					// Movement Counters and Energy
					_countRotation = savedData._countRotation;
					_countTranslation = savedData._countTranslation;
					_countScale = savedData._countScale;
					_countShear = savedData._countShear;

					// Load Translation
					SetActorLocation(savedData._location);
					_currentTranslation = savedData._location;
					_targetTranslation = savedData._location;

					SetActorRotation(savedData._rotation);
					_currentRotation = savedData._rotation;
					_targetRotation = savedData._rotation;

					SetActorScale3D(savedData._scale);
					_currentScale = savedData._scale;
					_targetScale = savedData._scale;

					_cachedTransform = GetTransform();
					SetActorTransform(FTransform(Shear(savedData._shearFirstAxis, savedData._shearSecondAxis)) * _cachedTransform);
				}
			}
		}
	}
}
コード例 #8
0
ファイル: TeleportLR.cpp プロジェクト: pfjarschel/PacUFO
// Sets default values
ATeleportLR::ATeleportLR()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

	//Create some basic components.
	RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));
	VisibleComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("VisibleComponent"));
	StaticMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("StaticMesh"));
	AudioComponent = CreateDefaultSubobject<UAudioComponent>(TEXT("AudioComponent"));

	//Set up components (on the root component)
	VisibleComponent->SetupAttachment(RootComponent);
	StaticMesh->SetupAttachment(RootComponent);
	AudioComponent->SetupAttachment(RootComponent);

	//Mesh settings
	const ConstructorHelpers::FObjectFinder<UStaticMesh> cubeMesh(TEXT("/Game/StarterContent/Shapes/Shape_Cube"));
	StaticMesh->SetStaticMesh(cubeMesh.Object);

	const ConstructorHelpers::FObjectFinder<UMaterial> teleMaterial(TEXT("/Game/Meshes/EnemyMaterial2"));
	StaticMesh->SetMaterial(0, teleMaterial.Object);

	SetActorScale3D(FVector(1.5f, 1.75f, 2.0f));

	//Overlap Events
	StaticMesh->SetSimulatePhysics(false);
	StaticMesh->bGenerateOverlapEvents = true;
	StaticMesh->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
	StaticMesh->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Overlap);

	//Set audio clip
	const ConstructorHelpers::FObjectFinder<USoundCue> spellSound(TEXT("/Game/Sounds/spell2_Cue"));
	AudioComponent->SetSound(spellSound.Object);
	AudioComponent->bAutoActivate = false;
}
コード例 #9
0
AMasterSoldierOfLorthemid::AMasterSoldierOfLorthemid() : Super()
{
	Name = FName(TEXT("Master soldier of Lorthemid"));

	DefaultMaxLife = 400;
	DefaultPhysicAttack = 7;
	DefaultMagicAttack = 7;
	DefaultPhysicDefense = 7;
	DefaultMagicDefense = 4;
	DefaultSpeed = 4.f;
	DefaultFieldOfSight = 8.f;
	DefaultRange = 4.f;

	ActualMaxLife = DefaultMaxLife;
	CurrentLife = ActualMaxLife;
	ActualPhysicAttack = DefaultPhysicAttack;
	ActualMagicAttack = DefaultMagicAttack;
	ActualPhysicDefense = DefaultPhysicDefense;
	ActualMagicDefense = DefaultMagicDefense;
	ActualSpeed = DefaultSpeed;
	ActualFieldOfSight = DefaultFieldOfSight;
	ActualRange = DefaultRange;

	BuildingLevelRequired = 4;

	FoodEatenInASecond = 4;
	CostInFood = 150;
	CostInCells = 200;
	CostInMetal = 200;
	CostInCristal = 300;

	GetCharacterMovement()->MaxWalkSpeed = ActualSpeed * 100;

	SetActorScale3D(FVector(0.8f));

	/*static ConstructorHelpers::FObjectFinder<USkeletalMesh> PreVisualAsset(TEXT("SkeletalMesh'/Game/Meshes/Paladin/Paladin.Paladin'"));
	static ConstructorHelpers::FObjectFinder<USkeletalMesh> PreVisualAssetTransparent(TEXT("SkeletalMesh'/Game/Meshes/Paladin/Paladin_Transparent.Paladin_Transparent'"));
	VisualAsset = PreVisualAsset.Object;
	VisualAssetTransparent = PreVisualAssetTransparent.Object;

	static ConstructorHelpers::FObjectFinder<UAnimationAsset> Attacking(TEXT("AnimationAsset'/Game/Meshes/Paladin/Animations/Attacking.Attacking'"));
	static ConstructorHelpers::FObjectFinder<UAnimationAsset> NeutralIdle(TEXT("AnimationAsset'/Game/Meshes/Paladin/Animations/NeutralIdle.NeutralIdle'"));
	static ConstructorHelpers::FObjectFinder<UAnimationAsset> ReadyIdle(TEXT("AnimationAsset'/Game/Meshes/Paladin/Animations/ReadyIdle.ReadyIdle'"));
	static ConstructorHelpers::FObjectFinder<UAnimationAsset> Walking(TEXT("AnimationAsset'/Game/Meshes/Paladin/Animations/Walking.Walking'"));
	static ConstructorHelpers::FObjectFinder<UAnimationAsset> Running(TEXT("AnimationAsset'/Game/Meshes/Paladin/Animations/Running.Running'"));
	static ConstructorHelpers::FObjectFinder<UAnimationAsset> Victory(TEXT("AnimationAsset'/Game/Meshes/Paladin/Animations/Victory.Victory'"));
	AttackingAnimation = Attacking.Object;
	NeutralIdleAnimation = NeutralIdle.Object;
	ReadyIdleAnimation = ReadyIdle.Object;
	WalkingAnimation = Walking.Object;
	RunningAnimation = Running.Object;
	VictoryAnimation = Victory.Object;

	if (PreVisualAsset.Succeeded())
	{
		GetMesh()->SetSkeletalMesh(VisualAsset);
		GetMesh()->SetWorldRotation(FRotator(0.f, -90.f, 0.f));
	}

	GetCapsuleComponent()->SetCapsuleRadius(50.0f);
	GetCapsuleComponent()->SetCapsuleHalfHeight(88.f);
	GetMesh()->SetRelativeLocation(FVector(0.0f, 0.0f, -88.f));

	static ConstructorHelpers::FObjectFinder<UTexture> ImageAsset(TEXT("Texture'/Game/Textures/Units/Paladin.Paladin'"));
	UnitImage = ImageAsset.Object;*/
}
コード例 #10
0
ファイル: Enemy.cpp プロジェクト: pfjarschel/PacUFO
// Sets default values
AEnemy::AEnemy()
{
 	// Set this pawn to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

	//Create some basic components.
	RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));
	VisibleComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("VisibleComponent"));
	StaticMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("StaticMesh"));
	AudioDied = CreateDefaultSubobject<UAudioComponent>(TEXT("AudioDied"));
	AudioKilled = CreateDefaultSubobject<UAudioComponent>(TEXT("AudioKilled"));

	//Set up components (on the root component)
	VisibleComponent->SetupAttachment(RootComponent);
	StaticMesh->SetupAttachment(RootComponent);
	AudioDied->SetupAttachment(RootComponent);
	AudioKilled->SetupAttachment(RootComponent);

	//Mesh and materials settings
	const ConstructorHelpers::FObjectFinder<UStaticMesh> ufoMesh(TEXT("/Game/Meshes/TwinStickUFO"));
	StaticMesh->SetStaticMesh(ufoMesh.Object);
	SetActorScale3D(0.75f*FVector(1.0f, 1.0f, 1.0f));

	enemyMaterials.Add(ConstructorHelpers::FObjectFinder<UMaterial>(TEXT("/Game/Meshes/EnemyMaterial1")).Object);
	enemyMaterials.Add(ConstructorHelpers::FObjectFinder<UMaterial>(TEXT("/Game/Meshes/EnemyMaterial2")).Object);
	enemyMaterials.Add(ConstructorHelpers::FObjectFinder<UMaterial>(TEXT("/Game/Meshes/EnemyMaterial3")).Object);
	enemyMaterials.Add(ConstructorHelpers::FObjectFinder<UMaterial>(TEXT("/Game/Meshes/EnemyMaterial4")).Object);
	enemyMaterials.Add(ConstructorHelpers::FObjectFinder<UMaterial>(TEXT("/Game/Meshes/EnemyMaterial5")).Object);
	int randMat = FMath::RandRange(0, enemyMaterials.Num() - 1);
	StaticMesh->SetMaterial(0, enemyMaterials[randMat]);


	//Overlap Events
	StaticMesh->bGenerateOverlapEvents = true;
	StaticMesh->SetNotifyRigidBodyCollision(true);
	StaticMesh->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
	StaticMesh->SetCollisionObjectType(ECollisionChannel::ECC_Pawn);
	StaticMesh->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Block);
	StaticMesh->SetCollisionResponseToChannel(ECollisionChannel::ECC_Pawn, ECollisionResponse::ECR_Overlap);

	//Some Physics settings
	StaticMesh->SetSimulatePhysics(true);
	StaticMesh->SetEnableGravity(false);
	//StaticMesh->BodyInstance.bLockZTranslation = true;
	StaticMesh->BodyInstance.bLockXRotation = true;
	StaticMesh->BodyInstance.bLockYRotation = true;
	StaticMesh->SetLinearDamping(10.0f);
	StaticMesh->SetAngularDamping(10.0f);

	//Others
	//Set tags
	Tags.AddUnique(TEXT("enemy"));

	//Set audio clips
	const ConstructorHelpers::FObjectFinder<USoundCue> pickSound(TEXT("/Game/Sounds/Special"));
	AudioDied->SetSound(pickSound.Object);
	AudioDied->bAutoActivate = false;

	const ConstructorHelpers::FObjectFinder<USoundCue> rumbleSound(TEXT("/Game/Sounds/rumble_Cue"));
	AudioKilled->SetSound(rumbleSound.Object);
	AudioKilled->bAutoActivate = false;

	changedDirTime = 0.0f;
	minChangeDirTime = 0.2f;
}
コード例 #11
0
ファイル: Krofna_CPP.cpp プロジェクト: pecurka/rs15-24
void AKrofna_CPP::OnConstruction(const FTransform& Transform)
{
	SetActorScale3D(FVector(0.3,0.3,0.3));
	this->SetLifeSpan(60.f);
}
コード例 #12
0
void ABouncerPlayer::Shrink()
{
	SizeFactor--;
	SetActorScale3D(GetActorScale3D()* SHRINK_FACTOR);
}
コード例 #13
0
void ABouncerPlayer::Grow()
{
	SizeFactor++;
	SetActorScale3D(GetActorScale3D() / SHRINK_FACTOR);
}