66 lines
1.8 KiB
C#
66 lines
1.8 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using DragonLi.Core;
|
|
using Mirror;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
namespace Valheim
|
|
{
|
|
public class BattleArea : NetworkBehaviour
|
|
{
|
|
public BoxCollider boxCollider;
|
|
public TextMeshProUGUI AreaIdText;
|
|
|
|
public GameObject bossObj;
|
|
public GameObject boss2Obj;
|
|
public GameObject enemyObj;
|
|
|
|
public bool isWin;
|
|
|
|
// 区域编号
|
|
#if UNITY_EDITOR
|
|
[DisplayOnly]
|
|
#endif
|
|
public int AreaId;
|
|
|
|
[Server]
|
|
public void Init(int areaId)
|
|
{
|
|
AreaId = areaId;
|
|
AreaIdText.text = areaId.ToString();
|
|
var index = GameManager.Ins.curEnemyLevel+1;
|
|
bossObj.SetActive(index%5==0&&GameManager.Ins.curMapId==0);
|
|
enemyObj.SetActive(index%5!=0);
|
|
boss2Obj.SetActive(index%5==0&&GameManager.Ins.curMapId==1);
|
|
// MonoSingleton<CoroutineTaskManager>.Instance.WaitSecondTodo(() =>
|
|
// {
|
|
// if(isShow|| !gameObject.activeSelf)
|
|
// return;
|
|
// isShow=true;
|
|
// GameInit.Ins.self.ClosePathGuide();
|
|
// StartCoroutine(GameManager.Ins.CreateBattleAreaEnemy());
|
|
// gameObject.SetActive(false);
|
|
// },10f);
|
|
}
|
|
|
|
public void OnTriggerEnter(Collider other)
|
|
{
|
|
if (other.CompareTag("Player"))
|
|
{
|
|
if(GameManager.Ins.isShowBattleArea)
|
|
return;
|
|
GameManager.Ins.isShowBattleArea = true;
|
|
//触发区域怪物
|
|
GameInit.Ins.self.ClosePathGuide();
|
|
StartCoroutine(GameManager.Ins.CreateBattleAreaEnemy());
|
|
gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|