public static void GenerateStars(GlobalConstants.GalaxySize GalaxySize, GlobalConstants.GalaxyType GalaxyType) { SizeEnum = GalaxySize; GalaxyTypeEnum = GalaxyType; SetGalaxyRadiusAndStarCountByGalazySize(SizeEnum); Engine.Instance.WriteToConsole("Generating galaxy!"); Engine.Instance.WriteToConsole("Galaxy size: " + SizeEnum + "; Galaxy type: " + GalaxyTypeEnum); Engine.Instance.WriteToConsole("Star count: " + StarCount.ToString()); Engine.Instance.WriteToConsole(""); List <Star> arrStars = new List <Star>(); ContinuousUniform StarRadiusGen = new ContinuousUniform(2, 16.3); for (int i = 0; i < StarCount; i++) { float fltStarRad = (float)StarRadiusGen.Sample(); bool blnShouldCreateStar = true; Vector2f StarPosition = new Vector2f(0, 0); if (GalaxyTypeEnum == GlobalConstants.GalaxyType.DISK) { StarPosition = GetStarCoordinatesForElipticalGalaxy(ref arrStars, out blnShouldCreateStar); } else if (GalaxyTypeEnum == GlobalConstants.GalaxyType.RING) { StarPosition = GetStarCoordinatesForRingGalaxy(ref arrStars, out blnShouldCreateStar); } else { StarPosition = GetStarCoordinatesForElipticalGalaxy(ref arrStars, out blnShouldCreateStar); } if (blnShouldCreateStar && StarPosition.X != 0 && StarPosition.Y != 0) { Star objStar = new Star(fltStarRad, StarPosition, 1); arrStars.Add(objStar); } Engine.Instance.WriteToConsole("Stars generated: " + i.ToString(), true, false, false); } Stars = arrStars.ToArray(); HomeStarIndex = random.Next(0, Stars.Length - 1); while (Stars[HomeStarIndex].HasPanets == false) { if (Stars[HomeStarIndex].HasPanets == true) { Stars[HomeStarIndex].Home = true; Stars[HomeStarIndex].HasPlayer = true; } else { HomeStarIndex = random.Next(0, Stars.Length - 1); } } }
public void SpawnAt(Vector3 gridPoint) { if (StarCount.UseStars(this.Price)) { Instantiate(this.Defender, gridPoint, Quaternion.identity); } }
// Use this for initialization void Start() { starCounter = GameObject.FindObjectOfType <StarCount>(); defenderParent = GameObject.Find("Defenders"); if (!defenderParent) { defenderParent = new GameObject("Defenders"); } }
public async Task ViewStarsChart() { //Arrange Assert.IsTrue(TrendsPage.IsViewsClonesChartVisible); //Act await TrendsPage.MoveToNextPage(); await TrendsPage.WaitForPageToLoad(); //Assert Assert.IsTrue(TrendsPage.IsStarsChartVisible); Assert.AreEqual(_selectedRepository !.StarCount.ToAbbreviatedText(), TrendsPage.StarsStatisticsLabelText); Assert.AreEqual(_selectedRepository !.StarCount > 1 ? TrendsChartTitleConstants.KeepItUp.ToUpper() : TrendsChartTitleConstants.YouGotThis.ToUpper(), TrendsPage.StarsHeaderMessageLabelText); }
public StarCount CountStars(List <MonteCard> simulation, int sevenStars, int extraStars, CurseBehavior curseBehavior) { List <int> StarsByDepth = new List <int>(); List <int> RequiredByDifficulty = new List <int>(); List <bool> SafetyByDepth = new List <bool>(); int totalStars = extraStars; int left = 0; int right = 0; bool hasAHalf = false; int successIndex = -1; bool failed = false; for (int i = 0; i < simulation.Count; i++) { MonteCard card = simulation[i]; totalStars += card.stars; totalStars += card.sevens * sevenStars; if (card.curse) { switch (curseBehavior) { case CurseBehavior.FAIL: failed = true; break; case CurseBehavior.MINUS: totalStars--; break; case CurseBehavior.STAR: totalStars++; break; case CurseBehavior.SUCCEED: if (successIndex == -1) { successIndex = i; } break; } } if (card.root && rootAutoFail) { failed = true; } if (card.amulet) { totalStars++; if (amuletAutoSucceed && successIndex == -1) { successIndex = i; } } if (card.left) { left++; } if (card.right) { right++; } if (!(card.right && card.left)) { hasAHalf = true; } int halfTotal = Math.Min(left, right); if (!hasAHalf) { halfTotal--; } if (halfTotal < 0) { halfTotal = 0; } int totalAtDepthI = halfTotal + totalStars; StarsByDepth.Add(totalAtDepthI); SafetyByDepth.Add(!failed || successIndex > -1); if (successIndex > -1) { while (RequiredByDifficulty.Count < totalAtDepthI) { RequiredByDifficulty.Add(successIndex); } } else if (!failed) { while (RequiredByDifficulty.Count < totalAtDepthI) { RequiredByDifficulty.Add(i); } } } StarCount count = new StarCount(StarsByDepth, RequiredByDifficulty, successIndex, SafetyByDepth); return(count); }
public void UpdateUI() { StarText.text = StarCount.ToString(); CoinText.text = CoinCount.ToString(); }
void AddStars(int amount) { StarCount.AddStars(amount); }
// Use this for initialization void Start() { starCounter = GameObject.FindObjectOfType <StarCount>(); }