本文整理汇总了C#中UnityEngine.RectTransform.Translate方法的典型用法代码示例。如果您正苦于以下问题:C# RectTransform.Translate方法的具体用法?C# RectTransform.Translate怎么用?C# RectTransform.Translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.RectTransform
的用法示例。
在下文中一共展示了RectTransform.Translate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SpawnCircle
public void SpawnCircle(Vector3 pos, int start_size, int max_lifetime, int circle_number)
{
// init start parameters of circle
this.max_lifetime = max_lifetime;
this.start_size = start_size;
this.position = pos;
this.circle_number = circle_number;
this.lifetime = 0;
circle_transform = gameObject.GetComponent<RectTransform>();
circle_transform.Translate(pos, Space.World);
gameObject.AddComponent<CircleCollider2D>();
circle_collider = gameObject.GetComponent<CircleCollider2D>();
circle_collider.radius = start_size;
// set number of circle
setNumber(circle_number);
}
示例2: BubbleUp
/// <summary>
/// Makes RectTransforms float upwards
/// </summary>
/// <param name="rect">Rect.</param>
private IEnumerator BubbleUp(RectTransform rect)
{
while (true) {
yield return new WaitForFixedUpdate();
if(!rect.Equals(null)) {
rect.Translate (0, .001f, 0);
} else break;
yield return null;
}
}
示例3: TranslateCard
private static void TranslateCard (int index, RectTransform cardRectTransform)
{
//by trial and error best fit for Deck element, this makes the DealCards(GameObject source = null) a bit pointless since it will work only for that element, whatev
cardRectTransform.Translate (-110, 175, 0);
var rotations = new float[] { 4, 1f, -1f, -4 };
var yDeltas = new int[] { -40, 0, 0, -40 };
var xDeltas = new int[] { 20, 5, -5, -20 };
var cardRotation = Vector3.forward * (rotations [index] * 5);
cardRectTransform
.DOLocalMove (new Vector3 (75 + xDeltas [index] + index * 150, 190 + yDeltas [index], 0), cardDealSpeed)
.JoinIntoSequence (cardRectTransform.DORotate (cardRotation, cardDealSpeed));
}
示例4: Start
// Use this for initialization
void Start()
{
buttonSpawn.Init();
txtTimer.text="";
List<Rsc> rscList=ResourceManager.GetResourceList();
for(int i=0; i<rscList.Count; i++){
if(i==0) rscObjList[i].Init();
else rscObjList.Add(rscObjList[0].Clone("RscObj"+i, new Vector3(i*90, 0, 0)));
rscObjList[i].imageIcon.sprite=rscList[i].icon;
}
OnLife(0);
OnNewWave(1);
OnResourceChanged(new List<int>());
OnScoreChanged(0);
if(SpawnManager.AutoStart()){
buttonSpawn.rootObj.SetActive(false);
//StartCoroutine(AutoStartTimer());
OnSpawnTimer(SpawnManager.GetAutoStartDelay());
}
storyRect = storyObj.GetComponent<RectTransform>();
storyRect.Translate(0, 0, 0);
defaultX = storyRect.position.x;
storyObj.SetActive(true);
storyAudio.Play();
infoImages = GameObject.FindGameObjectsWithTag("InfoImagesTag");
OnInfoButton();
}