public bool IsFoundAtJourneyPosition(JourneyPosition jp)
 {
     if (unlockData == null)
     {
         return(false);
     }
     //if (IsLocked) return false;
     return(jp.Equals(unlockData.GetJourneyPosition()));
 }
示例#2
0
        private void GeneratePacksFromUnlockFunction(JourneyPosition journeyPosition, List <RewardPack> jpPacks)
        {
            // Non-assessment PS do not generate any reward
            if (!journeyPosition.IsAssessment())
            {
                return;
            }

            // Force to unlock a prop and all its colors at the first JP
            if (journeyPosition.Equals(new JourneyPosition(1, 1, 100)))
            {
                jpPacks.AddRange(GenerateNewRewardPacks(RewardBaseType.Prop, RewardUnlockMethod.NewBaseAndAllColors));
                return;
            }

            // Else, randomly choose between locked props, decals, or textures
            int nDecalsLeft   = GetAllRewardPacksOfBaseType(RewardBaseType.Decal).Count(x => x.IsLocked);
            int nTexturesLeft = GetAllRewardPacksOfBaseType(RewardBaseType.Texture).Count(x => x.IsLocked);
            int nPropsLeft    = GetAllRewardPacksOfBaseType(RewardBaseType.Prop, true).Count(x => x.IsLocked);

            //Debug.Log("We have left: " + nDecalsLeft + " decals, " + nTexturesLeft + " textures, " + nPropsLeft + " props");

            List <RewardBaseType> choices = new List <RewardBaseType>();

            if (nDecalsLeft > 0)
            {
                choices.Add(RewardBaseType.Decal);
            }
            if (nTexturesLeft > 0)
            {
                choices.Add(RewardBaseType.Texture);
            }
            if (nPropsLeft > 0)
            {
                choices.Add(RewardBaseType.Prop);
            }

            RewardBaseType choice = choices.RandomSelectOne();

            if (choice == RewardBaseType.Prop)
            {
                jpPacks.AddRange(GenerateNewRewardPacks(choice, RewardUnlockMethod.NewBaseAndAllColors));
            }
            else
            {
                jpPacks.AddRange(GenerateNewRewardPacks(choice, RewardUnlockMethod.BaseColorCombo));
            }
        }