예제 #1
0
    // Use this for initialization
    void Start()
    {
        b = gameObject.GetComponent <BlockController>();
        h = gameObject.GetComponent <HardObjectController>();
        g = gameObject.GetComponent <GoalBlockController>();
        if (gameObject.tag.Contains("Movable"))
        {
            objectTag  = 'b';
            lightColor = new Color(1, 1, 1, 0);
        }
        else if (gameObject.tag.Contains("Goal"))
        {
            objectTag  = 'g';
            lightColor = new Color(0.8f, 0.8f, 0.2f, 0);
        }

        rend = GetComponent <Renderer>();
        if (lightning)
        {
            currentColor = lightColor;
        }
        else
        {
            currentColor = new Color(0, 0, 0, 0);
        }
        rend.material.SetColor("_EmissionColor", currentColor);
    }
예제 #2
0
    void CreateMap()
    {
        int goalNum = 0;

        for (int floor = 0; floor < 2; floor++)
        {
            for (int dz = 0; dz < mapSizeZ; dz++)
            {
                for (int dx = 0; dx < mapSizeX; dx++)
                {
                    MapPos  mapPos = new MapPos(floor, dx, dz);
                    Vector3 Pos    = MapposToUnipos(mapPos);
                    switch (map[floor, dx, dz])
                    {
                    case 0:
                        goMap[floor, dx, dz] = null;
                        break;

                    case 1:
                        goMap[floor, dx, dz] = Instantiate(baseBlock, Pos, Quaternion.identity);
                        break;

                    case 2:
                        goMap[floor, dx, dz] = Instantiate(movableBlock, Pos, Quaternion.identity);
                        BlockController     b2 = goMap[floor, dx, dz].GetComponent <BlockController>();
                        LightningController l1 = goMap[floor, dx, dz].GetComponent <LightningController>();
                        l1.lightning = false;
                        b2.nowPos    = mapPos;
                        break;

                    case 3:
                        goMap[floor, dx, dz] = Instantiate(movableBlock, Pos, Quaternion.identity);
                        BlockController     b3 = goMap[floor, dx, dz].GetComponent <BlockController>();
                        LightningController l2 = goMap[floor, dx, dz].GetComponent <LightningController>();
                        b3.nowPos    = mapPos;
                        l2.lightning = true;
                        break;

                    case 4:
                        goMap[floor, dx, dz] = Instantiate(iceBlock, Pos, Quaternion.identity);
                        break;

                    case 99:
                        goMap[floor, dx, dz] = Instantiate(goal, Pos, Quaternion.identity);
                        GoalBlockController g  = goMap[floor, dx, dz].GetComponent <GoalBlockController>();
                        LightningController l3 = goMap[floor, dx, dz].GetComponent <LightningController>();
                        l3.lightning = false;
                        g.nowPos     = mapPos;
                        g.goalNumber = goalNum++;
                        break;
                    }
                }
            }
        }
        goalFlag = new bool[goalNum];
    }