private void RegisterPartRandom(BugPart part, Connection[] posibleConnections, IConnectable parent) { if (part.SetConnection(M.Mathn.SelectRandmo(posibleConnections, GeneratorController.SafeRandom()), parent, ((MonoBehaviour)parent).gameObject, this)) { Locations.Add(part.transform.position); mBugParts.Add(part); if (part is IConnectable) { mConnectables.Add(part as IConnectable); } if (mFuctionParts.ContainsKey(part.GetType())) { mFuctionParts[part.GetType()].Add(part); } } }
private void RegisterPart(BugPart part, Connection parentConnection, int parentID) { if (GetBugPart(parentID) == null) { throw new Exception("NULL"); } if (part.SetConnection(parentConnection, GetBugPart(parentID) as IConnectable, ((MonoBehaviour)GetBugPart(parentID)).gameObject, this)) { Locations.Add(part.transform.position); mBugParts.Add(part); if (part is IConnectable) { mConnectables.Add(part as IConnectable); } if (mFuctionParts.ContainsKey(part.GetType())) { mFuctionParts[part.GetType()].Add(part); } } }