Files
taptap2024_GJ_chidouren/Assets/Scripts/Game/Component/ScenePart.cs

48 lines
1.4 KiB
C#
Raw Normal View History

2024-10-21 17:02:25 +08:00
using System.Collections.Generic;
using Sirenix.OdinInspector;
2024-10-21 16:20:37 +08:00
using UnityEngine;
namespace Game.Component
{
public class ScenePart : MonoBehaviour
{
public TextAsset mapCacheData;
public PolygonCollider2D cameraCollider;
public Transform createPos;
public int completeConditionNumber = 10;
public float playerBaseSpeed = 4f;
[LabelText ("当前完成数:")] private int _currentConditionNumber = 0;
2024-10-21 22:29:53 +08:00
public int CurrentConditionNumber => this._currentConditionNumber;
2024-10-21 17:02:25 +08:00
private List<EnemyEntity> _enemyEntities;
2024-10-21 22:29:53 +08:00
public float CurProgress => this._currentConditionNumber * 1f / completeConditionNumber;
2024-10-21 16:20:37 +08:00
public bool IsComplete => _currentConditionNumber >= completeConditionNumber;
public bool AddConditionNumber (int number = 1)
{
this._currentConditionNumber += number;
return _currentConditionNumber >= completeConditionNumber;
}
2024-10-21 17:02:25 +08:00
public void RefreshInit ()
{
this._currentConditionNumber = 0;
foreach (var enemyEntity in this._enemyEntities)
{
enemyEntity.ResetState ();
}
}
public void InitPart ()
{
this._enemyEntities = new List<EnemyEntity> ();
this._enemyEntities = new List<EnemyEntity> (transform.GetComponentsInChildren<EnemyEntity> (true));
}
2024-10-21 16:20:37 +08:00
}
}