Пример #1
0
        public Color GetColor(ETypeObject type, int clicks)
        {
            if (clicks < 0)
            {
                return(ERROR_COLOR);
            }

            var res = from ccd in ClicksData
                      where ccd.ObjectType == type &&
                      ccd.MinClicksCount <= clicks &&
                      ccd.MaxClicksCount > clicks
                      select ccd;
            var selectedItems = new List <ClickColorData>(res);

            if (selectedItems.Count == 0)
            {
                return(ERROR_COLOR);
            }
            if (selectedItems.Count == 1)
            {
                return(selectedItems[0].ColorObject);
            }

            System.Random rnd = new System.Random();
            return(selectedItems[rnd.Next(0, selectedItems.Count)].ColorObject);
        }
Пример #2
0
 public ClickColorData(ETypeObject typeObject, int minClicksCount, int maxClicksCount, Color colorObject)
 {
     ObjectType     = typeObject;
     MinClicksCount = minClicksCount;
     MaxClicksCount = maxClicksCount;
     ColorObject    = colorObject;
 }
Пример #3
0
        public void SetItem <T>(T nameItemed, ETypeObject eTypeObjected, Texture2D icon)
        {
            nameItem    = nameItemed.ToString();
            eTypeObject = eTypeObjected;

            iconRImg.texture = icon;
            iconRImg.SetNativeSize();

            GetComponent <BoxCollider2D>().size = new Vector2(iconRImg.rectTransform.rect.width, iconRImg.rectTransform.rect.height);
        }
Пример #4
0
        public void CheckItem(ETypeObject eTypeObject, string nameItem)
        {
            if (eTypeObject.Equals(ETypeObject.Item))
            {
                switch (nameItem)
                {
                case "IronOre": AddCoin(_ironValue, nameItem); break;

                case "BronzeOre": AddCoin(_bronzeValue, nameItem); break;

                case "SilverOre": AddCoin(_silverValue, nameItem); break;

                case "GoldOre": AddCoin(_goldValue, nameItem); break;

                case "Diamond": AddDimond(_diamondValue); break;

                case "Fuel": AddEnergy(_energy); break;

                case "Booster": BoostSpeed(); break;

                default: break;
                }
            }
            else
            {
                if (!GamePlayController.instance.isFixedSpeed && !GamePlayController.instance.isImmortal)
                {
                    if (!GamePlayController.instance.isIronCurtain)
                    {
                        switch (nameItem)
                        {
                        case "Ore": HitOre(2); break;

                        case "BigOre": HitOre(3); break;

                        case "Bomb": HitBomb(); break;

                        default: break;
                        }
                        GamePlayController.instance.isNotHitAnyThing = false;
                    }
                    else
                    {
                        GamePlayController.instance.GetIronCurtain();
                    }
                }
            }
        }
Пример #5
0
        private void CreateByTypeRndColor(ETypeObject type)
        {
            System.Random rnd = new System.Random();
            int           val = rnd.Next(5, 20);

            for (var i = 0; i < val; ++i)
            {
                ClicksData.Add(new ClickColorData(type, 0, 10, Random.ColorHSV()));
            }
            val = rnd.Next(5, 20);
            for (var i = 0; i < val; ++i)
            {
                ClicksData.Add(new ClickColorData(type, 10, 20, Random.ColorHSV()));
            }
            val = rnd.Next(5, 20);
            for (var i = 0; i < val; ++i)
            {
                ClicksData.Add(new ClickColorData(type, 20, 30, Random.ColorHSV()));
            }
            val = rnd.Next(5, 20);
            for (var i = 0; i < val; ++i)
            {
                ClicksData.Add(new ClickColorData(type, 30, 40, Random.ColorHSV()));
            }
            val = rnd.Next(5, 20);
            for (var i = 0; i < val; ++i)
            {
                ClicksData.Add(new ClickColorData(type, 40, 50, Random.ColorHSV()));
            }
            val = rnd.Next(5, 20);
            for (var i = 0; i < val; ++i)
            {
                ClicksData.Add(new ClickColorData(type, 50, 75, Random.ColorHSV()));
            }
            val = rnd.Next(5, 20);
            for (var i = 0; i < val; ++i)
            {
                ClicksData.Add(new ClickColorData(type, 75, 100, Random.ColorHSV()));
            }
            val = rnd.Next(5, 20);
            for (var i = 0; i < val; ++i)
            {
                ClicksData.Add(new ClickColorData(type, 100, 150, Random.ColorHSV()));
            }
            val = rnd.Next(5, 20);
            for (var i = 0; i < val; ++i)
            {
                ClicksData.Add(new ClickColorData(type, 150, 200, Random.ColorHSV()));
            }
            val = rnd.Next(5, 20);
            for (var i = 0; i < val; ++i)
            {
                ClicksData.Add(new ClickColorData(type, 200, 300, Random.ColorHSV()));
            }
            val = rnd.Next(5, 20);
            for (var i = 0; i < val; ++i)
            {
                ClicksData.Add(new ClickColorData(type, 300, 500, Random.ColorHSV()));
            }
            val = rnd.Next(5, 20);
            for (var i = 0; i < val; ++i)
            {
                ClicksData.Add(new ClickColorData(type, 500, 1000, Random.ColorHSV()));
            }
            val = rnd.Next(5, 20);
            for (var i = 0; i < val; ++i)
            {
                ClicksData.Add(new ClickColorData(type, 1000, int.MaxValue, Random.ColorHSV()));
            }
        }
Пример #6
0
 //-------------------------------------------------------------------------------
 ///
 //-------------------------------------------------------------------------------
 public override void Init()
 {
     base.Init();
     m_GameObject.GetComponent <CScriptTakeElement>().SetTakeElement(this);
     m_eTypeObject = m_GameObject.GetComponent <CScriptTakeElement>().GetTypeElement();
 }
Пример #7
0
 public Color GetColor(ETypeObject type, int clicks)
 {
     return(gd.GetColor(type, clicks));
 }