private void CreateLightningEffect() { float startX = random.Next((int)baseScreenSize.X); Vector2 endPos = new Vector2(random.Next((int)baseScreenSize.X), baseScreenSize.Y - 10); int burnFoliageProb = random.Next(3); if (burnFoliageProb < 2 && foliages.Count > 0) { Foliage chosenFoliage = foliages[random.Next(foliages.Count)]; chosenFoliage.StartBurning(); Vector3 tmp = chosenFoliage.GetPosition(); Vector3 size = chosenFoliage.GetSize(); if (chosenFoliage.Moving) { endPos = new Vector2(tmp.X, tmp.Y + size.Y); } else { endPos = new Vector2(tmp.X, tmp.Y); } } branchLightning = new BranchLightning(new Vector2(startX, -2), endPos); scene.LightningManager.CurrentLightnings.Add(branchLightning); }
private Foliage CreateMovingFoliage(Foliage currentFoliage) { RenderObject foliageSpritesheet = SpritesheetImporter.ImportSpritesheet(MainConfig.CONTENT_CHARACTERS_DIRECTORY + "UndergrowthAnimation.xml", director.Content, scene).Item1; Foliage movingFoliage = new Foliage(foliageSpritesheet, scene, currentFoliage.GetPosition()); Vector3 currPos = currentFoliage.GetPosition(); Vector3 currRot = currentFoliage.GetRotation(); Vector3 currSize = currentFoliage.GetSize(); movingFoliage.SetPosition(currentFoliage.Moving ? new Vector2(currPos.X, currPos.Y) : new Vector2(currPos.X, currPos.Y - currSize.Y - 1f)); movingFoliage.SetRotation(currRot); movingFoliage.SetSize(currSize); return(movingFoliage); }