// 활성 아이템 오브젝트 처리 (폭탄)
void MoveBomb() {
  int i, j;
  for(i = 0; i<10; ++i) {
    if(bomb[i].state == DEAD)
      continue;
    if(clock() - bomb[i].tick > 3000) {
      bomb[i].state = DEAD;
      refresh_object = 1;
      for(j = 0; j<3; ++j) {
        if(IsSamePos(&player[j].pos, &bomb[i].pos))
          DamagePlayer(j);
      }
      for(j = 0; j<number_of_enemies; ++j) {
        if(IsSamePos(&enemy[j].pos, &bomb[i].pos))
          DamagePlayer(j);
      }
      for(j = 0; j<40; ++j) {
        if(effect[j].state == DEAD) {
          effect[j].state = NORMAL;
          effect[j].pos = bomb[i].pos;
          effect[j].dir = EAST;
          effect[j].tick = clock();
          break;
        }
      }
      for(j = 0; j<40; ++j) {
        if(effect[j].state == DEAD) {
          effect[j].state = NORMAL;
          effect[j].pos = bomb[i].pos;
          effect[j].dir = WEST;
          effect[j].tick = clock();
          break;
        }
      }
      for(j = 0; j<40; ++j) {
        if(effect[j].state == DEAD) {
          effect[j].state = NORMAL;
          effect[j].pos = bomb[i].pos;
          effect[j].dir = SOUTH;
          effect[j].tick = clock();
          break;
        }
      }
      for(j = 0; j<40; ++j) {
        if(effect[j].state == DEAD) {
          effect[j].state = NORMAL;
          effect[j].pos = bomb[i].pos;
          effect[j].dir = NORTH;
          effect[j].tick = clock();
          break;
        }
      }
    }
  }
}
Beispiel #2
0
void daRamboo_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) {
	EN_LandbarrelPlayerCollision(this, apThis, apOther);
	DamagePlayer(this, apThis, apOther);

	fleeFast = false;
	doStateChange(&StateID_Flee);
}
Beispiel #3
0
void daKoopaThrow::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) {
	if (Type == 5) {
		PlaySoundAsync(this, currentInfo->breakSound);
		S16Vec nullRot = {0,0,0};
		Vec efScale = {3.0f, 3.0f, 3.0f};
		SpawnEffect(currentInfo->deathEffect, 0, &this->pos, &nullRot, &efScale);
		// dStageActor_c *spawned = CreateActor(EN_ITEM, 0x20000063, this->pos, 0, 0);
		// spawned->pos.x = this->pos.x;
		// spawned->pos.y = this->pos.y;

		int p = CheckExistingPowerup(apOther->owner);
		if (p == 0 || p == 3) {	// Powerups - 0 = small; 1 = big; 2 = fire; 3 = mini; 4 = prop; 5 = peng; 6 = ice; 7 = hammer
			dAcPy_c__ChangePowerupWithAnimation(apOther->owner, 1);
		}

		this->Delete(1);

		return;
	}

	DamagePlayer(this, apThis, apOther);

	if (Type == 1 || Type == 2) {
		PlaySoundAsync(this, SE_BOSS_JR_BOMB_BURST);

		S16Vec nullRot = {0,0,0};
		Vec efScale = {0.75f, 0.75f, 0.75f};
		SpawnEffect("Wm_en_burst_s", 0, &this->pos, &nullRot, &efScale);
		Vec hitScale = {1.25f, 1.25f, 1.25f};
		SpawnEffect("Wm_mr_wirehit", 0, &this->pos, &nullRot, &hitScale);
		this->Delete(1);
	}
}
// 활성 아이템 오브젝트 처리 (이텍트 == 칼)
void MoveEffect() {
  int i;
  for(i = 0; i<40; ++i) {
    if(effect[i].state == DEAD)
      continue;
    if(clock() - effect[i].tick > speed_fastest) {
      effect[i].tick = clock();
      enum ObjectType target = TryMove(effect[i].pos, effect[i].dir);
      if(target == WALL) {
        effect[i].state = DEAD;
        effect[i].dir = STOP;
      }
      else if(target == PLAYER) {
        Move(&effect[i].pos, effect[i].dir);
        int j;
        for(j = 0; j<3; ++j) {
          if(IsSamePos(&player[j].pos, &effect[i].pos))
            DamagePlayer(j);
        }
      }
      else if(target == ENEMY) {
        Move(&effect[i].pos, effect[i].dir);
        int j;
        for(j = 0; j<number_of_enemies; ++j) {
          if(IsSamePos(&enemy[j].pos, &effect[i].pos))
            DamageEnemy(j);
        }
      }
      else {
        Move(&effect[i].pos, effect[i].dir);
        refresh_object = 1;
      }
    }
  }
}
// 플레이어 이동 및 충돌 검사
void MovePlayer() {
  int i;
  for(i = 0; i<number_of_players; ++i) {
    if(player[i].state == DEAD)
      continue;
    if(player[i].state == FROZEN)
      continue;
    int speed = speed_normal;
    if(player[i].state == FAST) {
      speed = speed_fast;
      if(player[i].state_end <= clock())
        player[i].state = NORMAL;
    }
    else if(player[i].state == SLOW) {
      speed = speed_slow;
    }
    else {
    }
    if(clock() - player[i].tick > speed) {
      player[i].tick = clock();
      enum ObjectType target = TryMove(player[i].pos, player[i].dir);
      if(target == WALL) {
      }
      else if(target == ENEMY || target == EFFECT) {
        Move(&player[i].pos, player[i].dir);
        DamagePlayer(i);
      }
      else if(target == FRUIT) {
        Move(&player[i].pos, player[i].dir);
        int fruit_id = FindFruitByPos(player[i].pos);
        if(!(fruit_id == -1)) {
          fruit[fruit_id].state = DEAD;
          player[i].fruit++;
          fruit_remain--;
          refresh_status = 1;
          refresh_object = 1;
        }
      }
      else if(target == ITEM) {
        Move(&player[i].pos, player[i].dir);
        int item_id = FindItemByPos(player[i].pos);
        if(!(item_id == -1)) {
          item[item_id].state = DEAD;
          player[i].item = rand()%4+1;
          refresh_status = 1;
          refresh_object = 1;
        }
      }
      else {
        Move(&player[i].pos, player[i].dir);
        refresh_object = 1;
      }
    }
  }
}
// 적 이동 및 충돌 검사
void MoveEnemy() {
  int i;
  for(i = 0; i<number_of_enemies; ++i) {
    if(enemy[i].state == DEAD)
      continue;
    if(enemy[i].state == FROZEN) {
      if(enemy[i].state_end <= clock()) {
        enemy[i].state = SLOW;
        enemy[i].state_end = clock()+5000;
      }
      else {
        continue;
      }
    }
    int speed = speed_normal;
    if(enemy[i].state == FAST) {
      speed = speed_fast;
    }
    else if(enemy[i].state == SLOW) {
      speed = speed_slow;
      if(enemy[i].state_end <= clock())
        enemy[i].state = NORMAL;
    }
    else {
    }
    if(clock() - enemy[i].tick > speed) {
      enemy[i].tick = clock();
      enum ObjectType target = TryMove(enemy[i].pos, enemy[i].dir);
      if(target == WALL) {
        enemy[i].dir = rand()%4+1;
        enemy[i].tick -= 1000;
      }
      else if(target == PLAYER) {
        Move(&enemy[i].pos, enemy[i].dir);
        int j;
        for(j = 0; j<3; ++j) {
          if(IsSamePos(&player[j].pos, &enemy[i].pos))
            DamagePlayer(j);
        }
      }
      else if(target == EFFECT) {
        DamageEnemy(i);
      }
      else {
        Move(&enemy[i].pos, enemy[i].dir);
        refresh_object = 1;
      }
    }
  }
}
Beispiel #7
0
bool daKoopaThrow::collisionCat7_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther) {
	DamagePlayer(this, apThis, apOther);

	if (Type == 1 || Type == 2) {
		PlaySoundAsync(this, SE_BOSS_JR_BOMB_BURST);

		S16Vec nullRot = {0,0,0};
		Vec burstScale = {0.75f, 0.75f, 0.75f};
		SpawnEffect("Wm_en_burst_s", 0, &this->pos, &nullRot, &burstScale);
		Vec hitScale = {1.25f, 1.25f, 1.25f};
		SpawnEffect("Wm_mr_wirehit", 0, &this->pos, &nullRot, &hitScale);
		this->Delete(1);
	}
	return true;
}
Beispiel #8
0
bool daRamboo_c::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther) {
	DamagePlayer(this, apThis, apOther);
	return true;
}
Beispiel #9
0
bool daRamboo_c::collisionCat7_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther) {
	DamagePlayer(this, apThis, apOther);
	return true;
}
Beispiel #10
0
void monster::Attack()
{
    qDebug () << "ATTACKING!" << endl;
    emit DamagePlayer(MonsterStats["Damage"]);
}
Beispiel #11
0
void dMeteor::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) {
	DamagePlayer(this, apThis, apOther);
}
void daKoopaBreath::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { DamagePlayer(this, apThis, apOther); }
Beispiel #13
0
void daFuzzyBear_c::yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther) { DamagePlayer(this, apThis, apOther); }
Beispiel #14
0
void daWrench::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { DamagePlayer(this, apThis, apOther); }
Beispiel #15
0
// Called every frame
void APoseidonCharacter::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
	
	PlayerController->PlayDynamicForceFeedback(1.f, -1, true, true, true, true, EDynamicForceFeedbackAction::Update, LatentInfo);
		
