Example #1
0
        private GameObject CreateElement(Data.IndexData lh, Texture t, Color c)
        {
            GameObject go = Instantiate(DicePrefab) as GameObject;

            go.transform.parent = this.transform;
            go.name             = lh.walli + "." + lh.xi + "." + lh.yi;
            var tg = go.GetComponent <CustomTarget>();

            tg.DeepColor   = c;
            tg.DiceTexture = t;
            var     point = currentData.walls[lh.walli].schema[lh.xi, lh.yi];
            Vector3 pos   = DemoMenuItems.PointPosition(lh.walli, lh.xi, lh.yi);

            go.transform.localPosition = pos;
            switch (point.easy)
            {
            case PointEasyOrHard.eFix:
                break;

            case PointEasyOrHard.eShowLess:
            {
                var poff = DemoMenuItems.PositionAwayCenter(lh.walli);
                poff *= Random.Range(0.01f, 0.30f);
                go.transform.localPosition += poff;
            }
            break;

            case PointEasyOrHard.eShowMore:
            {
                var poff = DemoMenuItems.PositionAwayCenter(lh.walli);
                poff *= Random.Range(0.01f, 0.30f);
                go.transform.localPosition -= poff;
            }
            break;
            }
            switch (point.distort)
            {
            case PointDistort.eFaceCamera:
            {
                go.transform.LookAt(Vector3.zero);
            }
            break;

            case PointDistort.eRandom:
            {
                Quaternion qt = Quaternion.Euler(Random.Range(0, 360)
                                                 , Random.Range(0, 360), Random.Range(0, 360));
                go.transform.localRotation = qt;
            }
            break;

            case PointDistort.eFix:
                break;
            }
            return(go);
        }
Example #2
0
 private void CreateIndexData()
 {
     currentData.indexes.Clear();
     for (int w = 0; w < currentData.walls.Length; ++w)
     {
         for (int x = 0; x < DemoMenuItems.TILE_WIDTH; ++x)
         {
             for (int y = 0; y < DemoMenuItems.TILE_HEIGHT; ++y)
             {
                 var d = currentData.walls[w].schema[x, y];
                 if (d.state == Data.DataPointState.eGenerated ||
                     d.state == Data.DataPointState.eProfiled)
                 {
                     var nd = new Data.IndexData();
                     nd.walli = w;
                     nd.xi    = x;
                     nd.yi    = y;
                     currentData.indexes.Add(nd);
                 }
             }
         }
     }
 }