示例#1
0
    public void OnFinished(BoostType boostType)
    {
        if (boostType == BoostType.Random_color)
        {
            List <Item> itemsList = LevelManager.THIS.GetItemsAround(square);
            foreach (Item item in itemsList)
            {
                if (item != null)
                {
                    if (item.currentType == ItemsTypes.NONE)
                    {
                        item.GenColor(-1, true);
                    }
                }
            }
        }
        if (boostType == BoostType.Bomb)
        {
            square.item.DestroyItem();
        }
        LevelManager.THIS.StartCoroutine(LevelManager.THIS.FindMatchDelay());
        SoundBase.Instance.GetComponent <AudioSource>().PlayOneShot(SoundBase.Instance.explosion);

        Destroy(gameObject);
    }
示例#2
0
    public GameObject GetBoost(BoostType type, Transform transform)
    {
        GameObject boost;

        switch (type)
        {
        case BoostType.Jetpack:
            boost = GetJetpackBoost();
            break;

        case BoostType.Trampoline:
            boost = GetTrampolineBoost();
            break;

        case BoostType.Magnet:
            boost = GetMagnetBoost();
            break;

        case BoostType.WeaponLaser:
            boost = GetWeaponLaserBoost();
            break;

        case BoostType.WeaponRocket:
            boost = GetWeaponRocketBoost();
            break;

        case BoostType.Armor:
            boost = GetArmorBoost();
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }
        return(UnityEngine.Object.Instantiate(boost, transform));
    }
示例#3
0
 public void copyFrom(Reward another)
 {
     this.ChestType      = another.ChestType;
     this.CoinDrops      = new List <double>(another.CoinDrops);
     this.DiamondDrops   = new List <double>(another.DiamondDrops);
     this.TokenDrops     = new List <double>(another.TokenDrops);
     this.Boost          = another.Boost;
     this.Skill          = another.Skill;
     this.ItemDrops      = new List <ItemInstance>(another.ItemDrops);
     this.RunestoneDrops = new List <string>(another.RunestoneDrops);
     this.CrownDrops     = new List <double>(another.CrownDrops);
     if (another.RunestoneAtIndexConvertedIntoTokens != null)
     {
         this.RunestoneAtIndexConvertedIntoTokens = new List <int>(another.RunestoneAtIndexConvertedIntoTokens);
     }
     this.ShopEntryId             = another.ShopEntryId;
     this.Revives                 = another.Revives;
     this.Sprite                  = another.Sprite;
     this.FrenzyPotions           = another.FrenzyPotions;
     this.DustDrops               = new List <double>(another.DustDrops);
     this.ShopEntryDrops          = new List <string>(another.ShopEntryDrops);
     this.XpPotions               = another.XpPotions;
     this.BossPotions             = another.BossPotions;
     this.Pets                    = new List <PetReward>(another.Pets);
     this.MegaBoxes               = another.MegaBoxes;
     this.RewardSource            = another.RewardSource;
     this.RewardSourceId          = another.RewardSourceId;
     this.ChestTypeVisualOverride = another.ChestTypeVisualOverride;
     this.TournamentUpgradeReward = another.TournamentUpgradeReward;
 }
示例#4
0
    private string GetText(BoostType boostType, int time)
    {
        string text = "";

        switch (boostType)
        {
        case BoostType.Jetpack:
            text = $"Jetpack: {time}";
            break;

        case BoostType.Magnet:
            text = $"Magnet: {time}";
            break;

        case BoostType.Armor:
            text = $"Armor: {time}";
            break;

        case BoostType.WeaponLaser:
            text = $"Laser";
            break;

        case BoostType.WeaponRocket:
            text = $"Rocket";
            break;

        default:
            break;
        }

        return(text);
    }
示例#5
0
        private double GetJumpFactor(BoostType type)
        {
            switch (type)
            {
            case BoostType.Neutron:
            {
                return(4);
            }

            case BoostType.Synthesis:
            {
                return(2);
            }

            case BoostType.WhiteDwarf:
            {
                return(1.5);
            }

            case BoostType.None:
            {
                return(1);
            }

            default:
            {
                throw new NotImplementedException();
            }
            }
        }
