萌妖层级修改
This commit is contained in:
parent
587f8bf66c
commit
19f6a980d0
@ -614,7 +614,7 @@ SpriteRenderer:
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: 5a21d33cca7048a46aed91d4e3e32ec3, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: aa6f66265746cb041bbfdf887abe64f9, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
@ -637,6 +637,7 @@ GameObject:
|
||||
- component: {fileID: 4205844203331515742}
|
||||
- component: {fileID: 9162732182785843388}
|
||||
- component: {fileID: 8475889323091750017}
|
||||
- component: {fileID: 7780224884041102910}
|
||||
m_Layer: 5
|
||||
m_Name: myCanva
|
||||
m_TagString: Untagged
|
||||
@ -728,6 +729,17 @@ MonoBehaviour:
|
||||
m_BlockingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
--- !u!210 &7780224884041102910
|
||||
SortingGroup:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6362446851701897971}
|
||||
m_Enabled: 1
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!1 &7634432846538185418
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -562,8 +562,9 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: b8d04d25bab1a3541925d4cc205ad1d8, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
retbutton: {fileID: 0}
|
||||
ClosureObj: {fileID: 0}
|
||||
role: {fileID: 8433650274028726420}
|
||||
fun: {fileID: 0}
|
||||
DamageUp: 1
|
||||
AttackRange: 1
|
||||
AttackCooldown: 1
|
||||
@ -571,3 +572,4 @@ MonoBehaviour:
|
||||
NumberOfBullets: 1
|
||||
SpeedOfBullets: 1
|
||||
CritRate: 1
|
||||
DamageOfSky: 1
|
||||
|
@ -449,6 +449,7 @@ MonoBehaviour:
|
||||
retbutton: {fileID: 0}
|
||||
ClosureObj: {fileID: 0}
|
||||
id: M_S_001
|
||||
Name:
|
||||
camp: 0
|
||||
hp: 100
|
||||
dieIndex: -1
|
||||
@ -458,6 +459,15 @@ MonoBehaviour:
|
||||
_Canvas: {fileID: 0}
|
||||
spriteRenderers: {fileID: 0}
|
||||
HurtDirectin: 0
|
||||
Quality:
|
||||
Elements:
|
||||
Info:
|
||||
SkillId:
|
||||
AttackType:
|
||||
AttackActionType:
|
||||
AttackCD: 0
|
||||
CritRate: 0
|
||||
CriticalHitRateBonus: 0
|
||||
gold: 10
|
||||
MaxAttack: 10
|
||||
MinAttack: 10
|
||||
|
@ -158,6 +158,8 @@ MonoBehaviour:
|
||||
role: {fileID: 8433650274028726420}
|
||||
panelPrefab: {fileID: 8782491854383104488, guid: 61ffa7d22a51b1e48a3495af66e30de0, type: 3}
|
||||
attackRange: {fileID: 681042887138380540}
|
||||
isShowPanel: 0
|
||||
instantiatedPanel: {fileID: 0}
|
||||
--- !u!1 &6070656209494785206
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -363,6 +365,7 @@ MonoBehaviour:
|
||||
animator: {fileID: 9037670100243302216}
|
||||
fireAni: {fileID: 0}
|
||||
BulletStartPos: {fileID: 2562350995381512747}
|
||||
AttackSpeed: 1
|
||||
direction: {x: 0, y: 0}
|
||||
--- !u!58 &1338343970434073545
|
||||
CircleCollider2D:
|
||||
@ -446,6 +449,7 @@ MonoBehaviour:
|
||||
retbutton: {fileID: 0}
|
||||
ClosureObj: {fileID: 0}
|
||||
id: 0
|
||||
Name:
|
||||
camp: 0
|
||||
hp: 100
|
||||
dieIndex: -1
|
||||
@ -455,7 +459,18 @@ MonoBehaviour:
|
||||
_Canvas: {fileID: 0}
|
||||
spriteRenderers: {fileID: 0}
|
||||
HurtDirectin: 0
|
||||
Quality:
|
||||
Elements:
|
||||
Info:
|
||||
SkillId:
|
||||
AttackType:
|
||||
AttackActionType:
|
||||
AttackCD: 0
|
||||
CritRate: 0
|
||||
CriticalHitRateBonus: 0
|
||||
gold: 10
|
||||
MaxAttack: 10
|
||||
MinAttack: 10
|
||||
physicalArmor: 10
|
||||
magicArmor: 5
|
||||
Navigation: {fileID: 0}
|
||||
@ -467,6 +482,9 @@ MonoBehaviour:
|
||||
mycollider: {fileID: 1338343970434073545}
|
||||
attackClass: {fileID: 7276635428522831207}
|
||||
CurrentIndex: 0
|
||||
hitIndex: 2
|
||||
normalIndex: 0
|
||||
isHit: 0
|
||||
enemyId:
|
||||
moveSpeed: 0
|
||||
harmNumber: 0
|
||||
|
@ -89,14 +89,14 @@ public class SpawnPool : Base
|
||||
}
|
||||
public void UpdateNodeList()
|
||||
{
|
||||
// 获取所有带有 SortingGroup 组件的物体
|
||||
// 获取所有带有 SortingGroup 组件的敌人对象
|
||||
List<GameObject> gameObjectsList = new List<GameObject>();
|
||||
|
||||
foreach (GameObject go in Enemys)
|
||||
{
|
||||
// 获取该物体上的 SortingGroup 组件
|
||||
SortingGroup sortingGroup = go.GetComponent<SortingGroup>();
|
||||
if (sortingGroup != null&&go.activeSelf)
|
||||
if (sortingGroup != null && go.activeSelf)
|
||||
{
|
||||
// 添加到列表中
|
||||
gameObjectsList.Add(go);
|
||||
@ -106,19 +106,28 @@ public class SpawnPool : Base
|
||||
// 按照 y 轴排序
|
||||
gameObjectsList.Sort((a, b) => a.transform.position.y.CompareTo(b.transform.position.y));
|
||||
|
||||
// 设置 SortingGroup 的 sortingOrder
|
||||
// 设置 SortingGroup 和子 Canvas 的 sortingOrder
|
||||
for (int i = 0; i < gameObjectsList.Count; i++)
|
||||
{
|
||||
SortingGroup sortingGroup = gameObjectsList[i].GetComponent<SortingGroup>();
|
||||
if (sortingGroup != null)
|
||||
{
|
||||
// 设置 sortingOrder 来决定显示的层级
|
||||
sortingGroup.sortingOrder = gameObjectsList.Count - i+2;
|
||||
// 计算排序顺序
|
||||
int order = gameObjectsList.Count - i + 2;
|
||||
sortingGroup.sortingOrder = order;
|
||||
|
||||
// 获取子 Canvas 并设置其 sortingOrder
|
||||
Canvas canvas = gameObjectsList[i].GetComponentInChildren<Canvas>();
|
||||
if (canvas != null)
|
||||
{
|
||||
canvas.sortingOrder = order;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (IsStartGet)
|
||||
|
@ -84,7 +84,7 @@ public class cardContorl : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndD
|
||||
|
||||
|
||||
MengyaoInfo.Instance.mengyaoIdToRole.Add(mY.GetComponent<Role>().id, mY);
|
||||
|
||||
SpawnPool.intance.Enemys.Add(mY);//存入图层排序的数组
|
||||
this.enabled = false;
|
||||
cardBox.instance.ChangeInPlaceNumber(1);
|
||||
mask.SetActive(true);
|
||||
|
Loading…
Reference in New Issue
Block a user