Exemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        instance = this;

        Vector3 spawnPosition = startPoint.position;

        for (int i = 0; i < tilesToPreSpawn; i++)
        {
            spawnPosition -= tilePrefab.startPoint.localPosition;
            tile spawnedTile = Instantiate(tilePrefab, spawnPosition, Quaternion.identity) as tile;
            // if(tilesWithNoObstaclesTmp > 0)
            // {
            //     spawnedTile.DeactivateAllObstacles();
            //     tilesWithNoObstaclesTmp--;
            // }
            // else
            // {
            spawnedTile.ActivateRandomObstacle();
            // }

            spawnPosition = spawnedTile.endPoint.position;
            spawnedTile.transform.SetParent(transform);
            spawnedTiles.Add(spawnedTile);
        }
    }
Exemplo n.º 2
0
 public void instantiate(toolManager tM, int i)
 {
     toolManager = tM;
     item        = items.instance.itemObjects[i];
     ground      = toolManager.GetComponent <ground>();
     cam         = Camera.main;
     star();
     GetLengths();
 }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        for (int i = 0; i < 3; ++i)
        {
            g [i]          = new ground();
            g [i].gr       = Instantiate(gr, new Vector2(0, 0), Quaternion.identity);
            g [i].onScreen = false;
        }

        g [1].gr.transform.position = new Vector2(90f + 45f, -4.89f);
        g [1].onScreen = true;
    }
Exemplo n.º 4
0
        public void resultTest2()
        {
            ground obj = new ground();

            if (obj.stp(800) == 1)
            {
                Assert.IsTrue(true);
            }
            else
            {
                Assert.IsTrue(false);
            }
        }
Exemplo n.º 5
0
        public void resultTest()
        {
            ground obj = new ground();

            if (obj.genStep() > 10)
            {
                Assert.IsTrue(true);
            }
            else
            {
                Assert.IsTrue(false);
            }
        }
Exemplo n.º 6
0
 void organizeGround(List <GameObject> groundList)
 {
     removeground = new List <GameObject>();
     for (int i = 0; i < groundList.Count - 1; i++)
     {
         ground firstquad  = groundList[i].GetComponent <ground>();
         ground secondquad = groundList[i + 1].GetComponent <ground> ();
         if (firstquad.getTL().x == secondquad.getTL().x&& firstquad.getTR().x == secondquad.getTR().x)
         {
             int j = i + 2;
             while (j < groundList.Count)
             {
                 secondquad = groundList[j].GetComponent <ground>();
                 if (firstquad.getTL().x == secondquad.getTL().x&& firstquad.getTR().x == secondquad.getTR().x)
                 {
                     j++;
                     continue;
                 }
                 else
                 {
                     break;
                 }
             }
             for (int k = i; k < j; k++)
             {
                 removeground.Add(groundList[k]);
             }
             float      currheight  = float.MinValue;
             GameObject currhighest = removeground[0];
             for (int l = 0; l < removeground.Count; l++)
             {
                 if (removeground[l].GetComponent <ground>().getTL().y > currheight)
                 {
                     currhighest = removeground[l];
                     currheight  = currhighest.GetComponent <ground>().getTL().y;
                 }
             }
             removeground.Remove(currhighest);
             for (int m = 0; m < removeground.Count; m++)
             {
                 groundList.Remove(removeground[m]);
             }
         }
     }
 }
Exemplo n.º 7
0
 bool CanBuildHere(ground g)
 {
     return(true);
 }
Exemplo n.º 8
0
 public void Visible(ground g)
 {
     gameObject.SetActive(true);
     currentGround = g;
 }