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); } }
// Use this for initialization public override void Initialize() { gui = GetComponent<ShipEditorGooey> (); player = GetComponent<Player> (); costDisplay = GameObject.Find ("ShipEditorCanvas/Cost Panel").GetComponent<ResourceDisplay>(); hardpointDisplay = GameObject.Find ("ShipEditorCanvas/Bottom Panel").GetComponent<HardpointDisplay>(); editedship = GameObject.FindGameObjectWithTag("EditedShip"); frames = GameObject.Find ("Frames"); attachments = GameObject.Find ("Attachments"); dockedunits = GameObject.Find ("Mothership/DockedUnits"); }
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); }