void Awake() { // slotForChip = GetComponent<SlotForCard>(); slotGravity = GetComponent <SlotGravity>(); slotTeleport = GetComponent <SlotTeleport>(); _animIceBlock = transform.Find("IceBlock").GetComponent <Animation>(); _animIceGloss = _animIceBlock.transform.Find("Gloss").GetComponent <Animation>(); }
/// <summary> /// 生成底图 /// </summary> private IEnumerator GenerateSlots() { DebugUtil.Info("生成底图"); //生成节点 SlotRoot = GameObject.Find("Slot").transform; Slot slotAdd = null; SlotGenerator sGenerator = null; SlotTeleport sTeleport = null; for (int x = 0; x < field.width; x++) { yield return(0); for (int y = 0; y < field.height; y++) { field.slots[x, y] = _currentLevelProfile.GetSlot(x, Height - y - 1); field.generator[x, y] = _currentLevelProfile.GetGenerator(x, Height - y - 1); field.teleport[x, y] = _currentLevelProfile.GetTeleport(x, Height - y - 1); if (field.slots[x, y]) { slotAdd = CreateOneSlot(x, y); slotAdd.transform.SetParent(SlotRoot, false); if (field.generator[x, y]) { sGenerator = slotAdd.GetOrAddComponent <SlotGenerator>(); sGenerator.SetSlot(slotAdd); FightMgr.Instance.AllSlotGenerator.Add(sGenerator); } if (field.teleport[x, y] > 0) { sTeleport = slotAdd.GetOrAddComponent <SlotTeleport>(); sTeleport.TargetID = field.teleport[x, y]; } int gravity = _currentLevelProfile.GetGravity(x, Height - y - 1); switch (gravity) { case 0: slotAdd.slotGravity.gravityDirection = Side.Bottom; break; case 1: slotAdd.slotGravity.gravityDirection = Side.Left; break; case 2: slotAdd.slotGravity.gravityDirection = Side.Top; break; case 3: slotAdd.slotGravity.gravityDirection = Side.Right; break; } FightMgr.Instance.AllSlotGravity.Add(slotAdd.GetOrAddComponent <SlotGravity>()); } } } }