本文整理汇总了C#中UnityEngine.Vector2.ToVector3方法的典型用法代码示例。如果您正苦于以下问题:C# Vector2.ToVector3方法的具体用法?C# Vector2.ToVector3怎么用?C# Vector2.ToVector3使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Vector2
的用法示例。
在下文中一共展示了Vector2.ToVector3方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitPositioning
private void InitPositioning(Vector2 position, bool flyUp)
{
this.transform.position = position.ToVector3(this.transform.position.z);
initialPosition = this.transform.position;
if (flyUp)
{
RectTransform bubbleTransform = GetComponent<RectTransform>();
Rect canvasRect = canvas.GetComponent<RectTransform>().rect;
this.targetPosition = canvas.transform.TransformPoint(new Vector3(Random.Range(-180, 180), canvasRect.height / 2 - 140, bubbleTransform.localPosition.z));
}
else
{
this.targetPosition = position.ToVector3(transform.position.z);
}
}
示例2: Translate
public static void Translate(this Rigidbody2D rigidbody, Vector2 translation, Axes axes = Axes.XY)
{
rigidbody.SetPosition(rigidbody.transform.position + translation.ToVector3(), axes);
}
示例3: AddPoint
public int AddPoint(Vector2 point, int insertPoint)
{
if(insertPoint < 0 || insertPoint > points.Count-1)
points.Add(new PolydrawPoint2(transform.InverseTransformPoint(point.ToVector3(drawSettings.axis, drawSettings.zPosition)).ToVector2(drawSettings.axis)));
else
points.Insert(insertPoint, new PolydrawPoint2(transform.InverseTransformPoint(point.ToVector3(drawSettings.axis, drawSettings.zPosition)).ToVector2(drawSettings.axis)));
#if UNITY_EDITOR
EditorUtility.SetDirty(this);
#endif
return (insertPoint < 0 || insertPoint > points.Count-1) ? points.Count-1 : insertPoint;
}
示例4: SetPoint
public void SetPoint(int index, Vector2 point)
{
if(index > -1 && index < points.Count) {
PolydrawPoint2 currentPoint = points[index];
PolydrawPoint2 newPoint = new PolydrawPoint2(transform.InverseTransformPoint(point.ToVector3(drawSettings.axis, drawSettings.zPosition)).ToVector2(drawSettings.axis));
newPoint.borderIgnored = currentPoint.borderIgnored;
points[index] = newPoint;
}
#if UNITY_EDITOR
EditorUtility.SetDirty(this);
#endif
}
示例5: Show
public void Show(Vector2 position, float zPosition)
{
this.transform.localPosition = position.ToVector3(zPosition);
startTime = Time.time;
SetAlpha(0);
this.gameObject.SetActive(true);
}