Exemplo n.º 1
0
        public static LevelElementPlacement CreateSingleSynchro(LevelElementType type, float synchroTime)
        {
            LevelElementPlacement placement = new LevelElementPlacement(type);

            placement.SynchroStartTime = synchroTime;
            placement.SynchroEndTime   = synchroTime;

            if (type == LevelElementType.JumpObstacle)
            {
                placement.LevelElementStartTime = synchroTime;
                placement.LevelElementEndTime   = synchroTime + LevelGenerationValues.GetPlainJumpDuration();
            }
            if (type == LevelElementType.HighCollectible)
            {
                float halfJumpDuration = LevelGenerationValues.GetPlainJumpDuration() / 2.0f;

                placement.LevelElementStartTime = synchroTime - halfJumpDuration;
                placement.LevelElementEndTime   = synchroTime + halfJumpDuration;
            }
            if (type == LevelElementType.LowCollectible)
            {
                placement.LevelElementStartTime = synchroTime - 0.01f;
                placement.LevelElementEndTime   = synchroTime + 0.01f;
            }
            if (type == LevelElementType.SingleProjectile)
            {
                placement.LevelElementStartTime = synchroTime - LevelGenerationValues.ProjectileSafetyTime;
                placement.LevelElementEndTime   = synchroTime;
            }

            return(placement);
        }
Exemplo n.º 2
0
        private bool TryToAddSingleBeatLevelElement(SingleBeat singleBeat, LevelElementType type)
        {
            LevelElementPlacement placement = LevelElementPlacement.CreateSingleSynchro(
                type, singleBeat.Time);

            return(TryToAddLevelElement(placement));
        }
Exemplo n.º 3
0
        private bool TryToAddHeldNoteLevelElement(HeldNote heldNote, LevelElementType type)
        {
            LevelElementPlacement placement = LevelElementPlacement.CreateProlongedSynchro(
                type, heldNote.StartTime, heldNote.EndTime);

            return(TryToAddLevelElement(placement));
        }
Exemplo n.º 4
0
        private bool TryToAddMultipleBeatsLevelElement(MultipleBeats multipleBeats, LevelElementType type)
        {
            LevelElementPlacement placement = LevelElementPlacement.CreateMultipleSynchro(
                type, multipleBeats.GetBeatTimes());

            return(TryToAddLevelElement(placement));
        }
Exemplo n.º 5
0
        public LevelElementType GetNextSingleBeatLevelElementType()
        {
            LevelElementType levelElement = GetNextLevelElement(singleBeatLevelElementDistributions, lastSingleBeatLevelElement);

            lastSingleBeatLevelElement = levelElement;

            return(levelElement);
        }
Exemplo n.º 6
0
        public LevelElementType GetNextHeldNoteLevelElementType()
        {
            LevelElementType levelElement = GetNextLevelElement(heldNoteLevelElementDistributions, lastHeldNoteLevelElement);

            lastHeldNoteLevelElement = levelElement;

            return(levelElement);
        }
Exemplo n.º 7
0
        public LevelElementType GetNextMultipleBeatsLevelElementType()
        {
            LevelElementType levelElement = GetNextLevelElement(multipleBeatsLevelElementDistributions, lastMultipleBeatsLevelElement);

            lastMultipleBeatsLevelElement = levelElement;

            return(levelElement);
        }
Exemplo n.º 8
0
 public void AddLevelElementOccurence(LevelElementType type)
 {
     foreach (LevelElementDistribution distribution in distributions)
     {
         if (distribution.Type == type)
         {
             distribution.AddOccurrence();
         }
     }
 }
Exemplo n.º 9
0
        public void CreateLevelPlan()
        {
            LevelPlan levelPlan = new LevelPlan();

            // TODO: evtl Synchronisations nach Zeit sortieren

            foreach (SingleBeatSynchronisation singleBeatSynchronisation in synchronisations.SingleBeatSynchronisations)
            {
                LevelElementType levelElementType = distributionManager.GetNextSingleBeatLevelElementType();
            }
        }
Exemplo n.º 10
0
        public DistributionManager(int rngSeed)
        {
            rng = new Random(rngSeed);

            lastSingleBeatLevelElement    = LevelElementType.None;
            lastMultipleBeatsLevelElement = LevelElementType.None;
            lastHeldNoteLevelElement      = LevelElementType.None;

            singleBeatLevelElementDistributions    = new Dictionary <LevelElementType, int>();
            multipleBeatsLevelElementDistributions = new Dictionary <LevelElementType, int>();
            heldNoteLevelElementDistributions      = new Dictionary <LevelElementType, int>();

            Init();
        }
Exemplo n.º 11
0
        public static LevelElementPlacement CreateProlongedSynchro(LevelElementType type,
                                                                   float synchroStartTime, float synchroEndTime)
        {
            LevelElementPlacement placement = new LevelElementPlacement(type);

            placement.SynchroStartTime = synchroStartTime;
            placement.SynchroEndTime   = synchroEndTime;

            if (type == LevelElementType.Chasm)
            {
                placement.SetLevelElementTimesEqualToSynchroTimes();
            }
            if (type == LevelElementType.DuckObstacle)
            {
                placement.SetLevelElementTimesEqualToSynchroTimes();
            }

            return(placement);
        }
