コード例 #1
0
 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
0
 public static void Translate(this Rigidbody2D rigidbody, Vector2 translation, Axes axes = Axes.XY)
 {
     rigidbody.SetPosition(rigidbody.transform.position + translation.ToVector3(), axes);
 }
コード例 #3
0
ファイル: PolydrawObject.cs プロジェクト: wtrebella/Grappler
		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
0
ファイル: PolydrawObject.cs プロジェクト: wtrebella/Grappler
		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
0
        public void Show(Vector2 position, float zPosition)
        {

            this.transform.localPosition = position.ToVector3(zPosition);
            startTime = Time.time;
            SetAlpha(0);
            this.gameObject.SetActive(true);
        }