public void Initialize(DrawerController controller, Option option) { this.Controller = controller; this.Option = option; this.Dragging = false; }
public static GameObject CreateOption(PuzzleEditor editor, DrawerController controller, Object prefab, Transform parent, string name, bool ableToEdit) { GameObject newObj = (GameObject)GameObject.Instantiate(prefab, parent); newObj.name = name; Initialize(editor, controller, newObj.transform, ableToEdit, name); return(newObj); }
private static void Initialize(PuzzleEditor editor, DrawerController controller, Transform newObj, bool ableToEdit, string name) { GameObject buttons = newObj.Find("PlusMinus").gameObject; Transform resource = newObj.Find("Resource"); Transform sprite = resource.Find("Sprite"); Text amountText = resource.Find("Amount").GetComponent <Text>(); Option optionScp = newObj.GetComponent <Option>(); Draggable draggable = sprite.GetComponent <Draggable>(); InitializeButtons(buttons, ableToEdit); InitiliazeSprite(sprite, name); draggable.Initialize(controller, optionScp); optionScp.Initialize(editor, name, amountText, draggable, ableToEdit); }