Exemplo n.º 1
0
        private Material MakeMaterial(int colorId, int maxSlots, AColorServer colorServer)
        {
            Material mat = Instantiate(sliceMaterial);
            mat.SetColor("_Color", colorServer.GetColor(colorId, maxSlots));

            return mat;
        }
Exemplo n.º 2
0
        public GameObject GeneratePlatform(Engine.IDifficulty diff, AColorServer colorServer)
        {
            GameObject platformGO = new GameObject();
            platformGO.name = "Platform";
            Platform platform = platformGO.AddComponent<Platform>();

            arc = 360f / diff.MaxSlots;

            float lastYRot = Random.Range(0f, 360f);
            for (int i = 0; i < diff.MaxSlots; i++)
            {
                int colorId = diff.NextSlot();

                Material mat = MakeMaterial(colorId, diff.MaxSlots, colorServer);
                GameObject slice = MakeSlice(mat, platform.transform, lastYRot);
                PlatformSlice pSlice = InitializeSlice(slice, colorId);

                platform.InsertSlice(pSlice);
                lastYRot += arc;
            }

            return platformGO;
        }