Exemplo n.º 1
0
        private void initDictionary()
        {
            if (!inited)
            {
                coinsPool[BallColor.White]  = FastPoolManager.CreatePool(Coin1Prefab);
                coinsPool[BallColor.Black]  = FastPoolManager.CreatePool(Coin2Prefab);
                coinsPool[BallColor.Red]    = FastPoolManager.CreatePool(Coin5Prefab);
                coinsPool[BallColor.Green]  = FastPoolManager.CreatePool(Coin10Prefab);
                coinsPool[BallColor.Blue]   = FastPoolManager.CreatePool(Coin20Prefab);
                coinsPool[BallColor.Yellow] = FastPoolManager.CreatePool(Coin50Prefab);
                coinsPool[BallColor.Aqua]   = FastPoolManager.CreatePool(Coin100Prefab);

                foreach (GameObject o in BonusPrefabs)
                {
                    BaseBonus e = o.GetComponent <BaseBonus>();
                    ballTypesPool[e.BonusType] = FastPoolManager.CreatePool(o);
                }

                foreach (GameObject o in EffectsPrefabs)
                {
                    effectsPool[o.name] = FastPoolManager.CreatePool(o);
                }
                lightningPool = FastPoolManager.CreatePool(LightningPrefab);

                ColorFigureSprites = new Dictionary <BallColor, Sprite>();
                ColorFigureSprites[BallColor.Black]  = Black;
                ColorFigureSprites[BallColor.White]  = White;
                ColorFigureSprites[BallColor.Green]  = Green;
                ColorFigureSprites[BallColor.Aqua]   = Aqua;
                ColorFigureSprites[BallColor.Red]    = Red;
                ColorFigureSprites[BallColor.Blue]   = Blue;
                ColorFigureSprites[BallColor.Yellow] = Yellow;

                BallTypeSprites = new Dictionary <BallType, Sprite>();
                BallTypeSprites[BallType.Simple]    = Simple;
                BallTypeSprites[BallType.Chameleon] = Chameleon;
                BallTypeSprites[BallType.Freeze]    = Freeze;
                BallTypeSprites[BallType.Brush]     = Brush;
                BallTypeSprites[BallType.Bomb]      = Bomb;
                BallTypeSprites[BallType.Lightning] = Lightning;
                BallTypeSprites[BallType.Anchored]  = Anchored;
                BallTypeSprites[BallType.Anchor]    = Anchor;
                BallTypeSprites[BallType.Aim]       = Aim;

                BallTypeSprites[BallType.Bubble]  = Bubble;
                BallTypeSprites[BallType.Frozen]  = Frozen;
                BallTypeSprites[BallType.Crashed] = Crashed;
                BallTypeSprites[BallType.Rust]    = Rust;

                BallColors = new Dictionary <BallColor, Color32>();
                BallColors[BallColor.White]  = WhiteColor;
                BallColors[BallColor.Black]  = BlackColor;
                BallColors[BallColor.Green]  = GreenColor;
                BallColors[BallColor.Aqua]   = AquaColor;
                BallColors[BallColor.Red]    = RedColor;
                BallColors[BallColor.Blue]   = BlueColor;
                BallColors[BallColor.Yellow] = YellowColor;
                BallColors[BallColor.None]   = Color.white;

                BallsPool = FastPoolManager.GetPool(BallPrefab);

                colors    = new BallColor[8];
                colors[0] = BallColor.White;
                colors[1] = BallColor.Black;
                colors[2] = BallColor.Green;
                colors[3] = BallColor.Aqua;
                colors[4] = BallColor.Red;
                colors[5] = BallColor.Blue;
                colors[6] = BallColor.Yellow;
                inited    = true;
            }
        }