#pragma region Tick mElapsedTime

	mElapsedTime += DeltaTime;

	if (mElapsedTime >= 1.f)
	{
#pragma region Load Game Save
		//Load audio logs 
		if (!hasLoadedGameSave || isLoading)
		{
			USaveGamePSI* LoadGameInstance = Cast<USaveGamePSI>(UGameplayStatics::CreateSaveGameObject(USaveGamePSI::StaticClass()));
			if (LoadGameInstance != NULL)
			{
				LoadGameInstance = Cast<USaveGamePSI>(UGameplayStatics::LoadGameFromSlot(LoadGameInstance->CurrentCheckpoint, LoadGameInstance->UserIndex));
				if (mAudioLogCount != 0)
				{
					mAudioLogCount = LoadGameInstance->AudioLogCount;
					mHarpoonAmmo = LoadGameInstance->AmmoCount;

					if (mHarpoonAmmo < 2)
					{
						mHarpoonAmmo = 2;
					}

					ObjectiveText->SetText(LoadGameInstance->CurrentObjective);
					mCurrentLevel = LoadGameInstance->CurrentLevel;
				}
					
				//isRumbleEnabled = LoadGameInstance->EnableRumble;

				FString volumeString = "MasterVolume";
				AAudioManager::GetInstance()->SetRtpc(volumeString, LoadGameInstance->AudioVolume, this);

				isLoading = false;
				hasLoadedGameSave = true;
			}
		}
#pragma endregion
		if (mIsInteracting)
		{
			mIsInteracting = false;
		}

		if (mFlashing)
		{
			mFlickCount++;
			if (mFlickCount == 3)
			{
				mFlickCount = 0;
				mFlashing = false;
				Flashlight->SetVisibility(true);
			}
		}

		if (mIsRepairing)
		{
			mTargetIntegrity = mCurrentIntegrity = mMaxIntegrity;
			mHarpoonAmmo = mHarpoonMaxAmmo;
			mOxygen = mTargetOxygen = mMaxOxygen;
			AnimationBool(HasAmmo, true);

			mIsRepairing = false;
		}

		mElapsedTime = 0;
	}

