当前位置: 首页>>代码示例>>C#>>正文


C# RectTransform.Translate方法代码示例

本文整理汇总了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);
    }
开发者ID:p-schulz,项目名称:codevember2015,代码行数:19,代码来源:CirclesBehaviour.cs

示例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;
     }
 }
开发者ID:peli0451,项目名称:arcactus,代码行数:14,代码来源:UIManager.cs

示例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));
    }
开发者ID:lmlynik,项目名称:cardgame,代码行数:14,代码来源:HandBehaviour.cs

示例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();
        }
开发者ID:toooooooo,项目名称:BEER,代码行数:35,代码来源:UIHUD.cs


注:本文中的UnityEngine.RectTransform.Translate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。