public static int BlockItemToIndex(this PlaneChildItem planeItem) { switch (planeItem) { default: return(0); case PlaneChildItem.Coin: return(1); case PlaneChildItem.Clockwise: return(2); case PlaneChildItem.CounterClockwise: return(3); case PlaneChildItem.Slash: return(4); case PlaneChildItem.BackSlash: return(5); case PlaneChildItem.Interation_Positive: return(6); case PlaneChildItem.Interation_Negative: return(7); } }
public void GeneratePlaneItem(int axis, int amount, PlaneChildItem itemName) { usableGroup.Clear(); int usableRange = 0; for (int index = 0; index < blockLevelSize * blockLevelSize; index++) { // 새로운 아이템을 표시할 수 있는 빈 공간 조사 if (LevelDesigner.Instance.vertexArray[axis].planeBlockGroup[index].CurrentItemName == PlaneChildItem.None) { usableGroup.Add(index); usableRange++; } } for (int index = 0; index < usableRange; index++) // 셔플 { int rand = Random.Range(0, usableRange); int temp = usableGroup[index]; usableGroup[index] = usableGroup[rand]; usableGroup[rand] = temp; } for (int index = 0; index < amount && index < usableRange; index++) { LevelDesigner.Instance.vertexArray[axis]. planeBlockGroup[usableGroup[index]].SetActiveBlockItem(itemName); } }
// private void Action_Consumption() { LevelDesigner.Instance.vertexArray[parentDirection.AxisToIndex()].GoldCount--; AudioManager.Instance.PlaySFXSound(SFXSoundType.CoinPickup); GameDesignManager.Instance.GameGold += 100; StartCoroutine(RoutineShowOff(thisTransform.GetChild(CurrentItemName.BlockItemToIndex()), 3.0f)); CurrentItemName = PlaneChildItem.None; }
public void SetActiveBlockItem(PlaneChildItem itemName) { if (_ChildItemStackIndex.Count >= 2) { thisTransform.GetChild(_ChildItemStackIndex.Pop()).gameObject.SetActive(false); } int index = itemName.BlockItemToIndex(); thisTransform.GetChild(index).gameObject.SetActive(true); _ChildItemStackIndex.Push(index); CurrentItemName = itemName; StartCoroutine(RoutineShowUp(thisTransform.GetChild(index), EffectTypeByItem(itemName), 2.5f, 0.4f)); }
public bool CheckItemIsEqual(PlaneChildItem itemType) { foreach (int id in specificPlaneBlockList) { if (planeBlockGroup[id].CurrentItemName != itemType) { if (IsOnMatched) { StartCoroutine(RoutineDisplaySign(informSign.position.y, -fadeHeight, 0.5f, informSign)); } IsOnMatched = false; return(false); } } if (!IsOnMatched) { StartCoroutine(RoutineDisplaySign(informSign.position.y, 0, 0.5f, informSign)); } IsOnMatched = true; return(true); }