private void HandlePlayerAttacking() { if (IsFireButtonPressed() && player.attackDelay <= 0) // player hits attack button { Combat_Manager.PlayerAttack(player, _dungeon.CurrentRoom); player.attackDelay = player.attackDelayTime; } else { player.attackDelay--; } }
// *** CHECK OUT MY TERRIBLE FINITE STATE MACHINE HEH *** // public static void HandleMobAI(Player player, Room room) { foreach (Mob mob in room.mobList) { switch (mob.mobState) { case MobState.Wander: if (mob.WithinRangeOfPlayer(player)) { mob.mobState = MobState.Aggressive; break; } else { mob.Wander(room); break; } case MobState.Aggressive: if (mob.CanAttackPlayer(player)) { Combat_Manager.MobAttackPlayer(mob, player, room); break; } else if (!mob.WithinRangeOfPlayer(player)) { mob.mobState = MobState.Wander; break; } else { mob.MoveTowardsPlayer(player, room); break; } } } }
void HandleUpdate() { if (_roomTransitionDirection != Direction.None) { DoRoomTransition(_roomTransitionDirection); } else { HandleInputs(); HandlePlayerAttacking(); TestForPlayerCollisionsWithEnvironment(); HandlePlayerMovement(); FSM_Manager.HandleMobAI(player, _dungeon.CurrentRoom); Combat_Manager.HandleProjectileMovement(_dungeon.CurrentRoom); Combat_Manager.CheckCombatCollisions(player, _dungeon.CurrentRoom); Loot_Manager.CheckForPlayerLootCollisions(player, _dungeon.CurrentRoom); // ** HANDLE PLAYER DEATH SOMETIME if (!player.Alive) { Debug.Log("Player Death."); } } }