示例#1
0
 //=================================================
 void Awake()
 {
     transformCache            = transform;
     transformCache.localScale = INACTIVE_SIZE;
     meshSetter.SetMesh(stageData.renderMesh, stageData.colliderMesh);
     lerpTimer  = 1;
     beforeFlg  = IsTouch = false;
     fromHeight = nextHeight = INACTIVE_HEIGHT;
     fromSize   = nextSize = INACTIVE_SIZE;
 }
示例#2
0
        //-----------------------------------------------------
        //  ステージ生成
        //-----------------------------------------------------
        void CreateStage()
        {
            // 三次元用
            stageMesh.SetMesh(renderMesh, colliderMesh);

            // 二次元用
            rightSecond.transform.position = StageRight * StageWidth * 2;
            leftSecond.transform.position  = -StageRight * StageWidth * 2;
            CreateSecondCollider();

            // ゴールの配置
            StageGoal goalObj = Instantiate(goalPre, GoalPoint, Quaternion.identity);

            goalObj.transform.parent = transform;
        }
示例#3
0
        //-----------------------------------------------------
        //  2次元用Collider(3D)を用意
        //-----------------------------------------------------
        void CreateSecondCollider()
        {
            List <Plane>   planes    = new List <Plane>();   // 平面のリスト
            List <Cube>    cubes     = new List <Cube>();    // 立方体のリスト
            List <Vector3> vertices  = new List <Vector3>(); // 頂点のリスト
            List <int>     triangles = new List <int>();     // 三角形のリスト

            // 必要な平面を取得
            planes = GetMeshToPlane(colliderMesh, StageRight);
            planes = SetNormalVectorPosition(planes);
            planes = DeleateSamePlane(planes);

            // 平面を立方体に
            foreach (Plane plane in planes)
            {
                cubes.Add(new Cube(plane));
            }

            //頂点と三角形を取得
            foreach (Cube cube in cubes)
            {
                cube.CreateTriangle(vertices.Count);

                vertices.AddRange(cube.vertices);
                triangles.AddRange(cube.triangles);
            }

            // Mesh作成
            Mesh secondMesh = new Mesh
            {
                name      = "Second Mesh",
                vertices  = vertices.ToArray(),
                triangles = triangles.ToArray()
            };

            secondMesh.RecalculateBounds();
            secondMesh.RecalculateNormals();

            rightSecond.SetMesh(secondMesh, secondMesh);
            leftSecond.SetMesh(secondMesh, secondMesh);

            return;
        }