コード例 #1
0
    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
0
ファイル: UIManager.cs プロジェクト: peli0451/arcactus
 /// <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
0
ファイル: HandBehaviour.cs プロジェクト: lmlynik/cardgame
    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
0
ファイル: UIHUD.cs プロジェクト: toooooooo/BEER
        // 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();
        }