Exemplo n.º 12
0
        public static LevelElementPlacement CreateMultipleSynchro(LevelElementType type, List <float> synchroTimes)
        {
            LevelElementPlacement placement = new LevelElementPlacement(type);

            placement.SynchroStartTime = synchroTimes[0];
            placement.SynchroEndTime   = synchroTimes[synchroTimes.Count - 1];

            placement.SynchroTimes = synchroTimes;

            if (type == LevelElementType.ChasmWithCollectibles)
            {
                placement.LevelElementStartTime = synchroTimes[0] - LevelGenerationValues.TimeBeforeFirstChasmCollectible;
                placement.LevelElementEndTime   = synchroTimes[synchroTimes.Count - 1] +
                                                  LevelGenerationValues.TimeAfterLastChasmCollectible;
            }
            if (type == LevelElementType.MultipleProjectiles)
            {
                placement.LevelElementStartTime = synchroTimes[0] - LevelGenerationValues.ProjectileSafetyTime;
                placement.LevelElementEndTime   = synchroTimes[synchroTimes.Count - 1];
            }

            return(placement);
        }
Exemplo n.º 13
0
        private LevelElementType GetNextLevelElement(Dictionary <LevelElementType, int> distributions, LevelElementType lastLevelElement)
        {
            List <LevelElementType> possibleLevelElements = new List <LevelElementType>();

            int lowestOccurenceValue = 9999;

            foreach (KeyValuePair <LevelElementType, int> distribution in distributions.ToList())
            {
                LevelElementType levelElement = distribution.Key;
                int numberOfOccurences        = distribution.Value;

                if (levelElement == lastLevelElement)
                {
                    continue;
                }

                if (numberOfOccurences < lowestOccurenceValue)
                {
                    possibleLevelElements.Clear();
                    possibleLevelElements.Add(levelElement);

                    lowestOccurenceValue = numberOfOccurences;
                }
                else if (numberOfOccurences == lowestOccurenceValue)
                {
                    possibleLevelElements.Add(levelElement);
                }
            }

            int randomIndex = rng.Next(possibleLevelElements.Count);

            LevelElementType chosenLevelElement = possibleLevelElements[randomIndex];

            distributions[chosenLevelElement] = distributions[chosenLevelElement] + 1;

            return(chosenLevelElement);
        }
Exemplo n.º 14
0
        private LevelElementPlacement(LevelElementType type)
        {
            Type = type;

            SynchroTimes = new List <float>();
        }
Exemplo n.º 15
0
 public LevelElement(IDictionary _Dic)
 {
     mLevelElementType = (LevelElementType)int.Parse(_Dic["ElementType"].ToString());
     mX = int.Parse(_Dic["x"].ToString());
     mY = int.Parse(_Dic["y"].ToString());
 }
Exemplo n.º 16
0
 public void AddLevelElementUse(LevelElementType type)
 {
     singleBeatDistributions.AddLevelElementOccurence(type);
     heldNoteDistributions.AddLevelElementOccurence(type);
     multipleBeatsDistributions.AddLevelElementOccurence(type);
 }
Exemplo n.º 17
0
 private bool IsLevelElementTypeAChasm(LevelElementType type)
 {
     return(type == LevelElementType.Chasm || type == LevelElementType.ChasmWithCollectibles);
 }
Exemplo n.º 18
0
 public void AddLevelElementDestination(LevelElementType type, float startingTime, float duration)
 {
     CreateProlongedSynchronisation(type, startingTime, startingTime + duration);
     //LevelElementDestinations.Add(new LevelElementDestination(type, startingTime, duration));
 }
Exemplo n.º 19
0
 public void AddLevelElementDestination(LevelElementType type, float startingTime)
 {
     CreateSingleSynchronisation(type, startingTime);
     //LevelElementDestinations.Add(new LevelElementDestination(type, startingTime, 0));
 }
Exemplo n.º 20
0
 private void CreateProlongedSynchronisation(LevelElementType type,
                                             float synchroStartTime, float synchroEndTime)
 {
     AddLevelElementPlacement(LevelElementPlacement.CreateProlongedSynchro(type, synchroStartTime, synchroEndTime));
 }
Exemplo n.º 21
0
 private void CreateSingleSynchronisation(LevelElementType type, float synchronisationTime)
 {
     AddLevelElementPlacement(LevelElementPlacement.CreateSingleSynchro(type, synchronisationTime));
 }
Exemplo n.º 22
0
 public LevelElementDistribution(LevelElementType type, int favorValue)
 {
     Type        = type;
     Occurrences = 0;
     FavorValue  = favorValue;
 }
Exemplo n.º 23
0
 public void AddLevelElementType(LevelElementType type, int favorValue = -1)
 {
     distributions.Add(new LevelElementDistribution(type, favorValue));
 }