public void SetSlotShape(GameShape.ShapeType shapeType, GameShape.ColorType colorType) { if (slotShape != null) { slotShape.ConfigureShape(shapeType, colorType); } }
public void TriggerShapeTransform(GameShape.ShapeType shapeType, GameShape.ColorType colorType) { queuedTransformData = new ShapeData(colorType, shapeType); transforming = true; anim.SetTrigger("Transform"); }
public ColorDictionary GetElementData(GameShape.ColorType key) { if (Contains(key, out int index)) { return(values[index]); } return(null); }
public static void EditSlotShape(Transform slot, GameShape.ShapeType shapeType, GameShape.ColorType shapeColor, float shapeSize) { GameShape newShape = slot.GetComponent <GameSlot>().GetSlotShapeTransform().GetComponent <GameShape>(); newShape.transform.localScale = new Vector3(shapeSize, shapeSize); GameShape shapeRef = newShape.GetComponent <GameShape>(); shapeRef.SetShapeColor(shapeColor); shapeRef.SetShapeType(shapeType); EditorUtility.SetDirty(shapeRef); EditorUtility.SetDirty(shapeRef.GetComponent <Image>()); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); }
public bool Contains(GameShape.ColorType targetKey, out int index) { if (colorKeys == null || values == null) { index = -1; return(false); } for (int i = 0; i < colorKeys.Count; i++) { if (colorKeys[i] == targetKey) { index = i; return(true); } } index = -1; return(false); }
public void Add(GameShape.ColorType key, ColorDictionary value) { if (colorKeys == null || values == null) { colorKeys = new List <GameShape.ColorType>(); values = new List <ColorDictionary>(); colorKeys.Add(key); values.Add(value); return; } if (!Contains(key, out int index)) { colorKeys.Add(key); values.Add(value); } return; }
public static void CreateSlotShape(Transform slot, GameShape.ShapeType shapeType, GameShape.ColorType shapeColor, float shapeSize) { GameObject shapePrefab = Resources.Load <GameObject>("Prefabs/GameShape"); GameObject newShape = PrefabUtility.InstantiatePrefab(shapePrefab, slot) as GameObject; newShape.transform.localPosition = Vector3.zero; newShape.transform.localScale = new Vector3(shapeSize, shapeSize); GameShape shapeRef = newShape.GetComponent <GameShape>(); shapeRef.ConfigureShape(shapeType, shapeColor); GameSlot slotRef = slot.GetComponent <GameSlot>(); slotRef.SetSlotShapeReference(newShape.transform); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); }
private void DrawGameShapeOptions(GameSlot slot) { GameShape shapeData = slot.GetSlotShape(); if (shapeData != null) { EditorGUILayout.LabelField($"Shape Info", EditorStyles.boldLabel); EditorGUILayout.LabelField($"Shape Color: {shapeData.colorType}"); EditorGUILayout.LabelField($"Shape Type: {shapeData.GetShapeType()}"); } else { EditorGUILayout.LabelField("Shape Info: No Shape Available"); } EditorGUILayout.Separator(); EditorGUILayout.LabelField("Lock Options", EditorStyles.boldLabel); desiredLockType = (SlotLock.LockType)EditorGUILayout.EnumPopup("Lock Type", desiredLockType); desiredLockTimer = EditorGUILayout.IntField("Lock Timer", desiredLockTimer); desiredLockSize = EditorGUILayout.FloatField("Lock Size", desiredLockSize); EditorGUILayout.BeginHorizontal(); if (slot.GetSlotLock() != null) { if (GUILayout.Button("Edit Lock", GUILayout.MaxWidth(150f))) { GameSlotTools.EditSlotLock(slot.transform, desiredLockType, desiredLockTimer, desiredLockSize); EditorUtility.SetDirty(slot.GetComponent <GameSlot>().GetSlotLock()); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); } } else { if (GUILayout.Button("Create Lock", GUILayout.MaxWidth(150f))) { GameSlotTools.CreateSlotLock(slot.transform, desiredLockType, desiredLockTimer, desiredLockSize); EditorUtility.SetDirty(slot.GetComponent <GameSlot>().GetSlotLock()); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); } } SlotLock slotLock = slot.GetSlotLock(); if (slotLock != null && GUILayout.Button("Destroy Lock", GUILayout.Width(150f))) { DestroyImmediate(slotLock.gameObject); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Separator(); EditorGUILayout.LabelField("Shape Options", EditorStyles.boldLabel); desiredShapeType = (GameShape.ShapeType)EditorGUILayout.EnumPopup("Shape Type", desiredShapeType); desiredShapeColor = (GameShape.ColorType)EditorGUILayout.EnumPopup("Shape Color", desiredShapeColor); desiredShapeSize = EditorGUILayout.FloatField("Shape Scale", desiredShapeSize); EditorGUILayout.BeginHorizontal(); if (slot.GetSlotShape() != null) { if (GUILayout.Button("Edit Shape", GUILayout.MaxWidth(150f))) { GameSlotTools.EditSlotShape(slot.transform, desiredShapeType, desiredShapeColor, desiredShapeSize); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); } } else { if (GUILayout.Button("Create Shape", GUILayout.MaxWidth(150f))) { GameSlotTools.CreateSlotShape(slot.transform, desiredShapeType, desiredShapeColor, desiredShapeSize); EditorUtility.SetDirty(slot.GetComponent <GameSlot>()); EditorUtility.SetDirty(slot.GetComponent <GameSlot>().GetSlotShape()); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); } } if (shapeData != null && GUILayout.Button("Destroy Shape", GUILayout.Width(150f))) { DestroyImmediate(shapeData.gameObject); EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Separator(); }