示例#6
0
 public void SpendBoost(BoostType boostType)
 {
     InitScript.Instance.BoostActivated = true;
     if (boostType == BoostType.AimBoost)
     {
         BoostVariables.AimBoost = true;
         if (mainscript.Instance != null)
         {
             mainscript.Instance.boxCatapult.GetComponent <Square>().CheckAimBoost();
         }
     }
     if (boostType == BoostType.ExtraSwitchBallsBoost)
     {
         BoostVariables.ExtraSwitchBallsBoost = true;
     }
     else if (boostType == BoostType.ColorBallBoost)
     {
         if (mainscript.Instance != null)
         {
             mainscript.Instance.boxCatapult.GetComponent <Square>().Busy.SetBoost(boostType);
         }
     }
     check.SetActive(true);
     if (boostType == BoostType.ColorBallBoost)
     {
         Ball.OnThrew += DisableCheck;
     }
 }
示例#7
0
 public BoostData(BoostType type, float rate, TimeSpan duration, int useLimit)
 {
     Type      = type;
     Rate      = rate;
     ExpiresOn = DateTime.UtcNow.Add(duration);
     UsesLeft  = useLimit;
 }
示例#8
0
        private Node CreateNode(
            StarSystem system,
            double fuelMin,
            double fuelMax,
            BoostType boostType,
            RefuelType refuelType,
            double?refuelMin,
            double?refuelMax,
            int jumps)
        {
            var fuelAvg = (fuelMin + fuelMax) / 2.0;

            return(new Node(
                       (system.Id, this.GetNodeFuelId(fuelAvg), boostType, refuelType),
                       system,
                       system.Equals(this.goal),
                       fuelMin,
                       fuelMax,
                       boostType,
                       refuelType,
                       refuelMin,
                       refuelMax,
                       jumps
                       ));
        }
示例#9
0
        public static long BoostValue(ArcadeUser user, long value, BoostType type, bool isNegative = false)
        {
            float rate = 1;

            if (user.Boosters.Count == 0)
            {
                return(value);
            }

            var toRemove = new List <BoostData>();

            foreach (BoostData booster in user.Boosters)
            {
                if (!CanApplyBooster(booster))
                {
                    toRemove.Add(booster);
                }

                if (booster.Type != type)
                {
                    continue;
                }

                rate += booster.Rate;

                if (booster.UsesLeft.HasValue && --booster.UsesLeft <= 0)
                {
                    toRemove.Add(booster);
                }
            }

            RemoveBoosts(user, ref toRemove);
            return(BoostConvert.GetValue(value, rate, isNegative));
        }
示例#10
0
    public void StartBoostSound(BoostType type)
    {
        switch (type)
        {
        case BoostType.Trampoline:
            Play(_trampolineBoostSound);
            break;

        case BoostType.Jetpack:
            Play(_jetpackBoostSound, true);
            break;

        case BoostType.Magnet:
            Play(_magnetBoostSound, true);
            break;

        case BoostType.WeaponLaser:
            Play(_weaponBoostSound);
            break;

        case BoostType.WeaponRocket:
            Play(_weaponBoostSound);
            break;

        case BoostType.Armor:
            Play(_armorBoostSound, true);
            break;
        }
    }
 BoostAction GetAction(BoostType type)
 {
     if (type == BoostType.Clone)
     {
         return(new CloneBoostAction()
         {
             Info = GetBoostInfo(type)
         });
     }
     if (type == BoostType.Piano)
     {
         return(new PianoBoostAction()
         {
             Info = GetBoostInfo(type)
         });
     }
     if (type == BoostType.SpeedUp)
     {
         return(new SpeedUpBoostAction()
         {
             Info = GetBoostInfo(type)
         });
     }
     return(new BoostAction());
 }
示例#12
0
        public static bool IsNegative(float rate, BoostType type)
        {
            //if (type == BoosterType.Debt)
            //    return rate > 0;

            return(rate < 0);
        }