#pragma region Tick Health and HUD
	ReduceOxygen(mOxygenDecreaseRate);

	if (!mIsPlayerAlive)
	{
		currentDeathPosition = FMath::Lerp(currentDeathPosition,targetDeathPosition,mDeathAlpha);
		mDeathAlpha += DeltaTime * 0.25f;
		mDeathAlpha = FMath::Clamp(mDeathAlpha,0.f,1.f);
		PlayerCamera->SetRelativeLocation(currentDeathPosition);
		
		if (currentDeathPosition.Z == 0.f)
		{
			Die();
		}
	}
	
	if (mHealth == 0 || mOxygen == 0)
	{
		SetPlayerAlive(false);
	}
#pragma endregion

#pragma region Tick Grapple

	if (mIsGrappleReady)
	{
		CheckGrappleOverlap();
	}

	if (mChangeFieldOfView)
	{
		mFieldOfView = FMath::Lerp(mFieldOfView, mAimView, DeltaTime*mGrappleSpeed);
		if (mFieldOfView <= mAimView)
		{
			mChangeFieldOfView = false;
		}
		PlayerCamera->FieldOfView = mFieldOfView;
	}
	else
	{
		if (mFieldOfView != mNormalView)
		{
			mFieldOfView = FMath::Lerp(mFieldOfView, mNormalView, DeltaTime*mGrappleSpeed);
			PlayerCamera->FieldOfView = mFieldOfView;
		}
	}
