Example #1
0
void ACarcinusCharacter::SetHealth(int damage)
{
	Super::SetHealth(damage);

	mEnemyHealth = mEnemyHealth - damage;
	
	if (mEnemyHealth <= 0)
	{
		GetMesh()->SetCollisionProfileName("Ragdoll");
		GetMesh()->SetSimulatePhysics(true);
		
		GetWorld()->GetTimerManager().SetTimer(mDeathTimeHandler, this, &ACarcinusCharacter::DisablePhysics, 10.0f, false);
		
		ACharacter* PlayerRef = UGameplayStatics::GetPlayerCharacter(GetWorld(), 0);

		FString DeathEvent = "Event_CrabDeath";
		AAudioManager::GetInstance()->PlayWwiseEvent(DeathEvent, PlayerRef);
		AAudioManager::GetInstance()->SetFearValue(1.0f);


		ParticleComponent->Activate(true); 

		if (GetCapsuleComponent() != NULL)
		{
			GetCapsuleComponent()->DestroyComponent();
		}

		if (HeadCollider != NULL)
		{
			HeadCollider->DestroyComponent();
		}
	}

	mEnemyHealth = FMath::Clamp(mEnemyHealth, 0, mEnemyMaxHealth);
}
Example #2
0
Rock::Rock(D3DCOLORVALUE color, const btVector3 &startPos) : 
	GameObject(
	new btCylinderShape(btVector3(1.5, 1, 1)),
	10, 
	startPos, 
	btQuaternion((90), (0), (1), (0))
	)
{
	D3DCOLORVALUE ambColor;
	ambColor.r = color.r * 0.3;
	ambColor.g = color.g * 0.3;
	ambColor.b = color.b * 0.3;
	ambColor.a = 0;

	D3DCOLORVALUE diffColor;
	diffColor.r = color.r*1;
	diffColor.g = color.g*1;
	diffColor.b = color.b*1;
	diffColor.a = 0;

	CreateMeshFromShape();
	GetMesh()->SetColour(diffColor, Advanced2D::Mesh::MT_DIFFUSE);
	GetMesh()->SetColour(ambColor,Advanced2D::Mesh::MT_AMBIENT);
	GetMesh()->SetRotation(0, 90, 0);
	//GetRigidBody()->setWorldTransform(btTransform(
}
Example #3
0
// Player Died, Called on all users
void ARadeCharacter::GlobalDeath_Implementation()
{
	// save third person mesh Relative Location and rotation before ragdoll
	if (GetMesh())
	{
		Mesh_InGameRelativeLoc = GetMesh()->RelativeLocation;
		Mesh_InGameRelativeRot = GetMesh()->RelativeRotation;
	}

	// Disable player input
	DisableInput(Cast<APlayerController>(Controller));

	// If Player can revive, revive hit after a delay
	if (bCanRevive)
	{
		FTimerHandle MyHandle;
		GetWorldTimerManager().SetTimer(MyHandle, this, &ARadeCharacter::Revive, ReviveTime, false);
	}

	// Event and Ragdoll
	Super::GlobalDeath_Implementation();

	// Update Visibility
	UpdateComponentsVisibility();

	// Call on Blueprint
	BP_PlayerDied();
}
Example #4
0
float ALD35Character::TakeDamage(float DamageAmount, FDamageEvent const & DamageEvent, AController * EventInstigator, AActor * DamageCauser)
{
	UGameplayStatics::PlaySoundAtLocation(this, HitSound, this->GetActorLocation());

	float dmg = Super::TakeDamage(DamageAmount, DamageEvent, EventInstigator, DamageCauser);

	Health -= dmg;

	if (Health <= 0)
	{
		GetMesh()->SetSimulatePhysics(true);
		GetMesh()->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
		GetCapsuleComponent()->SetCollisionEnabled(ECollisionEnabled::NoCollision);
		GetMovementComponent()->SetActive(false);

		UGameplayStatics::PlaySoundAtLocation(this, DeathSound, this->GetActorLocation());

		if (EventInstigator)
		{
			if (auto a = Cast<ALD35Character>(EventInstigator->GetPawn()))
			{
				if (a->Faction == Faction)
				{
					UE_LOG(LogTemp, Display, TEXT("Teamkilling detected!"));
					a->Faction = FMath::Rand();
				}
			}
		}
	}

	return dmg;
}
Example #5
0
float *EditPolyData::GetSoftSelection (TimeValue t,
									   float falloff, float pinch, float bubble, int edist,
									   bool ignoreBackfacing, Interval & edistValid) {
	if (!GetMesh()) return NULL;
	if (GetMesh()->numv == 0) return NULL;

	if (!mpTemp) mpTemp = new MNTempData();
	mpTemp->SetMesh (GetMesh());
	int nv = GetMesh()->numv;
	mpTemp->InvalidateSoftSelection ();	// have to do, or it might remember last time's falloff, etc.

	if (!mVertexDistanceValidity.InInterval (t)) {
		mpTemp->InvalidateDistances ();
		mVertexDistanceValidity = mGeomValid;
		mVertexDistanceValidity &= mTopoValid;
		mVertexDistanceValidity &= edistValid;
	}

	// Question: Should we be using MN_SEL here, or MN_EDITPOLY_OP_SELECT based on our selection BitArrays?
	// Answer: As of this writing, this method is only called from EditPolyMod::ModifyObject,
	// where the MN_SEL flags are set to the appropriate selection, or from the Display code, which is based
	// on the cache set in ModifyObject.  So I think we're fine.
	return mpTemp->VSWeight (edist, edist, ignoreBackfacing,
		falloff, pinch, bubble, MN_SEL)->Addr(0);
}
Example #6
0
BOOL 
TriObject::PolygonCount(TimeValue t, int& numFaces, int& numVerts) 
{
    numFaces = GetMesh().getNumFaces();
    numVerts = GetMesh().getNumVerts();
    return TRUE;
}
Example #7
0
void AFPSGCharacter::serverEquipWeapon_Implementation(int32 in_currentWeaponIndex)
{
	if (weaponInventory[in_currentWeaponIndex] != NULL)
	{
		//Detach previous weapon
		if (currentWeapon != NULL)
		{
			//If previous weapon is attached to firstPersonMesh, then detach it and attach it to the inventory socket
			if (currentWeapon->IsAttachedTo(firstPersonMesh->GetOwner()))
			{
				currentWeapon->DetachRootComponentFromParent(true);
				currentWeapon->AttachRootComponentTo(GetMesh(), inventoryWeaponSocket, EAttachLocation::SnapToTarget);
				currentWeapon->SetActorHiddenInGame(true);
			}
		}

		//Retrieve the new weapon from the inventory
		currentWeapon = weaponInventory[in_currentWeaponIndex];

		//Attach the new weapon
		if (currentWeapon != NULL)
		{
			//If current weapon is attached to the inventory socket, detach it and then attach it to the equipped weapon socket
			if (currentWeapon->IsAttachedTo(GetMesh()->GetOwner()))
			{
				currentWeapon->DetachRootComponentFromParent(true);
				currentWeapon->AttachRootComponentTo(firstPersonMesh, currentWeapon->getEquipAtSocket(), EAttachLocation::SnapToTarget);
				currentWeapon->SetActorHiddenInGame(false);
			}
		}
	}
}
Example #8
0
void ANimModCharacter::PostInitializeComponents()
{
	Super::PostInitializeComponents();

	if (Role == ROLE_Authority)
	{
		Health = GetMaxHealth();
		SpawnDefaultInventory();
	}

	// set initial mesh visibility (3rd person view)
	UpdatePawnMeshes();

	// create material instance for setting team colors (3rd person view)
	for (int32 iMat = 0; iMat < GetMesh()->GetNumMaterials(); iMat++)
	{
		MeshMIDs.Add(GetMesh()->CreateAndSetMaterialInstanceDynamic(iMat));
	}

	// play respawn effects
	if (GetNetMode() != NM_DedicatedServer)
	{
		if (RespawnFX)
		{
			UGameplayStatics::SpawnEmitterAtLocation(this, RespawnFX, GetActorLocation(), GetActorRotation());
		}

		if (RespawnSound)
		{
			UGameplayStatics::PlaySoundAtLocation(this, RespawnSound, GetActorLocation());
		}
	}
}
Example #9
0
void ABaseCharacter::SetCameraView(bool bFirstPerson)
{
	if (bFirstPerson)
	{

		GetMesh()->SetOwnerNoSee(true);
		FirstPersonViewMesh->SetOnlyOwnerSee(true);
		FirstPersonViewMesh->SetOwnerNoSee(false);

		WeaponMesh->SetOnlyOwnerSee(false);
		WeaponMesh->SetOwnerNoSee(false);

		CameraBoom->TargetArmLength = 0.0f;

		bIsInFirstPersonView = true;
	}
	else
	{
		GetMesh()->SetOwnerNoSee(false);
		FirstPersonViewMesh->SetOnlyOwnerSee(false);
		FirstPersonViewMesh->SetOwnerNoSee(true);

		WeaponMesh->SetOnlyOwnerSee(false);
		WeaponMesh->SetOwnerNoSee(true);

		CameraBoom->TargetArmLength = 300.0f;

		bIsInFirstPersonView = false;
	}
}
Example #10
0
void ClothEntity_cl::InitFunction()
{
  m_vCurrentPos = GetPosition();
  m_vCurrentOri = GetOrientation();
  BaseInit();
  if (!GetMesh())
    return;
  const char *szModel = GetMesh()->GetFilename();
  SetMeshModel(szModel,m_vCurrentScaling);
}
Example #11
0
// Called when the game starts or when spawned
void ACarcinusCharacter::BeginPlay()
{
	Super::BeginPlay();
	HeadCollider->InitSphereRadius(4.0f);
	GetMesh()->SetRelativeLocation(FVector(-80.0f, 0.0f, -100.0), false);
	HeadCollider->AttachTo(GetMesh(), TEXT("HeadSocket"), EAttachLocation::SnapToTarget, true);
	HeadCollider->OnComponentBeginOverlap.AddDynamic(this, &ACarcinusCharacter::OnOverlapBegin);
	RangeCollider->OnComponentEndOverlap.AddDynamic(this, &ACarcinusCharacter::OnOverlapEnd);

	ParticleComponent->AttachTo(GetMesh(), TEXT("HeadSocket"), EAttachLocation::SnapToTarget, true);
	ParticleComponent->DeactivateSystem();
}
Example #12
0
void ANimModCharacter::UpdatePawnMeshes()
{
	bool const bFirstPerson = IsFirstPerson();
	if (Mesh1P != nullptr)
	{
		Mesh1P->MeshComponentUpdateFlag = !bFirstPerson ? EMeshComponentUpdateFlag::OnlyTickPoseWhenRendered : EMeshComponentUpdateFlag::AlwaysTickPoseAndRefreshBones;
		Mesh1P->SetOwnerNoSee(!bFirstPerson);
	}

	GetMesh()->MeshComponentUpdateFlag = bFirstPerson ? EMeshComponentUpdateFlag::OnlyTickPoseWhenRendered : EMeshComponentUpdateFlag::AlwaysTickPoseAndRefreshBones;
	GetMesh()->SetOwnerNoSee(bFirstPerson);
}
void GeometryInstanceIterator::StepNext()
{
	assert(IsValid());
	++m_batchIdx;
	if( m_batchIdx >= GetMesh()->GetBatchCount() )
	{
		m_batchIdx = 0;
		m_currentMesh = NULL;
		do
		{
			++m_instIdx; // skip empty meshes
		} while( IsValid() && GetMesh()->GetBatchCount() == 0 );
	}
}
Example #14
0
void AARCharacter::OnConstruction(const FTransform& Transform)
{
	Head->SetMasterPoseComponent(GetMesh());
	Head->UpdateMasterBoneMap();

	Shoulders->SetMasterPoseComponent(GetMesh());
	Shoulders->UpdateMasterBoneMap();

	Arms->SetMasterPoseComponent(GetMesh());
	Arms->UpdateMasterBoneMap();

	Hands->SetMasterPoseComponent(GetMesh());
	Hands->UpdateMasterBoneMap();

	Torso->SetMasterPoseComponent(GetMesh());
	Torso->UpdateMasterBoneMap();

	Legs->SetMasterPoseComponent(GetMesh());
	Legs->UpdateMasterBoneMap();

	Feets->SetMasterPoseComponent(GetMesh());
	Feets->UpdateMasterBoneMap();

	Backpack->SetMasterPoseComponent(GetMesh());
	Backpack->UpdateMasterBoneMap();
}
Example #15
0
void AMonster::PostInitializeComponents()
{
	Super::PostInitializeComponents();
	// instantiate the melee weapon if a bp was selected
	if (BPMeleeWeapon)
	{
		MeleeWeapon = GetWorld()->SpawnActor<AMeleeWeapon>(BPMeleeWeapon, FVector(), FRotator());
		if (MeleeWeapon)
		{
			const USkeletalMeshSocket *meshSocket = (USkeletalMeshSocket*)GetMesh()->GetSocketByName("RightHandSocket"); // be sure to use correct
			// socket name!
			meshSocket->AttachActor(MeleeWeapon, GetMesh());
		}
	}
}
Example #16
0
// Update First Person and Third Person Components visibility
void ARadeCharacter::UpdateComponentsVisibility()
{

	if (CurrentCameraState==ECameraState::FP_Camera)
	{
		if (ThirdPersonCameraComponent)ThirdPersonCameraComponent->Deactivate();

		if (FirstPersonCameraComponent)FirstPersonCameraComponent->Activate();

		if (GetMesh())
			GetMesh()->SetOwnerNoSee(true);
	
		if (Mesh1P)
			Mesh1P->SetVisibility(true);
	
		if (TheWeapon)
		{
			if (TheWeapon->Mesh1P)
				TheWeapon->Mesh1P->SetVisibility(true);
				
			if (TheWeapon->Mesh3P)
				TheWeapon->Mesh3P->SetOwnerNoSee(true);
		}
	}

	// Currently Third Person Camera
	else if (CurrentCameraState == ECameraState::TP_Camera)
	{
		if (ThirdPersonCameraComponent)ThirdPersonCameraComponent->Activate();

		if (FirstPersonCameraComponent)FirstPersonCameraComponent->Deactivate();

		if (GetMesh())
			GetMesh()->SetOwnerNoSee(false);

		if (Mesh1P)
			Mesh1P->SetVisibility(false);

		if (TheWeapon)
		{
			if (TheWeapon->Mesh1P)
				TheWeapon->Mesh1P->SetVisibility(false);

			if (TheWeapon->Mesh3P)
				TheWeapon->Mesh3P->SetOwnerNoSee(false);
		}
	}
}
// **************************************************
//            OVERRIDDEN ENTITY FUNCTIONS
// **************************************************
void TransitionBarbarian_cl::InitFunction()
{
  if (!HasMesh())
    return;

  SetCastShadows(TRUE);
  
  // Setup all animation sequences
	SetupAnimations();
  if (!m_bModelValid)
    return;

  if( !m_pPhys)
  {
    m_pPhys = new vHavokCharacterController();
    m_pPhys->Initialize();

    hkvAlignedBBox bbox;
    VDynamicMesh *pMesh = GetMesh();
    pMesh->GetCollisionBoundingBox(bbox);

    float r = bbox.getSizeX() * 0.5f;
    m_pPhys->Capsule_Radius = r;
    m_pPhys->Character_Top.set(0,0,bbox.m_vMax.z - r);
    m_pPhys->Character_Bottom.set(0,0,bbox.m_vMin.z + r);

    m_pPhys->Max_Slope = 75.0f;
    AddComponent(m_pPhys);
    //	pPhys->SetDebugRendering(TRUE);
  }
 
  // Get Model
  VDynamicMesh* pModel = GetMesh();
	VASSERT(pModel);

  // Transition table to use
  VTransitionTable *pTable = VTransitionManager::GlobalManager().LoadTransitionTable(pModel,"Barbarian.vTransition");
  VASSERT(pTable && pTable->IsLoaded());

	// Setup the state machine component and pass the filename of the transition file
  // in which the transitions between the various animation states are defined.
	m_pStateMachine = new VTransitionStateMachine();
  m_pStateMachine->Init(this, pTable);
	AddComponent(m_pStateMachine);

	// Set initial state
	m_pStateMachine->SetState(m_pSkeletalSequenceList[ANIMID_IDLE]);
}
Example #18
0
void XTCSample::DeleteFaces(TimeValue t,Object *obj)
{
	if(bNF_OnOff)
	{
		Mesh *mesh = GetMesh(obj);
		
		if(!mesh)
			return;
		
		Interval ivalid = FOREVER;
		int nf;
		bo->GetParamBlockByID(x_params)->GetValue(pb_nf_spin,t,nf, ivalid);
		BitArray ba;
		ba.SetSize(mesh->getNumFaces());
		ba.ClearAll();
		
		for(int i = nf ; i < mesh->getNumFaces() ; i++ )
		{
			ba.Set(i);
		}
		
		if(!ba.IsEmpty())
			mesh->DeleteFaceSet(ba);
	}
}
Example #19
0
int XTCSample::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags, Object *pObj)
{
	if ( ! vpt || ! vpt->IsAlive() )
	{
		// why are we here
		DbgAssert(!_T("Doing Display() on invalid viewport!"));
		return FALSE;
	}

	if(pObj->ClassID() == XGSPHERE_CLASS_ID || pObj->IsSubClassOf(triObjectClassID))
	{
		return DisplayMesh(t, inode, vpt, flags, GetMesh(pObj));
	}
#ifndef NO_PATCHES
	else if( pObj->IsSubClassOf(patchObjectClassID) )
	{
		return DisplayPatch(t, inode, vpt, flags, (PatchObject *) pObj);
	}
#endif
	else if(pObj->CanConvertToType(triObjectClassID))
	{
		TriObject *pTri = (TriObject *) pObj->ConvertToType(t,triObjectClassID);
		DisplayMesh(t, inode, vpt, flags, &pTri->mesh);
		if(pTri != pObj)
			pTri->DeleteThis();
		
	}
	
	return 0;
}
void ABaseCharacter::SetRagdollPhysics()
{
	USkeletalMeshComponent* Mesh3P = GetMesh();
	if (Mesh3P)
	{
		Mesh3P->SetCollisionProfileName(TEXT("Ragdoll"));
	}
	SetActorEnableCollision(true);

	if (!IsPendingKill() || Mesh3P || Mesh3P->GetPhysicsAsset())
	{
		Mesh3P->SetAllBodiesSimulatePhysics(true);
		Mesh3P->SetSimulatePhysics(true);
		Mesh3P->WakeAllRigidBodies();
		Mesh3P->bBlendPhysics = true;

		SetLifeSpan(TimeAfterDeathBeforeDestroy);
	}
	else
	{
		// Immediately hide the pawn
		TurnOff();
		SetActorHiddenInGame(true);
		SetLifeSpan(1.0f);
	}

	UCharacterMovementComponent* CharacterComp = Cast<UCharacterMovementComponent>(GetMovementComponent());
	if (CharacterComp)
	{
		CharacterComp->StopMovementImmediately();
		CharacterComp->DisableMovement();
		CharacterComp->SetComponentTickEnabled(false);
	}
}
void ABaseCharacter::ApplyPhysicsToTheRagdolledBody(FDamageEvent const& DamageEvent)
{
	if (bRagdolledAfterDeath)
	{
		USkeletalMeshComponent* Mesh3P = GetMesh();
		if (Mesh3P)
		{
			/* Apply physics impulse on the bone of the enemy skeleton mesh we hit (ray-trace damage only) */
			if (DamageEvent.IsOfType(FPointDamageEvent::ClassID))
			{
				FPointDamageEvent PointDmg = *((FPointDamageEvent*)&DamageEvent);

				// TODO: Use DamageTypeClass->DamageImpulse
				Mesh3P->AddImpulseAtLocation(PointDmg.ShotDirection * 12000, PointDmg.HitInfo.ImpactPoint, PointDmg.HitInfo.BoneName);

			}
			if (DamageEvent.IsOfType(FRadialDamageEvent::ClassID))
			{
				FRadialDamageEvent RadialDmg = *((FRadialDamageEvent const*)(&DamageEvent));

				Mesh3P->AddRadialImpulse(RadialDmg.Origin, RadialDmg.Params.GetMaxRadius(), 100000 /*RadialDmg.DamageTypeClass->DamageImpulse*/, ERadialImpulseFalloff::RIF_Linear);
			}
		}
	}
}
Example #22
0
// Set Default Value
AWirePickup::AWirePickup()
{
    GetMesh()->SetSimulatePhysics(true);
    
    // Drain power level of the Wire
    DrainPower = -50.f;
}
void AVehiclePawn::ReceiveHit(class UPrimitiveComponent* MyComp, class AActor* Other, class UPrimitiveComponent* OtherComp, bool bSelfMoved, FVector HitLocation, FVector HitNormal, FVector NormalForce, const FHitResult& Hit)
{
	Super::ReceiveHit(MyComp, Other, OtherComp, bSelfMoved, HitLocation, HitNormal, NormalForce, Hit);

	if (ImpactTemplate && NormalForce.Size() > ImpactEffectNormalForceThreshold)
	{
		AVehicleImpactEffect* EffectActor = GetWorld()->SpawnActorDeferred<AVehicleImpactEffect>(ImpactTemplate, HitLocation, HitNormal.Rotation());
		if (EffectActor)
		{
			float DotBetweenHitAndUpRotation = FVector::DotProduct(HitNormal, GetMesh()->GetUpVector());
			EffectActor->HitSurface = Hit;
			EffectActor->HitForce = NormalForce;
			EffectActor->bWheelLand = DotBetweenHitAndUpRotation > 0.8;
			UGameplayStatics::FinishSpawningActor(EffectActor, FTransform(HitNormal.Rotation(), HitLocation));
		}
	}

	if (ImpactCameraShake)
	{
		AVehiclePlayerController* PC = Cast<AVehiclePlayerController>(Controller);
		if (PC != NULL && PC->IsLocalController())
		{
			PC->ClientPlayCameraShake(ImpactCameraShake, 1);
		}
	}
}
Example #24
0
void PlayerBehaviour::Drop()
{
	GetInventory();
	size_t count = pcinventory->GetEntityCount();
	if(count <= 0)
	{
		printf("Inventory is empty!\n");
		return;
	}
	iCelEntity* child = pcinventory->GetEntity(0);
	pcinventory->RemoveEntity(child);
	csRef<iPcLinearMovement> pclinmove = CEL_QUERY_PROPCLASS_ENT(
		child, iPcLinearMovement);
	if(pclinmove)
	{
		GetMesh ();
		csVector3 pos = pcmesh->GetMesh()->GetMovable()->GetTransform()
			.This2Other(csVector3 (0, 2, -2));
		iSector* sector = pcmesh->GetMesh()->GetMovable()->GetSectors()->Get(0);
		pclinmove->SetPosition(pos, 0, sector);
		pclinmove->SetVelocity(csVector3 (0, .1f, 0));
		csRef<iPcMesh> pcmesh_child = CEL_QUERY_PROPCLASS_ENT(child, iPcMesh);
		if(pcmesh_child) pcmesh_child->Show();
	}
}
void AManaJourneyCharacter::useShell()
{
	if (characterClasses.Contains("whiteMageClass") && whiteMageClassRef && !castOngoing)
	{
		toggleCastOngoing();
		bool bCastedShell = false;
		bCastedShell = whiteMageClassRef->castShell(*this, GetMesh());
		if (bCastedShell)
		{
			toggleCharacterMovement();
			updatePhysicProtection();
			castShellAnimation(level);
			toggleCastOngoing();

			//NOTE remove shell effect after fadeTimeForEffect has set to false (so add slight delay for beeing sure) 
			FTimerHandle UpdatePhysicProtectionTimer;
			GetWorldTimerManager().ClearTimer(UpdatePhysicProtectionTimer);
			FTimerDelegate UpdatePhysicProtectionTimerDelegate = FTimerDelegate::CreateUObject(this, &AManaJourneyCharacter::updatePhysicProtection);
			GetWorldTimerManager().SetTimer(UpdatePhysicProtectionTimer, UpdatePhysicProtectionTimerDelegate, fadeTimeForEffect + 0.2f, false);

			FTimerHandle EnableMovementTimer;
			GetWorldTimerManager().ClearTimer(EnableMovementTimer);
			FTimerDelegate updateCharacterMovementDelegate = FTimerDelegate::CreateUObject(this, &AManaJourneyCharacter::toggleCharacterMovement);
			GetWorldTimerManager().SetTimer(EnableMovementTimer, updateCharacterMovementDelegate, 1.50f, false);

			// timer for setting cast to false
			FTimerHandle CastOngoingHandler;
			GetWorldTimerManager().ClearTimer(CastOngoingHandler);
			FTimerDelegate CastOngoingHandlerDelegate = FTimerDelegate::CreateUObject(this, &AManaJourneyCharacter::toggleCastOngoing);
			GetWorldTimerManager().SetTimer(CastOngoingHandler, CastOngoingHandlerDelegate, whiteMageClassRef->fShellTimer, false);
		}
	}
}
Example #26
0
void  SalomeIO::FindDimension(hid_t gid, const  std::string menu_name, hsize_t n_fem_type) {
  
  
    Mesh& mesh = GetMesh();
    uint mydim = 1;  //this is the initial value, then it will be updated below
    mesh.SetDimension(mydim);
    

  std::vector<char*> elem_list;  elem_list.resize(n_fem_type);
    for (unsigned j=0; j < elem_list.size(); j++) {
      elem_list[j] = new char[max_length];
      H5Gget_objname_by_idx(gid,j,elem_list[j],max_length); ///@deprecated see the HDF doc to replace this
      std::string tempj(elem_list[j]);
      
      if ( tempj.compare("HE8") == 0 || 
	   tempj.compare("H20") == 0 ||  
	   tempj.compare("H27") == 0 || 
	   tempj.compare("TE4") == 0 || 
	   tempj.compare("T10") == 0    )      { mydim = 3; } 
      else if ( tempj.compare("QU4") == 0 || 
	        tempj.compare("QU8") == 0 ||  
	        tempj.compare("QU9") == 0 || 
	        tempj.compare("TR3") == 0 || 
	        tempj.compare("TR6") == 0    ) { mydim = 2; } 
      
      if ( mydim > mesh.GetDimension() ) mesh.SetDimension(mydim); 
	
    }  //end for
    
  
  return;
}
Example #27
0
void AAI_RangeEnemy::ReceiveBeginPlay()
{
	FActorSpawnParameters SpawnParams;
	SpawnParams.Owner = this;
	// Added GetMesh check becuase it randomly crashe dhere. No idea if this will fix anything and should be found out
	if (GunClass && GetMesh())
	{
		Gun = GetWorld()->SpawnActor<AGun>(GunClass, SpawnParams);
		if (Gun)
		{
			Gun->SetActorLocation(GetMesh()->GetComponentLocation());
			Gun->AttachRootComponentTo(GetMesh());
		}
	}
	Super::ReceiveBeginPlay();
}
// **************************************************
//            SETUP ANIMATIONS
// **************************************************
void TransitionCharacter_cl::SetupAnimations()
{
  m_bModelValid = false;
  VDynamicMesh *pMesh = GetMesh();
  VVERIFY_OR_RET(pMesh);

  // idle animations
  m_spSkeletalSequenceList[ANIMID_IDLE] = (VisSkeletalAnimSequence_cl*)pMesh->GetSequence("Idle", VIS_MODELANIM_SKELETAL);
  VVERIFY_OR_RET(m_spSkeletalSequenceList[ANIMID_IDLE]);

  // run animations
  m_spSkeletalSequenceList[ANIMID_RUN] = (VisSkeletalAnimSequence_cl*)pMesh->GetSequence("Run", VIS_MODELANIM_SKELETAL);
  VVERIFY_OR_RET(m_spSkeletalSequenceList[ANIMID_RUN]);

  // walk animations
  m_spSkeletalSequenceList[ANIMID_WALK] = (VisSkeletalAnimSequence_cl*)pMesh->GetSequence("Walk", VIS_MODELANIM_SKELETAL);
  VVERIFY_OR_RET(m_spSkeletalSequenceList[ANIMID_WALK]);

  // turn animations
  m_spSkeletalSequenceList[ANIMID_TURN] = (VisSkeletalAnimSequence_cl*)pMesh->GetSequence("Turn", VIS_MODELANIM_SKELETAL);
  VVERIFY_OR_RET(m_spSkeletalSequenceList[ANIMID_TURN]);

  // walk backwards animation
  m_spSkeletalSequenceList[ANIMID_WALKBACKWARDS] = (VisSkeletalAnimSequence_cl*)pMesh->GetSequence("Run_BWD", VIS_MODELANIM_SKELETAL);
  VVERIFY_OR_RET(m_spSkeletalSequenceList[ANIMID_WALKBACKWARDS]);

  m_bModelValid = true;
}
void AUnsealed4x4Pawn::UpdatePhysicsMaterial()
{
	if (GetActorUpVector().Z < 0)
	{
		if (bIsLowFriction == true)
		{
			GetMesh()->SetPhysMaterialOverride(NonSlipperyMaterial);
			bIsLowFriction = false;
		}
		else
		{
			GetMesh()->SetPhysMaterialOverride(SlipperyMaterial);
			bIsLowFriction = true;
		}
	}
}
void ATopDownShmupCharacter::BeginPlay()
{
    health = 100;
    //	Call base class	BeginPlay
    Super::BeginPlay();
    //	Spawn the weapon, if one was specified
    if (WeaponClass)
    {
        UWorld*	World =	GetWorld();
        if (World)
        {
            FActorSpawnParameters SpawnParams;
            SpawnParams.Owner =	this;
            SpawnParams.Instigator = Instigator;
            
            //	Need	to	set	rotation	like	this	because	otherwise	gun	points	down
            //	NOTE:	This	should	probably	be	a	blueprint	parameter
            
            FRotator Rotation(0.0f,	0.0f, -90.0f);
            //	Spawn the Weapon
            MyWeapon =	World->SpawnActor<AWeapon>(WeaponClass,	FVector::ZeroVector, Rotation, SpawnParams);
            if (MyWeapon)
            {
                //	This is	attached to	"WeaponPoint" which	is defined in the skeleton
                //	NOTE: This	should	probably	be	a	blueprint	parameter
                MyWeapon->WeaponMesh->AttachTo(GetMesh(),	TEXT("WeaponPoint"));
            }
        }
    }
}