示例#13
0
    public void BuyBoost(BoostType boostType, int price, int count)
    {
        PlayerPrefs.SetInt("" + boostType, PlayerPrefs.GetInt("" + boostType) + count);
        PlayerPrefs.Save();
#if PLAYFAB || GAMESPARKS
        NetworkManager.dataManager.SetBoosterData();
#endif
    }
示例#14
0
 internal BoostData(string parentId, BoostType type, float rate, DateTime?expiresOn, int?usesLeft)
 {
     ParentId  = parentId;
     Type      = type;
     Rate      = rate;
     ExpiresOn = expiresOn;
     UsesLeft  = usesLeft;
 }
示例#15
0
 public void SpendBoost(BoostType boostType)
 {
     PlayerPrefs.SetInt("" + boostType, PlayerPrefs.GetInt("" + boostType) - 1);
     PlayerPrefs.Save();
             #if PLAYFAB || GAMESPARKS
     NetworkManager.dataManager.SetBoosterData();
             #endif
 }
示例#16
0
 public Boost(string name, string description, int cost, BoostType type, int level)
 {
     _name        = name;
     _description = description;
     _cost        = cost;
     _type        = type;
     _level       = level;
 }
示例#17
0
    private IEnumerator WeaponLogic(WeaponType type)
    {
        BoostType boostType = (type == WeaponType.Laser) ? BoostType.WeaponLaser : BoostType.WeaponRocket;

        _ui.StartBoostStatus(boostType, 0);
        yield return(new WaitForSeconds(1.0f));

        _ui.EndBoostStatus(boostType);
    }
示例#18
0
 public Boost getBoostWithType(BoostType inType)
 {
     foreach(Boost boost in this.m_boosts)
     {
         if(boost.getType() == inType)
             return boost;
     }
     return null;
 }
示例#19
0
 public BoostData(string Identity, int numOfBattles, BoostType boostType, float value, string sprite, string description)
 {
     this.Identity     = Identity;
     this.numOfBattles = numOfBattles;
     this.boostType    = boostType;
     this.value        = value;
     this.sprite       = sprite;
     this._description = description;
 }
