public static ShipComponentBehaviour InstantiateBehaviour(SystemLink link, TacklePlaceBehaviour tackle) { var c = (ShipComponentBehaviour)Instantiate(GameResources.GetShipComponent(link.item.name), tackle.transform.position, tackle.transform.rotation); c.tacklePlace = c.gameObject.AddComponent <TacklePlaceBehaviour>(); c.tacklePlace.Init(tackle); c.SetLink(link); return(c); }
public void Init(TacklePlaceBehaviour tackle) { if (tackle.transform.childCount > 0) { clipRotation = tackle.transform.localRotation * tackle.transform.GetChild(0).localRotation; } else { clipRotation = tackle.clipRotation; } clipAngle = tackle.clipAngle; Destroy(tackle); }