public void LoadShip(Ship s) { Clear(); ship = s; foreach (Part p in DesignManager.instance.GetAllParts()) { GameObject g = partIconPool.GetGameObject(); PartIcon pi = g.GetComponent <PartIcon>(); pi.DisplayPart(p); } foreach (Hardpoint h in ship.hardpoints) { GameObject g = hardpointDisplayPool.GetGameObject(); HardpointDisplay ha = g.GetComponent <HardpointDisplay>(); DragDestination dd = g.GetComponent <DragDestination>(); if (dd == null) { g.AddComponent <DragDestination>(); g.GetComponent <DragDestination>().handler = this; } ha.DisplayHardpoint(h); } }
public void DisplayParts(List <Part> parts) { Clear(); foreach (Part p in parts) { GameObject g = partIconPool.GetGameObject(); PartIcon pi = g.GetComponent <PartIcon>(); pi.DisplayPart(p); } }
public void DisplayParts(Dictionary <Part, int> parts) { Clear(); foreach (Part p in parts.Keys) { GameObject g = partIconPool.GetGameObject(); PartIcon pi = g.GetComponent <PartIcon>(); pi.DisplayPart(p); } }
public void ChildDragStart(GameObject start) { dragClone = Instantiate(start, transform); dragClone.GetComponent <RectTransform>().sizeDelta = new Vector2(75, 75); //don't want our cloned drag object also triggering drag events and the like dragClone.GetComponent <Image>().raycastTarget = false; PartIcon dragIcon = dragClone.GetComponent <PartIcon>(); dragIcon.DisplayPart(start.GetComponent <PartIcon>().part); }
public void ChildDragEnd() { if (overTop != null) { Debug.Log("Drag ended over top of" + overTop.name); PartIcon pi = dragClone.GetComponent <PartIcon>(); HardpointDisplay hd = overTop.GetComponent <HardpointDisplay>(); if (hd != null) { if (hd.hardpoint.MountPart(pi.part)) { Debug.Log("Mounted!"); hd.Refresh(); } } } Destroy(dragClone); }