#pragma endregion

#pragma region Tick Interaction
	if (PlayerController)
	{
		APickupObject* newPickupObj = Cast<APickupObject>(GetFocusedObj());
		if (FocusedPickup != newPickupObj)
		{
			if (FocusedPickup)
			{
				FocusedPickup->EndFocus();
				PlayerHUD->ChangeCrosshair(EReticleEnum::RE_HIP);
			}
		}

		FocusedPickup = newPickupObj;

		if (newPickupObj)
		{
			newPickupObj->StartFocus();
			PlayerHUD->ChangeCrosshair(EReticleEnum::RE_PICKUP);
			
			if (mHarpoonMaxAmmo == mHarpoonAmmo && newPickupObj->GetClass() == AHarpoonPickup::StaticClass())
			{
				PlayerHUD->ChangeCrosshair(EReticleEnum::RE_PICKUP_FULL);
			}
		}
		

		AInteractObject* newInteractObj = Cast<AInteractObject>(GetFocusedObj());
		if (InteractObj != newInteractObj)
		{
			if (InteractObj)
			{
				InteractObj->EndFocus();
				PlayerHUD->ChangeCrosshair(EReticleEnum::RE_HIP);
			}
		}

		InteractObj = newInteractObj;

		if (newInteractObj)
		{
			newInteractObj->StartFocus();
			PlayerHUD->ChangeCrosshair(EReticleEnum::RE_ACTIVATE);
		}
		
	}

#pragma endregion

#pragma region Update Suit Integrity
	if (mCurrentIntegrity != mTargetIntegrity)
	{
		mCurrentIntegrity = FMath::Lerp(mCurrentIntegrity, mTargetIntegrity, mAlphaIntegrity);
		mAlphaIntegrity += DeltaTime;
		mAlphaIntegrity = FMath::Clamp(mAlphaIntegrity, 0.f, 1.f);
		if (mCurrentIntegrity == 0)
		{
			if (!mWaterStarts)
			{
				ReportNoise("Event_Fill", 0.0f);
				DamagePlayer();
				mWaterStarts = true;
			}
		}
	}
#pragma endregion

#pragma region Update Add Oxygen
	if (mOxygen != mTargetOxygen)
	{
		mOxygen = FMath::Lerp(mOxygen, mTargetOxygen, mAlphaOxygen);
		mAlphaOxygen += DeltaTime;
		mAlphaOxygen = FMath::Clamp(mAlphaOxygen, 0.f, 1.f);
	}
#pragma endregion
}