本文整理汇总了C#中Polygon.CopyPoint2DataTo方法的典型用法代码示例。如果您正苦于以下问题:C# Polygon.CopyPoint2DataTo方法的具体用法?C# Polygon.CopyPoint2DataTo怎么用?C# Polygon.CopyPoint2DataTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polygon
的用法示例。
在下文中一共展示了Polygon.CopyPoint2DataTo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOutlinedPolygon
// retourne un nouveau polygone correspondant a un contour du polygone polygon
// calcule a partir de quantity
public static Polygon GetOutlinedPolygon(Polygon polygon, float quantity)
{
Point2Data [] pointsData = new Point2Data[polygon.GetPoints ().Count];
polygon.CopyPoint2DataTo (pointsData);
for (int pIndex = 0; pIndex < pointsData.Length; ++pIndex)
{
Point2 pt2 = polygon.GetPoints ()[pIndex];
Vector2 position = pointsData[pIndex].position;
position = position + pt2.GetCalculatedNormal () * quantity;
pointsData[pIndex].position = position;
}
return new Polygon (pointsData);
}
示例2: Generate
public IEnumerator Generate(Polygon polygon)
{
GameObject pool = _poolGen.GetParentGameObject ();
if (_isLoading)
{
// lors de la copie, on attend le frame suivante
// pour que la copie soit complete
_isLoading = false;
yield return new WaitForEndOfFrame();
}
// on conserve les donnees des Function_hideObject de la plage et du Function_PoolInitializer
// avant de les detruire et de les reaffecter
Function_hideObject [] hiders = pool.GetComponents<Function_hideObject> ();
Function_hideObject hider = hiders[0].id == 0 ? hiders[0] : hiders[1];
ArrayList hiderConfig = hider.getConfig ();
if (hider != null)
{
Destroy (hider);
}
Function_hideObject rimHider = hiders[0].id == 1 ? hiders[0] : hiders[1];
ArrayList rimHiderConfig = rimHider.getConfig ();
if (rimHider != null)
{
Destroy (rimHider);
}
Function_PoolInitializer initializer = pool.GetComponent <Function_PoolInitializer> ();
ArrayList initializerConfig = initializer.getConfig ();
if (initializer != null)
{
if(pool.transform.FindChild ("muret"))
{
GameObject lowWall = pool.transform.FindChild ("muret").gameObject;
if(lowWall)
{
Destroy (lowWall);
}
}
Transform sidewalk = pool.transform.FindChild ("plage");
if(sidewalk)
{
Destroy (sidewalk.GetComponent<AABBOutlineResizer> ());
}
Destroy (initializer);
}
// _polygon = polygon.GetMirrorX();
_polygon = polygon;
List<Point2Data> tpsList = new List<Point2Data>();
foreach(Point2Data p2d in _polygon._pointsData)
{
tpsList.Add(p2d);
}
pointsData = new Point2Data[_polygon.GetPoints ().Count];
_polygon.CopyPoint2DataTo (pointsData);
_poolGen.Generate (_polygon);
_rimCount = _poolGen.GetRimCount ();
for(int i = 0; i < tpsList.Count; i++)
{
if(tpsList[i].bstairway)
{
pointsData[i].bstairway = true;
}
}
// on attend la frame suivante que les Function soit prete pour les configurer
// avec les valeurs sauvegardées
// et que les script soit supprimés
yield return new WaitForEndOfFrame();
Function_hideObject addedHider = pool.AddComponent<Function_hideObject> ();
addedHider._nameObjectToHide = "plage";
addedHider._strObjectToHide = "plage";
addedHider.setConfig (hiderConfig);
Function_hideObject addedRimHider = gameObject.AddComponent<Function_hideObject> ();
addedRimHider.id = 1;
addedRimHider._nameObjectToHide = "margelle";
addedRimHider._strObjectToHide = "margelle";
addedRimHider.setConfig (rimHiderConfig);
addedRimHider.SetObjectToHide (_poolGen.GetRimObjects ());
//.........这里部分代码省略.........
示例3: Awake
void Awake()
{
transform.parent = GameObject.Find ("MainNode").transform;
transform.localScale = Vector3.one;
goParent3DPosition = new GameObject();
//goParent3DPosition.transform.parent = GameObject.Find ("MainNode").transform;
goParent3DPosition.name = "3Dposition_" + name;
goBloc = GameObject.Instantiate(Resources.Load("GRI181")) as GameObject;
goBloc.transform.parent = goParent3DPosition.transform;
goBloc.GetComponent<Renderer>().enabled = false;
goBloc.name = "GRI181";
foreach(Transform child in goBloc.transform)
{
child.gameObject.layer = 14; // underwater
if(child.GetComponent<Renderer>())
{
child.GetComponent<Renderer>().enabled = false;
}
}
_poolGen = new PoolGenerator (gameObject);
if (pointsData.Length > 0)
{
// pointsData = MirrorX(pointsData);
_polygon = new Polygon (pointsData);
if (!_IsGenerated)
{
_IsGenerated = true;
_pointsDataBackup = new Point2Data[pointsData.Length];
_polygon.CopyPoint2DataTo (_pointsDataBackup);
_poolGen.Generate (_polygon);
_rimCount = _poolGen.GetRimCount ();
DesignerDesjoyaux fb = gameObject.AddComponent<DesignerDesjoyaux> ();
fb.gofiltrationBlock = goBloc;
fb.poolDesigner = this;
Function_hideObject sidewalkHider = gameObject.AddComponent<Function_hideObject> ();
sidewalkHider._nameObjectToHide = "plage";
sidewalkHider._strObjectToHide = "plage";
Function_hideObject rimHider = gameObject.AddComponent<Function_hideObject> ();
rimHider.id = 1;
rimHider._nameObjectToHide = "margelle";
rimHider._strObjectToHide = "margelle";
rimHider._hide = false;
rimHider.SetObjectToHide (_poolGen.GetRimObjects ());
gameObject.AddComponent<Function_PoolInitializer> ();
//StartCoroutine (Generate ());
}
else
{
// copie
_isLoading = true;
StartCoroutine (Generate (_polygon));
}
}
else
{
_IsGenerated = true;
_polygon = new Polygon ();
DesignerDesjoyaux fb = gameObject.AddComponent<DesignerDesjoyaux> ();
fb.gofiltrationBlock = goBloc;
fb.poolDesigner = this;
Function_hideObject sidewalkHide = gameObject.AddComponent<Function_hideObject> ();
sidewalkHide._nameObjectToHide = "plage";
sidewalkHide._strObjectToHide = "plage";
Function_hideObject rimHider = gameObject.AddComponent<Function_hideObject> ();
rimHider.id = 1;
rimHider._nameObjectToHide = "margelle";
rimHider._strObjectToHide = "margelle";
rimHider._hide = false;
rimHider.SetObjectToHide (_poolGen.GetRimObjects ());
gameObject.AddComponent<Function_PoolInitializer> ();
//StartCoroutine (WaitForGameobjectReadyToDoAction ());
}
init3DPoints();
nextCurrentStairwayID(pointsData);
savedPointsData = new Point2Data[pointsData.Length];
for(int j = 0; j < pointsData.Length; j++)
{
savedPointsData[j] = pointsData[j];
//.........这里部分代码省略.........
示例4: Awake
void Awake()
{
transform.parent = GameObject.Find ("MainNode").transform;
if(_uiName != null)
{
setUI ((FunctionUI_OS3D)GameObject.Find ("MainScene").GetComponent ("PoolUIv2"));
// setUI ((FunctionUI_OS3D)GameObject.Find ("MainScene").GetComponent ("PoolDesignerUI"));
}
transform.localScale = Vector3.one;
_poolGen = new PoolGenerator (gameObject);
if (pointsData.Length > 0)
{
// pointsData = MirrorX(pointsData);
_polygon = new Polygon (pointsData);
if (!_IsGenerated)
{
_IsGenerated = true;
_pointsDataBackup = new Point2Data[pointsData.Length];
_polygon.CopyPoint2DataTo (_pointsDataBackup);
_poolGen.Generate (_polygon);
_rimCount = _poolGen.GetRimCount ();
Function_hideObject sidewalkHider = gameObject.AddComponent<Function_hideObject> ();
sidewalkHider._nameObjectToHide = "plage";
sidewalkHider._strObjectToHide = "plage";
Function_hideObject rimHider = gameObject.AddComponent<Function_hideObject> ();
rimHider.id = 1;
rimHider._nameObjectToHide = "margelle";
rimHider._strObjectToHide = "margelle";
rimHider._hide = false;
rimHider.SetObjectToHide (_poolGen.GetRimObjects ());
gameObject.AddComponent<Function_PoolInitializer> ();
//StartCoroutine (Generate ());
}
else
{
// copie
_isLoading = true;
StartCoroutine (Generate (_polygon));
}
}
else
{
_IsGenerated = true;
_polygon = new Polygon ();
Function_hideObject sidewalkHide = gameObject.AddComponent<Function_hideObject> ();
sidewalkHide._nameObjectToHide = "plage";
sidewalkHide._strObjectToHide = "plage";
Function_hideObject rimHider = gameObject.AddComponent<Function_hideObject> ();
rimHider.id = 1;
rimHider._nameObjectToHide = "margelle";
rimHider._strObjectToHide = "margelle";
rimHider._hide = false;
rimHider.SetObjectToHide (_poolGen.GetRimObjects ());
gameObject.AddComponent<Function_PoolInitializer> ();
StartCoroutine (WaitForGameobjectReadyToDoAction ());
}
//gameObject.GetComponent ("ObjData").SendMessage ("updateSpecFcns");
//transform.localPosition = currentPosition;
}