231 insect: insect enemy type
创建dead动画资源
往insect head上添加socket
创建攻击root motion动画。motion warping需要与root motion合作使用
为buff_blue创建物理资产
设置simulate physic使sinsect死亡后能落到地板上而不是漂浮在空中,要将die函数设置为
----------BaseCharacter.h----------
//BlueprintNativeEvent不能和virtual关键字公用,并且在实现.cpp时要加后缀_implement以及子类继承重写时要加上
UFUNCTION(BlueprintNativeEvent)
void Die();
------------BaseCharacter.cpp-----------
void ABaseCharacter::GetHit_Implementation(const FVector& ImpactPoint, AActor* Hitter)
{
//DRAW_SPHERE_COLOR(ImpactPoint,FColor::Blue);
if (IsAlive() && Hitter)
{
DirectionalHitReact(Hitter->GetActorLocation());
}
//需要调用die函数(蓝图中的event die),才能走蓝图逻辑,而不是c++中的die_implementation
//You need to call the `Die` function (the `Event Die` in the Blueprint) to execute the Blueprint logic,
// rather than calling the `Die_Implementation` in the C++ code.
else Die();
PlayHitSound(ImpactPoint);
SpawnHitParticles(ImpactPoint);
}
------------Enemy.h------------
/** <ABaseCharacter> **/
virtual void Die_Implementation() override;
----------Enemy.cpp-----------
void AEnemy::Die_Implementation()
{
Super::Die_Implementation();
EnemyState = EEnemyState::EES_Dead;
//不加clear的话,角色死亡之后会像僵尸一样原地又立起来
ClearAttackTimer();
HideHealthBar();
//不加这一个的话,在角色销毁之前,胶囊体呆在原地会阻碍echo的前进
DisableCapsule();
SetLifeSpan(DeathLifeSpan);
//不加这一个的话,角色死亡之后可能会旋转
GetCharacterMovement()->bOrientRotationToMovement = false;
//如果不加这个设置,角色死亡之后还没销毁的这一阶段,武器仍能对echo造成伤害
SetWeaponCollisionEnabled(ECollisionEnabled::NoCollision);
SpawnSoul();
}
232 soul drift: making soul drift to the floor
为防止一杀死敌人时 我们就触碰到soul,连soul长什么杨都没看清soul就销毁了。我们需要先将soul置于一个高点的位置,然后逐渐下降到一定高度,让我们能够触碰到它
233 将敌人放进openworld世界地图中
设置navmeshboundvolume导航地图,设置target,让敌人在地图中巡逻
课程完结