private ConfigTransformGroup(byte count, ConfigTransform p0, ConfigTransform p1, ConfigTransform p2, ConfigTransform p3) { this.count = count; configTransform0 = p0; configTransform1 = p1; configTransform2 = p2; configTransform3 = p3; }
public ConfigTransformGroup(List <ConfigTransform> p) { if (p.Count > 4) { Debug.LogError("more than 4 config transforms"); } configTransform0 = p.Count > 0 ? p[0] : NullTransform; configTransform1 = p.Count > 1 ? p[1] : NullTransform; configTransform2 = p.Count > 2 ? p[2] : NullTransform; configTransform3 = p.Count > 3 ? p[3] : NullTransform; count = (byte)Mathf.Min(p.Count, MaxCount); }
public ConfigTransformGroup(ConfigTransform[] p) { if (p.Length > MaxCount) { Debug.LogError("more than 4 config transforms!"); } configTransform0 = p.Length > 0 ? p[0] : NullTransform; configTransform1 = p.Length > 1 ? p[1] : NullTransform; configTransform2 = p.Length > 2 ? p[2] : NullTransform; configTransform3 = p.Length > 3 ? p[3] : NullTransform; count = (byte)Mathf.Min(p.Length, MaxCount); }
/// <summary> /// can these basic configurations turned into the given value? /// </summary> /// <param name="value">the value we are trying to match</param> /// <param name="basicConfigs">the basic configurations we are testing</param> /// <param name="configTransform">the result which contains the basic configuration and the needed transformation</param> /// <returns>true if found a transformation</returns> static private bool FindBasicElemTransform(byte value, BaseMeshVariants[] basicConfigs, out ConfigTransform configTransform) { configTransform = NullTransform; // first try to match every base shape, so if multiple could be used with transformations // then use the one which doesn't require any transformations for (byte i = 0; i < basicConfigs.Length; ++i) { var basic = basicConfigs[i]; if (value == (byte)basic.PieceConfig) { configTransform = new ConfigTransform(i, PieceTransform.None); return(true); } } // no direct match, so try transforming them PieceTransform transform; for (byte i = 0; i < basicConfigs.Length; ++i) { var basic = basicConfigs[i]; if (FindTransform(value, (byte)basic.PieceConfig, out transform)) { configTransform = new ConfigTransform(i, transform); // If the transformation doesn't contain an y mirror transformation then we're done, // if it does, then keep going. In most tilesets the top and bottom part look different, // so only go with that if there is nothing else (and the theme could give warnings depending on the type) if (((byte)transform & (byte)PieceTransform.MirrorY) == 0) { return(true); } } } return(configTransform.BaseMeshIndex > -1); }
public ConfigTransformGroup(ConfigTransform p0, ConfigTransform p1, ConfigTransform p2, ConfigTransform p3) : this(4, p0, p1, p2, p3) { }
public ConfigTransformGroup(ConfigTransform p0, ConfigTransform p1, ConfigTransform p2) : this(3, p0, p1, p2, NullTransform) { }
public ConfigTransformGroup(ConfigTransform p0, ConfigTransform p1) : this(2, p0, p1, NullTransform, NullTransform) { }
public ConfigTransformGroup(ConfigTransform p0) : this(1, p0, NullTransform, NullTransform, NullTransform) { }