死亡计数修改
This commit is contained in:
parent
8d253a5394
commit
57f0331432
@ -132,8 +132,8 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7939695578342722628}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 2.199, y: 0.2, z: 0}
|
||||
m_LocalScale: {x: 2.8898215, y: 1.7881608, z: 0}
|
||||
m_LocalPosition: {x: 1.7837, y: 0.2, z: 0}
|
||||
m_LocalScale: {x: 2.1912572, y: 1.7881608, z: 0}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8433650275485930555}
|
||||
@ -181,7 +181,7 @@ SpriteRenderer:
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: 5437a302a2f98684992c68de0f20ceab, type: 3}
|
||||
m_Color: {r: 1, g: 0.05694356, b: 0, a: 0.6313726}
|
||||
m_Color: {r: 1, g: 0.05694356, b: 0, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
@ -400,7 +400,7 @@ BoxCollider2D:
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 3.1955504, y: 1.1528659}
|
||||
m_Size: {x: 6, y: 1.1528659}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!1 &8433650275485930554
|
||||
GameObject:
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 0d58228599c57ee91f4a2ac8924e53b2cd23dfe8
|
||||
Subproject commit c04f3f2ed9571f522b41ec9f27928529d7c9f352
|
@ -61,6 +61,18 @@ public class SpawnPool : Base
|
||||
|
||||
[HideInInspector]
|
||||
public int deadNumber = 0;
|
||||
public int DeadNumber
|
||||
{
|
||||
get=> deadNumber;
|
||||
set
|
||||
{
|
||||
deadNumber = value;
|
||||
if (deadNumber >= GenerateQuantityMax)
|
||||
{
|
||||
// gameGlobal.GameVictory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 状态变量
|
||||
@ -196,7 +208,7 @@ public class SpawnPool : Base
|
||||
void GenerateEnemy()
|
||||
{
|
||||
|
||||
GameObject enemy = EnemyPool.Get(); // 获取一个敌人对象
|
||||
GameObject enemy = EnemyPool.Get(); // 获取一个敌人对象
|
||||
|
||||
// 如果池子中没有可用的对象,创建新的敌人
|
||||
if (enemy == null)
|
||||
@ -212,6 +224,7 @@ public class SpawnPool : Base
|
||||
Enemys.Add(enemy);
|
||||
}
|
||||
|
||||
//enemy.GetComponent<Role>().ResetAllStatus();
|
||||
// 设置敌人的位置和其他属性
|
||||
enemy.SetActive(true); // 激活敌人对象
|
||||
enemy.transform.position = SpawnLocation.position;
|
||||
@ -224,14 +237,11 @@ public class SpawnPool : Base
|
||||
// 当池子中敌人死亡或者被回收时,将其回收到池中
|
||||
public void ReturnEnemyToPool(GameObject enemy)
|
||||
{
|
||||
//enemy.GetComponent<Role>().mycollider.enabled = false;
|
||||
enemy.SetActive(false); // 禁用敌人对象
|
||||
EnemyPool.Return(enemy); // 将敌人回收到池中
|
||||
Enemys.Remove(enemy);
|
||||
deadNumber++;
|
||||
if (deadNumber>= GenerateQuantityMax)
|
||||
{
|
||||
gameGlobal.GameVictory();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
|
@ -37,6 +37,10 @@ public class UIContorl : Base
|
||||
{
|
||||
killnumber = value;
|
||||
this.KIllNumberText.text = killnumber + "/" + maxEnemynumber;
|
||||
if (killnumber==maxEnemynumber)
|
||||
{
|
||||
gameGlobal.GameVictory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class enemy : Role
|
||||
SkillBox.instance.AddExperience(6, this.gameObject.transform);
|
||||
}
|
||||
|
||||
UIContorl.instance.Killnumber += 1;
|
||||
// UIContorl.instance.Killnumber += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user