public SavedComponent(BeyondComponent bc) { template = bc.template.name; state = bc.state; group = bc.beyondGroup; side = bc.side; groupPosition = bc.groupPosition; cells = bc.cells; position = bc.transform.position; rotation = bc.transform.rotation; name = bc.transform.gameObject.name; layer = bc.transform.gameObject.layer; isTrigger = bc.transform.gameObject.GetComponent <BoxCollider>().isTrigger; enabled = bc.transform.gameObject.GetComponent <BoxCollider>().enabled; }
private static Quaternion sideRotation(cellSide cs) { switch (cs) { case cellSide.Right: return(Quaternion.Euler(0, 90f, 0)); case cellSide.Front: return(Quaternion.Euler(0, 180f, 0)); case cellSide.Left: return(Quaternion.Euler(0, 270f, 0)); } return(Quaternion.identity); }
public static cellSide closestSide(Vector3 distanceFromPivot) { float d = Vector3.Distance(distanceFromPivot, new Vector3(0, 0, -0.5f)); cellSide result = cellSide.Front; float d2 = Vector3.Distance(distanceFromPivot, new Vector3(0, 0, 0.5f)); if (d2 < d) { d = d2; result = cellSide.Back; } d2 = Vector3.Distance(distanceFromPivot, new Vector3(-0.5f, 0, 0)); if (d2 < d) { d = d2; result = cellSide.Left; } d2 = Vector3.Distance(distanceFromPivot, new Vector3(0.5f, 0, 0)); if (d2 < d) { d = d2; result = cellSide.Right; } d2 = Vector3.Distance(distanceFromPivot, new Vector3(0, 0.5f, 0)); if (d2 < d) { d = d2; result = cellSide.Up; } d2 = Vector3.Distance(distanceFromPivot, new Vector3(0, -0.5f, 0)); if (d2 < d) { d = d2; result = cellSide.Down; } return(result); }
public static bool IsTemplatePresentHere(BeyondGroup group, Vector3Int here, string t_name, cellSide cs) { if (group == null) { Debug.Log("IsTemplatePresentHere found no group, returned FALSE"); return(false); } // TODO : With the restriction on Ghosts, I can't snap dragged objects. Is there a way around this ? return(group.BeyondComponentsAt(here).Exists(bc => bc.template.name == t_name && bc.side == cs && bc.state != BC_State.Ghost)); }