void CreateEnemies() { foreach (float offset in OrbitPath.CalcEnemyOffsets()) { CreateEnemy().PathPercent += offset; } }
public Orbit CreateOrbit(OrbitPath orbitPath) { var orbit = new Orbit(this, orbitPath); orbits.Push(orbit); return(orbit); }
public Orbit(Slot slot, OrbitPath path) { CatchedTransform = slot.CatchedTransform; OrbitPath = path; CatchedPosition = CatchedTransform.position; pathPercentOffset = initialPercentOffsetRange.GetRandomValue(); float difficultyMultiplier = DifficultyConfig.Ref.GetSpeedMultiplier(slot.GalaxyIndex); globalSpeedMultiplier = globalSpeedMultiplierRange.GetRandomValue() * difficultyMultiplier; CreateEnemies(); }
void UpdateEnemy(Enemy enemy) { if (enemy.IsKilled) { return; } float speedMultiplier = OrbitPath.GetSpeedMultiplier(enemy.PathPercent) * globalSpeedMultiplier; enemy.PathPercent += speedMultiplier * Time.deltaTime; var offset = OrbitPath.GetPositionOffset(enemy.PathPercent); enemy.Position = CatchedPosition + offset; }
void Awake() { Ref = this; const int maxOrbits = 10; orbits = new OrbitPath[maxOrbits][]; smallOrbits = new OrbitPath[maxOrbits][]; bigOrbits = new OrbitPath[maxOrbits][]; var all = new List <OrbitPath>(); var allSmall = new List <OrbitPath>(); var allBig = new List <OrbitPath>(); for (var i = 0; i < maxOrbits; i++) { orbits[i] = Resources.LoadAll <OrbitPath>("Paths\\" + i); if (orbits[i] == null || orbits[i].Length == 0) { continue; } smallOrbits[i] = orbits[i].Where(_ => !_.IsBig).ToArray(); bigOrbits[i] = orbits[i].Where(_ => _.IsBig).ToArray(); all.AddRange(orbits[i]); allSmall.AddRange(smallOrbits[i]); allBig.AddRange(bigOrbits[i]); } foreach (string folderName in GalaxiesConfig.Ref.CustomFolderNames) { if (folderName.IsNullOrEmpty()) { continue; } var orbs = Resources.LoadAll <OrbitPath>("Paths\\" + folderName); customSmallOrbitFolders.Add(folderName, orbs.Where(_ => !_.IsBig).ToArray()); customBigOrbitFolders.Add(folderName, orbs.Where(_ => _.IsBig).ToArray()); } allOrbits = all.ToArray(); allSmallOrbits = allSmall.ToArray(); allBigOrbits = allBig.ToArray(); shieldOrbit = Resources.Load <OrbitPath>("Shield"); letterOrbits = Resources.LoadAll <OrbitPath>("Letters"); }