internal static void Prepare(GameObject target, Container template, Vector3 referencePoint) { RepairableContainer repairable = GetOrCreateComponent <RepairableContainer>(target); repairable.Template = template.gameObject; repairable.ParentContainer = GetParent(repairable.Template); repairable.TargetPosition = RepairableContainer.GetTargetPosition(repairable.ParentContainer, referencePoint); repairable.TargetRotation = Quaternion.identity; repairable.RequiresTools = target.CompareTag("Metal"); GetOrCreateComponent <BoxCollider>(target); target.layer = vp_Layer.Container; }
internal static void Prepare(GameObject target, Container template, Vector3 referencePoint) { if (target.GetComponent <RepairableContainer>() != null) { return; } RepairableContainer repairable = target.AddComponent <RepairableContainer>(); repairable.Template = GetParent(template); repairable.ParentContainer = GetParent(repairable.Template); repairable.TargetPosition = RepairableContainer.GetTargetPosition(repairable.ParentContainer, referencePoint); repairable.TargetRotation = repairable.Template.transform.localRotation; repairable.RequiresTools = true; if (target.GetComponent <Collider>() == null) { target.AddComponent <BoxCollider>(); } target.layer = vp_Layer.Container; }