+ UiManager의 CombatUi, OceanUi 모두 분리 각각의 씬에서 CombatUiManager, OceanUiManager로 변경 + Ocean, OceanUi input action map 추가 및 변경 input action map, uiManager 변경에 따른 Player input 로직 변경 + CombatPlayer가 죽으면 GameOverUi 추가 + 재시작 기능 추가 + 인벤토리 Ui 수정 + 슬라임 보스 로직 및 애니메이션 수정
83 lines
2.8 KiB
C#
83 lines
2.8 KiB
C#
using System.Collections.Generic;
|
|
using BlueWaterProject;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
public class SlimeBossMapController : MonoBehaviour
|
|
{
|
|
// 컴포넌트
|
|
[Title("컴포넌트")]
|
|
[SerializeField] private Transform playerSpawnTransform;
|
|
[SerializeField] private Transform bossSpawnTransform;
|
|
[SerializeField] private Transform bossInstantiateTransform;
|
|
[SerializeField] private TitanSlime bossPrefab;
|
|
[SerializeField] private List<SlimeState> slimeStateList = new(5);
|
|
[field: SerializeField] public Transform ParticleInstantiateLocation { get; private set; }
|
|
|
|
// 추가 설정
|
|
[Title("추가 설정")]
|
|
[SerializeField] private float splitPower = 500f;
|
|
[SerializeField] private Vector3 leftSplitDirection = new(-1, 1, 0);
|
|
[SerializeField] private Vector3 rightSplitDirection = new(1, 1, 0);
|
|
|
|
private List<GameObject> bossInstanceList = new(10);
|
|
|
|
public void InitBossMap()
|
|
{
|
|
DataManager.Inst.CurrentSaveStage = SaveStage.SLIME;
|
|
AllDestroyObjects();
|
|
bossInstanceList = new List<GameObject>(10);
|
|
|
|
var player = GameObject.FindWithTag("CombatPlayer");
|
|
if (player && playerSpawnTransform)
|
|
{
|
|
player.transform.position = playerSpawnTransform.position;
|
|
}
|
|
|
|
InstantiateSlime(bossSpawnTransform.position, 1, true);
|
|
}
|
|
|
|
private TitanSlime InstantiateSlime(Vector3 instantiatePosition, int level, bool hasRabbit)
|
|
{
|
|
var instantiateBoss = Instantiate(bossPrefab, instantiatePosition, Quaternion.identity, bossInstantiateTransform);
|
|
var slimeState = slimeStateList.Find((list) => list.Level == level);
|
|
instantiateBoss.Init(slimeState, hasRabbit);
|
|
|
|
CombatUiManager.Inst.FieldBossHpSlider.SetHpSlider(instantiateBoss.MaxHp, instantiateBoss.BossName);
|
|
|
|
bossInstanceList.Add(instantiateBoss.gameObject);
|
|
|
|
return instantiateBoss;
|
|
}
|
|
|
|
public void SpawnSplitSlimes(Vector3 deathPosition, int nextLevel, bool hasRabbit)
|
|
{
|
|
var instantiateBossLeft = InstantiateSlime(deathPosition, nextLevel, hasRabbit);
|
|
var instantiateBossRight = InstantiateSlime(deathPosition, nextLevel, false);
|
|
|
|
instantiateBossLeft.AddForce(leftSplitDirection, splitPower, ForceMode.Impulse);
|
|
instantiateBossRight.AddForce(rightSplitDirection, splitPower, ForceMode.Impulse);
|
|
}
|
|
|
|
public void AllDestroyBoss()
|
|
{
|
|
foreach (var element in bossInstanceList)
|
|
{
|
|
Destroy(element);
|
|
}
|
|
}
|
|
|
|
public void AllDestroyObjects()
|
|
{
|
|
foreach (var element in bossInstanceList)
|
|
{
|
|
Destroy(element);
|
|
}
|
|
|
|
foreach (Transform element in ParticleInstantiateLocation)
|
|
{
|
|
Destroy(element.gameObject);
|
|
}
|
|
}
|
|
} |