public override bool MakeUp(ref GameObject target, params object[] values) { bool bAutoCreation = (bool)values[0]; Vector3 vAt = (Vector3)values[1]; bool bBody = (bool)values[2]; bool bAttachments = (bool)values[3]; bool bAutoIsoLight = (bool)values[4]; IsoTile refTile = Tile; IsoTileBulk refBulk = (IsoTileBulk)values[5]; if (target == null) { if (!bAutoCreation) { return(false); } return(TileControlWand.Tile_Create(ref target, vAt, refTile, bBody, bAttachments, bAutoIsoLight, refBulk)); } IsoTile TargetTile = IsoTile.Find(target); if (refTile == null || TargetTile == null) { return(false); } // Undo.Record() code is aleady in Copycat() TargetTile.Copycat(refTile, bBody, bAttachments, true); target = TargetTile.gameObject; return(true); }
public static bool Tile_Create(ref GameObject target, Vector3 position, IsoTile refTile, bool bIncludeBody, bool bIncludeAttachments, bool bAutoIsoLight, IsoTileBulk bulk) { var bulks = IsoMap.instance.BulkList; if (bulk == null) { float fMin = float.MaxValue; for (int i = 0; i < bulks.Count; ++i) { float fDistance = Vector3.Distance(position, bulks[i].GetBounds().ClosestPoint(position)); if (fDistance < fMin) { bulk = bulks[i]; fMin = fDistance; } } if (bulk == null) { Debug.LogWarning("To create a tile, you need at least one Bulk in the Scene."); return(false); } } IsoTile tile = bulk.NewTile(position - bulk.transform.position, false); if (tile == null) { return(false); } target = tile.gameObject; if (refTile != null) { tile.Copycat(refTile, bIncludeBody, bIncludeAttachments, true); } return(true); }