private void CreatePart(int hashId) { // spawn entity ship part GameObject obj = null; ShipPart part = new ShipPart(ParamCube); Spawn(ref obj, part); EntShipPart entity = obj.GetComponent <EntShipPart>(); entity.Init(part); // force start on entity entity.Start(); ShipPartEntities.Add(hashId, entity); }
public void CreateParts(ref Dictionary <int, Tool.ShipPart> shipParts) { foreach (KeyValuePair <int, Tool.ShipPart> part in shipParts) { GameObject partObj = null; Spawn(ref partObj, part.Value); // set name of part partObj.name = part.Value.Param.Type.ToString(); // init list of position in entity ship part EntShipPart entShipPart = partObj.GetComponent <EntShipPart>(); entShipPart.Init(part.Value); // force start on entity entShipPart.Start(); ShipPartEntities.Add(part.Key, entShipPart); } }