示例#20
0
 internal static string IconOf(BoostType type)
 {
     return(type switch
     {
         BoostType.Money => Balance,
         BoostType.Debt => Debt,
         BoostType.Chips => Chips,
         BoostType.Voting => Tokens,
         _ => Unknown
     });
 // Update is called once per frame
 public void SetBoost(BoostType _boostType)
 {
     GamePlay.Instance.GameStatus = GameState.Pause;
     boostType = _boostType;
     gameObject.SetActive(true);
     icon.sprite      = icons[(int)_boostType];
     title.text       = titles[(int)_boostType];
     description.text = descriptions[(int)_boostType];
     price.text       = "" + prices[(int)_boostType];
 }
 public BoostInfo GetBoostInfo(BoostType type)
 {
     foreach (var info in _owner.BoostInfos)
     {
         if (info.Type == type)
         {
             return(info);
         }
     }
     return(null);
 }
示例#23
0
 // Update is called once per frame
 public void SetBoost(BoostType _boostType)
 {
     boostType = _boostType;
     gameObject.SetActive(true);
     icon.sprite      = boostProducts[(int)_boostType].icon;
     description.text = boostProducts[(int)_boostType].description;
     for (int i = 0; i < 3; i++)
     {
         transform.Find("Image/BuyBoost" + (i + 1) + "/Count").GetComponent <Text>().text = "x" + boostProducts[(int)_boostType].count[i];
         transform.Find("Image/BuyBoost" + (i + 1) + "/Price").GetComponent <Text>().text = "" + boostProducts[(int)_boostType].GemPrices[i];
     }
 }
示例#24
0
 public void SetBoost(BoostProduct boost, Action callbackL)
 {
     boostType = boost.boostType;
     gameObject.SetActive(true);
     // icon.sprite = boost.icon;
     boost.boostIconObject.SetActive(true);
     description.text = boost.description;
     transform.Find("Image/BuyBoost/Count").GetComponent <TextMeshProUGUI>().text = "x" + boost.count;
     transform.Find("Image/BuyBoost/Price").GetComponent <TextMeshProUGUI>().text = "" + boost.GemPrices;
     boostName.text = boost.name;
     callback       = callbackL;
 }
示例#25
0
        public BoostData(string itemId, BoostType type, float rate, TimeSpan?duration = null, int?useLimit = null)
        {
            ParentId = itemId;
            Type     = type;
            Rate     = rate;

            if (duration.HasValue)
            {
                ExpiresOn = DateTime.UtcNow.Add(duration.Value);
            }

            UsesLeft = useLimit;
        }
示例#26
0
        private void onBoostActivated(Player player, BoostType boostType, string analyticsSourceId)
        {
            CharacterInstance activeCharacter = player.ActiveCharacter;

            if (!activeCharacter.IsDead)
            {
                Buff buff = GameLogic.Binder.BuffSystem.getBuffFromBoost(activeCharacter, boostType);
                if (buff != null)
                {
                    GameLogic.Binder.BuffSystem.endBuff(buff);
                }
            }
        }
示例#27
0
    // Update is called once per frame
    public void SetBoost(BoostType _boostType, System.Action <int> buyCallback)
    {
        SoundBase.Instance.GetComponent <AudioSource>().PlayOneShot(SoundBase.Instance.click);
        boostType = _boostType;
        gameObject.SetActive(true);
        icon.sprite = icons[(int)_boostType];
        icon.SetNativeSize();
        title.text       = titles[(int)_boostType];
        description.text = descriptions[(int)_boostType];
        int pr = prices[(int)_boostType];

        price.text = "" + pr;
        buySuccess = buyCallback;
    }
示例#28
0
 public void BuyBoost(BoostType boostType, int price)
 {
     SoundBase.GetInstance().GetComponent <AudioSource>().PlayOneShot(SoundBase.GetInstance().click);
     if (InitScript.Gems >= price)
     {
         InitScript.Instance.BuyBoost(boostType, 1, price);
         InitScript.Instance.SpendBoost(boostType);
         CloseMenu();
     }
     else
     {
         BuyGames();
     }
 }
示例#29
0
        public Buff getBuffFromBoost(CharacterInstance c, BoostType boostType)
        {
            List <Buff> list = this.m_characterBuffLists[c];

            for (int i = 0; i < list.Count; i++)
            {
                Buff buff = list[i];
                if (buff.FromBoost == boostType)
                {
                    return(buff);
                }
            }
            return(null);
        }
示例#30
0
        public void BuyBoost(BoostType boostType, int count, int price)
        {
            SpendGems(price);
            if (boostType != BoostType.FiveBallsBoost)
            {
                PlayerPrefs.SetInt("" + boostType, count);
                PlayerPrefs.Save();
            }
            else
            {
//                LevelData.LimitAmount += 5;
            }
            ReloadBoosts();
        }
示例#31
0
 public void BuyBoost(BoostType boostType, int price, int count)
 {
     SoundBase.Instance.GetComponent<AudioSource>().PlayOneShot(SoundBase.Instance.click);
     if (InitScript.Gems >= price)
     {
         InitScript.Instance.SpendGems(price);
         InitScript.Instance.BuyBoost(boostType, price, count);
         //InitScript.Instance.SpendBoost(boostType);
         CloseMenu();
     }
     else
     {
         BuyGems();
     }
 }
示例#32
0
 public void SpendBoost(BoostType boostType)
 {
     InitScript.Instance.BoostActivated = true;
     if (boostType != BoostType.FiveBallsBoost)
     {
         mainscript.Instance.boxCatapult.GetComponent <Grid>().Busy.GetComponent <ball>().SetBoost(boostType);
     }
     else
     {
         LevelData.LimitAmount += 5;
     }
     PlayerPrefs.SetInt("" + boostType, PlayerPrefs.GetInt("" + boostType) - 1);
     PlayerPrefs.Save();
     ReloadBoosts();
 }
示例#33
0
        /// <summary>
        /// 学習データを与えて初期化
        /// </summary>
        /// <param name="boostType">ブースティングの種類</param>
        /// <param name="weakCount">構築する弱い分類器の個数</param>
        /// <param name="weightTrimRate">トリミング重み比率.0..1 の範囲内.もしこのパラメータが ≤0 あるいは >1 の場合,トリミングは行われず,全てのサンプルが各繰り返し計算で用いられる.デフォルト値は 0.95 である</param>
        /// <param name="maxDepth">このパラメータは木が取りうる最大の深さを決定する.学習アルゴリズムは,ノードの深さが max_depth  よりも小さいならば,それを分岐させようとする.他の終了条件が満たされた場合や(セクション始めにある学習手続きの概要を参照), あるいは/さらに,木が刈り込まれた場合など,実際の深さはもっと浅いかもしれない.</param>
        /// <param name="useSurrogates">trueの場合,代理分岐が構築される. 代理分岐は観測値データの欠損を処理する場合や,変数の重要度の推定に必要である. </param>
		/// <param name="priors">クラスラベル値によって保存されたクラス事前確率の配列. このパラメータは,ある特定のクラスに対する決定木の優先傾向を調整するために用いられる. 例えば,もしユーザがなんらかの珍しい例外的発生を検出したいと考えた場合,学習データは,おそらく例外的なケースよりもずっと多くの正常なケースを含んでいるので, 全ケースが正常であるとみなすだけで,非常に優れた分類性能が実現されるだろう. このように例外ケースを無視して分類性能を上げることを避けるために,事前確率を指定することができる. 例外的なケースの確率を人工的に増加させる(0.5 まで,あるいはそれ以上に)ことで,分類に失敗した例外の重みがより大きくなり,木は適切に調節される. </param>
#else
        /// <summary>
        /// Training constructor
        /// </summary>
        /// <param name="boostType">Boosting type</param>
        /// <param name="weakCount">The number of weak classifiers to build. </param>
        /// <param name="weightTrimRate">he weight trimming ratio, within 0..1. If the parameter is ≤0 or >1, the trimming is not used, all the samples are used at each iteration. The default value is 0.95. </param>
        /// <param name="maxDepth">This parameter specifies the maximum possible depth of the tree. That is the training algorithms attempts to split a node while its depth is less than max_depth. The actual depth may be smaller if the other termination criteria are met (see the outline of the training procedure in the beginning of the section), and/or if the tree is pruned. </param>
        /// <param name="useSurrogates">If true, surrogate splits are built. Surrogate splits are needed to handle missing measurements and for variable importance estimation. </param>
        /// <param name="priors">The array of a priori class probabilities, sorted by the class label value. The parameter can be used to tune the decision tree preferences toward a certain class. For example, if users want to detect some rare anomaly occurrence, the training base will likely contain much more normal cases than anomalies, so a very good classification performance will be achieved just by considering every case as normal. To avoid this, the priors can be specified, where the anomaly probability is artificially increased (up to 0.5 or even greater), so the weight of the misclassified anomalies becomes much bigger, and the tree is adjusted properly. </param>
#endif
        public CvBoostParams(BoostType boostType, int weakCount, double weightTrimRate,
            int maxDepth, bool useSurrogates, float[] priors)
        {
            IntPtr priorsPtr = IntPtr.Zero;
            if (priors != null)
            {
                handle = GCHandle.Alloc(priors, GCHandleType.Pinned);
                priorsPtr = handle.AddrOfPinnedObject();
            }
            base.priors = priors;

            ptr = NativeMethods.ml_CvBoostParams_new2(
                (int)boostType,
                weakCount,
                weightTrimRate,
                maxDepth,
                useSurrogates ? 1 : 0,
                priorsPtr
            );
        }
示例#34
0
        /// <summary>
        /// 学習データを与えて初期化
        /// </summary>
		/// <param name="boost_type">ブースティングの種類</param>
		/// <param name="weak_count">構築する弱い分類器の個数</param>
		/// <param name="weight_trim_rate">トリミング重み比率.0..1 の範囲内.もしこのパラメータが ≤0 あるいは >1 の場合,トリミングは行われず,全てのサンプルが各繰り返し計算で用いられる.デフォルト値は 0.95 である</param>
		/// <param name="max_depth">このパラメータは木が取りうる最大の深さを決定する.学習アルゴリズムは,ノードの深さが max_depth  よりも小さいならば,それを分岐させようとする.他の終了条件が満たされた場合や(セクション始めにある学習手続きの概要を参照), あるいは/さらに,木が刈り込まれた場合など,実際の深さはもっと浅いかもしれない.</param>
		/// <param name="use_surrogates">trueの場合,代理分岐が構築される. 代理分岐は観測値データの欠損を処理する場合や,変数の重要度の推定に必要である. </param>
		/// <param name="priors">クラスラベル値によって保存されたクラス事前確率の配列. このパラメータは,ある特定のクラスに対する決定木の優先傾向を調整するために用いられる. 例えば,もしユーザがなんらかの珍しい例外的発生を検出したいと考えた場合,学習データは,おそらく例外的なケースよりもずっと多くの正常なケースを含んでいるので, 全ケースが正常であるとみなすだけで,非常に優れた分類性能が実現されるだろう. このように例外ケースを無視して分類性能を上げることを避けるために,事前確率を指定することができる. 例外的なケースの確率を人工的に増加させる(0.5 まで,あるいはそれ以上に)ことで,分類に失敗した例外の重みがより大きくなり,木は適切に調節される. </param>
#else
        /// <summary>
        /// Training constructor
        /// </summary>
        /// <param name="boost_type">Boosting type</param>
        /// <param name="weakCount">The number of weak classifiers to build. </param>
        /// <param name="weightTrimRate">he weight trimming ratio, within 0..1. If the parameter is ≤0 or >1, the trimming is not used, all the samples are used at each iteration. The default value is 0.95. </param>
        /// <param name="maxDepth">This parameter specifies the maximum possible depth of the tree. That is the training algorithms attempts to split a node while its depth is less than max_depth. The actual depth may be smaller if the other termination criteria are met (see the outline of the training procedure in the beginning of the section), and/or if the tree is pruned. </param>
        /// <param name="useSurrogates">If true, surrogate splits are built. Surrogate splits are needed to handle missing measurements and for variable importance estimation. </param>
        /// <param name="priors">The array of a priori class probabilities, sorted by the class label value. The parameter can be used to tune the decision tree preferences toward a certain class. For example, if users want to detect some rare anomaly occurrence, the training base will likely contain much more normal cases than anomalies, so a very good classification performance will be achieved just by considering every case as normal. To avoid this, the priors can be specified, where the anomaly probability is artificially increased (up to 0.5 or even greater), so the weight of the misclassified anomalies becomes much bigger, and the tree is adjusted properly. </param>
#endif
        public CvBoostParams(BoostType boost_type, int weakCount, double weightTrimRate,
            int maxDepth, bool useSurrogates, float[] priors)
        {
            IntPtr priorsPtr = IntPtr.Zero;
            if (priors != null)
            {
                _handle = GCHandle.Alloc(priors, GCHandleType.Pinned);
                priorsPtr = _handle.AddrOfPinnedObject();
            }
            _priors = priors;

            ptr = MLInvoke.CvBoostParams_construct(
                (int)boost_type,
                weakCount,
                weightTrimRate,
                maxDepth,
                useSurrogates,
                priorsPtr
            );
        }
示例#35
0
 public bool hasBoost(BoostType inType)
 {
     return this.getBoostWithType(inType) != null;
 }
示例#36
0
 public Boost(BoostType inType, int inDuration, int inAmplifier)
 {
     this.m_type = inType;
     this.m_amplifier = inAmplifier;
     this.m_duration = inDuration;
 }