public static IEnumerator LineSurface(Emplacement place, OptionEffect options) { Vector3i shape = options.OptionShape.shape; /// (avancée, hauteur, largeur) Vector3i above = Vectors.Up; Vector3i pos = place.ipos; Vector3i offsetSurface = new Vector3i(0, options.OptionShape.offsetSurface, 0); bool reverse = options.OptionShape.reverse != ""; float pace = options.OptionShape.pace; bool collapse_once = options.OptionShape.reverse == "once"; Block air = Block.GetBlockByName("air", false); Block blk = options.OptionBlock.block; BlockSetter setter = new BlockSetter(options.OptionBlock); /// IntLine traj = new IntLine(place.ipos, Vectors.Float.UnitX); IntLine traj = new IntLine(place.ipos, Emplacement.Truncate(place.direction, true, true)); for (int avance = 0; avance < shape.x; avance++) { Vector3i where = traj.Get(avance); Debug.Log("LineSurface " + avance.ToString()); IntLine orth = new IntLine(Vectors.ToFloat(where), Vectors.Float.UnitZ); foreach (int ligne in LR(shape.z)) { Vector3i at = orth.Get(ligne); //Debug.Log("Line Surface inner " + p.ToString()); at = Geo3D.Surface(at); // I don't need surface before orthogonal ... surface made after setter.Apply(at + above + offsetSurface); } setter.Push(); yield return(new WaitForEndOfFrame()); } }
public static IEnumerator Cave(EntityPlayer player, Emplacement place, OptionEffect options) { /// TODO: enumérer les colonnes et s'arreter à surface BlockSetter setter = new BlockSetter(options.OptionBlock); Vector3i shape = options.OptionShape.shape; Vector3i start = Geo3D.Surface(place.ipos); int depth = shape.y; Vector3 direction = Vectors.Float.UnitY; // cannot use negative, so positive and get(_k) ! IntLine colonne = new IntLine(Vectors.ToFloat(start), direction); // Debug.Log(String.Format("Cave: pos={0} start={1} dir={2} ground={3}", place.position, start, direction, ground)); for (int d = 0; d < depth; d++) { // Debug.Log(String.Format("cave {0} {1}", d, setter)); if (options.OptionShape.ground != "" && d == depth - 1) { setter.options.block = Block.GetBlockByName(options.OptionShape.ground, false); } Vector3i where = colonne.Get(-d); Vector3i dxy = new Vector3i(0, 0, 0); foreach (int p in SdtdUtils.EffectsGround.LR(shape.x)) { foreach (int q in SdtdUtils.EffectsGround.LR(shape.z)) { dxy.x = p; dxy.z = q; Printer.Log(20, "Cave Apply (d,p) =", d, p, "where, dxy=", where, dxy); setter.Apply(where + dxy); } } Printer.FLog(20, "cave Push {0} {1}", d, where); setter.Push(); } yield return(new WaitForEndOfFrame()); }