//Should only be used to generate the shrine public N8Block(int id) { AttachedTo = null; Attachees = new List<N8Block>(); _id = id; this.type = ""; this.name = ""; }
public N8Block(int id, string type, string name) { AttachedTo = null; Attachees = new List<N8Block>(); _id = id; this.type = type; this.name = name; }
//Copy constructor. Does not copy attachments or ID. public N8Block(N8Block source, int ID) { AttachedTo = null; Attachees = new List<N8Block>(); this._id = ID; type = source.type; name = source.name; position = source.position; rotation = source.rotation; }
public N8Block(string[] pieces) { AttachedTo = null; Attachees = new List<N8Block>(); _id = int.Parse(pieces[0]); type = pieces[1]; name = pieces[2]; position = Utilities.VectorFromN8String(pieces[3]); rotation = Utilities.RotationFromN8String(pieces[4]); if(pieces.Length > 5) int.TryParse(pieces[5], out Special); }
public void AttachAllTo(N8Block which, bool absolute) { foreach (N8Tronic t in tronics.Tronics) { if (absolute) { which.AttachToMeAbsolute(t); } else { which.AttachToMe(t); } } }
public void AttachAllNonPositional(N8Block which, bool absolute) { foreach (FlowTronic t in sequence) { if (!t.IsPositionDependent()) { if (absolute) { which.AttachToMeAbsolute(t); } else { which.AttachToMe(t); } } } foreach (DataBlock db in data) { if (absolute) { which.AttachToMeAbsolute(db); } else { which.AttachToMe(db); } } }
public bool Equals(N8Block other) { //Just checking ID, should maybe check other stuff potentially. if (this._id == other._id) { return true; } else { return false; } }
public void Detach() { if (this.AttachedTo != null) { N8Block Attacher = this.AttachedTo; this.AttachedTo = null; Attacher.Attachees.Remove(this); } }
/// <summary> /// Attaches other to this block, and keeps other in the same location /// </summary> /// <param name="?"></param> public void AttachToMeAbsolute(N8Block other) { other.position = other.position - this.position; AttachToMe(other); }
/// <summary> /// Attaches other to this block, making its position become relative to this block. /// </summary> /// <param name="other"></param> public void AttachToMe(N8Block other) { this.Attachees.Add(other); other.AttachedTo = this; //Coordinate systems get translated too - now other's coords are relative to this, instead of 0,0,0 }