public void SimulateDirectTravel(StarInfo destination) { if (destination == null) { throw new ArgumentNullException(nameof(destination)); } if (!this.game.States.Stars.At.Contains(this.Fleet.Position)) { return; } this.simulationWaypoints.Clear(); if (!this.selection.Any(x => x.Value.Quantity > 0)) { this.calcSimulation(); return; } var playerProc = this.game.Derivates[this.player]; var start = this.game.States.Stars.At[this.Fleet.Position]; //TODO(later) prevent changing destination midfilght this.simulationWaypoints.Add(new WaypointInfo( start, destination.Data, playerProc.VisibleWormholeAt(start, destination.Data, this.game) )); this.calcSimulation(); }
public FleetController SendDirectly(StarInfo destination) { if (destination == null) { throw new ArgumentNullException(nameof(destination)); } if (!this.game.States.Stars.At.Contains(this.Fleet.Position) || !this.selection.Any(x => x.Value.Quantity > 0)) { return(this); } //TODO(later) prevent changing destination midfilght if (this.CanMove && destination.Position != this.Fleet.FleetData.Position) { return(this.giveOrder(new AMission[] { new MoveMission( this.game.States.Stars.At[this.Fleet.Position], destination.Data, this.game.States.Wormholes.At.GetOrDefault(this.game.States.Stars.At[this.Fleet.Position], destination.Data) ) })); } else if (this.game.States.Stars.At.Contains(this.Fleet.FleetData.Position)) { return(this.giveOrder(new AMission[0])); } return(this); }
public IActionResult Post(int JournalId, [FromBody] StarInfo starInfo) { Result result = new Result(); //----------------------------------------------- StarSystem starSystem = new StarSystem(starInfo); int count = db.StarSystems.Count(s => s.Name == starInfo.name); //----------------------------------------------- if (count == 0) { db.StarSystems.Add(starSystem); db.SaveChanges(); db.JournalStarSystems.Add(new JournalStarSystem() { JournalId = JournalId, StarSystemId = starSystem.Id }); db.SaveChanges(); result.SetSuccess("StarSystem " + starSystem.Name + " created successfully and added to journal.", starSystem); } else { result.SetFailure("StarSystem already exists."); } //----------------------------------------------- return(Ok(result)); }
/// <summary> /// Retrieves a list of reference stars around a given position. /// </summary> /// <param name="Center">Location around which to search.</param> /// <param name="Radius">Radius (in radians) of the search cone.</param> /// <param name="LowMagLimit">Lowest star magnitude to include in results.</param> /// <returns>A list of StarInfo containing the data of the reference stars.</returns> public static List <StarInfo> GetVizieRObjects(EquatorialPoint Center, double Radius, double LowMagLimit) { double RadiusArcMin = Radius * 180 * 60 / Math.PI; string URL = VizieRURL + Center.FormatToString(EquatorialPointStringFormatter.Format.MPC) + "&-c.r=" + RadiusArcMin.ToString("0.00"); string Data = ""; using (WebClient client = new WebClient()) try { client.Proxy = null; Data = client.DownloadString(URL); } catch (WebException) { return(new List <StarInfo>()); } string[] lines = Data.Split('\n'); int i; List <string[]> objsString = new List <string[]>(); /* Skip to beginning of table */ for (i = 0; i < lines.Length; i++) { if (lines[i].StartsWith("----")) { break; } } /* Read each line and split values (table is TSV) */ for (i++; i < lines.Length; i++) { objsString.Add(lines[i].Split('\t')); } List <StarInfo> sti = new List <StarInfo>(objsString.Count); /* Foreach entry */ foreach (string[] sk in objsString) { /* Check if it matches the 14-entry format recognized */ if (sk.Length != 14) { continue; } /* The next 3 should be in order: */ sk[1] = sk[1].Trim(); /* RA */ sk[2] = sk[2].Trim(); /* Dec */ sk[12] = sk[12].Trim(); /* R2mag */ if (string.IsNullOrEmpty(sk[1]) | string.IsNullOrEmpty(sk[2]) | string.IsNullOrEmpty(sk[12])) { continue; } StarInfo sif = new StarInfo(); double RA = double.Parse(sk[1]) * Math.PI / 180; double Dec = double.Parse(sk[2]) * Math.PI / 180; EquatorialPoint EqP = new EquatorialPoint() { RA = RA, Dec = Dec }; sif.Coordinate = EqP; sif.Magnitude = double.Parse(sk[12]); sti.Add(sif); } return(sti.Where((x) => x.Magnitude < LowMagLimit).ToList()); }
private void ShowInfomation() { // 何も当たらない場合は消す if (Input.GetButtonDown ("ShowInfomation") && dialog.activeSelf == false) { rayDirection = new Vector3 (transform.position.x, transform.position.y - parent.transform.position.y, transform.position.z); if (Physics.Raycast (mainCamera.transform.position, rayDirection, out hitInfo, 1000f)) { Debug.DrawLine (mainCamera.transform.position, hitInfo.point, Color.blue, 5); // 当たった場合パネルが非表示なら表示させる if (mainPanel.activeSelf == false) { mainPanel.SetActive (true); } // あたったオブジェクトのStarInfo,PlanetInfoのコンポーネントを取得し、名前、説明を代入 if (hitInfo.collider.tag == "Star") { hitStarInfo = hitInfo.transform.gameObject.GetComponent<StarInfo> (); nameText.text = hitStarInfo.name.ToString (); descriptionText.text = hitStarInfo.description.ToString (); } else if (hitInfo.collider.tag == "Planet") { hitPlanetInfo = hitInfo.transform.gameObject.GetComponent<PlanetInfo> (); nameText.text = hitPlanetInfo.name.ToString (); descriptionText.text = hitPlanetInfo.description.ToString (); } } else { if (mainPanel.activeSelf == true) { mainPanel.SetActive (false); } rayDirection = new Vector3(transform.position.x*100, (transform.position.y - parent.transform.position.y)*100, transform.position.z*100); Debug.DrawRay (mainCamera.transform.position, rayDirection, Color.red, 5); } } }
// Use this for initialization void Start() { //solar system mechanics rank = Random.Range(1, 6); numPlanets = Random.Range(0, 4); for (int i = 0; i < numPlanets; i++) { planets.Add(new GameObject("planet")); planets[planets.Count - 1].transform.parent = transform; planets[planets.Count - 1].transform.position = transform.position; planets[planets.Count - 1].AddComponent <PlanetController>(); planets[planets.Count - 1].GetComponent <PlanetController>().orbitDistance = i + 1; planets[planets.Count - 1].GetComponent <PlanetController>().habitable = (((int)Random.Range(1, 10)) / rank <= 2) ? true : false; } //star graphics sc = GameObject.Find("Sprite Collection").GetComponent <SpriteCollection>(); g = gameObject.AddComponent <SpriteRenderer>(); g.transform.localScale = new Vector3(starScale, starScale, starScale); starSprite = sc.getStar(); //collider stuff c = gameObject.AddComponent <CircleCollider2D>(); starInfo = new StarInfo("" + transform.position.ToString(), rank, planets.ToArray()); }
private void mockSpawnStars() { int index = 0; string starSeedId = null; for (; index < 42; index++) { StarInfo starInfo = new StarInfo(); starInfo.randomizeInfo(); spawnStar(starInfo); // set seed star as visited if (starSeedId == null) { starSeedId = starInfo.starId; NStar starSeed = null; if (starMap.TryGetValue(starSeedId, out starSeed)) { starSeed.setVisited(); } } } }
public void Case3() { StarInfo star; List <StarInfo> stars = new List <StarInfo>(); star = new StarInfo("Sirius", 8.6d); stars.Add(star); star = new StarInfo("Rigel", 1400d); stars.Add(star); star = new StarInfo("Castor", 49d); stars.Add(star); star = new StarInfo("Antares", 520d); stars.Add(star); stars.Sort(); foreach (StarInfo sortedStar in stars) { Console.WriteLine(sortedStar); } // The example displays the following output: // Sirius (50,568,000,000,000) // Castor (288,120,000,000,000) // Antares (3,057,600,000,000,000) // Rigel (8,232,000,000,000,000) }
public void SimulateTravel(StarInfo destination) { if (!this.game.States.Stars.At.Contains(this.Fleet.Position)) { return; } this.simulationWaypoints.Clear(); if (!this.selection.Any(x => x.Value.Quantity > 0)) { this.calcSimulation(); return; } var playerProc = this.game.Derivates[this.player]; //TODO(later) prevent changing destination midfilght this.simulationWaypoints.AddRange( playerProc.ShortestPathTo(this.game.States.Stars.At[this.Fleet.Position], destination.Data, this.baseTravelSpeed(), this.game). Select(x => new WaypointInfo( x.ToNode, playerProc.VisibleWormholeAt(x.FromNode, x.ToNode, this.game) )) ); this.calcSimulation(); }
static void ConnectStars() { // 結ぶことのできる最長の距離はここを調整 float connectableMaxDistance = 0.1f; // ------------------------------------- GameObject[] stars = GameObject.FindGameObjectsWithTag("Star"); Vector2 canvasSize = GameObject.Find("Canvas").GetComponent <RectTransform>().sizeDelta; foreach (GameObject star in stars) { StarInfo starInfo = star.GetComponent <StarInfo>(); starInfo.connectableStars.Clear(); Vector2 starAnchoredPosition = star.GetComponent <RectTransform>().anchoredPosition; // 星のUI上の座標を取得(アンカー位置が原点) Vector2 starPos = starAnchoredPosition / canvasSize; // Canvas全体を(1,1)に補正 foreach (GameObject pairStar in stars) { if (star == pairStar) { continue; } Vector2 pairStarAnchoredPosition = pairStar.GetComponent <RectTransform>().anchoredPosition; // 星のUI上の座標を取得(アンカー位置が原点) Vector2 pairStarPos = pairStarAnchoredPosition / canvasSize; // Canvas全体を(1,1)に補正 float distance = Vector2.Distance(starPos, pairStarPos); // 2つの星の距離を取得 if (distance < connectableMaxDistance) { starInfo.connectableStars.Add(pairStar); // inspectorにアタッチ } } } }
public FleetController Send(StarInfo destination) { if (destination == null) { throw new ArgumentNullException(nameof(destination)); } //TODO(later) prevent changing immediate destination midfilght but allow to change final destination if (!this.game.States.Stars.At.Contains(this.Fleet.Position) || !this.selection.Any(x => x.Value.Quantity > 0)) { return(this); } if (this.CanMove && destination.Position != this.Fleet.FleetData.Position) { return(this.giveOrder( this.game.Derivates[this.player]. ShortestPathTo(this.game.States.Stars.At[this.Fleet.Position], destination.Data, this.carriedSelection, this.game). Select(x => new MoveMission(x.FromNode, x.ToNode, this.game.States.Wormholes.At.GetOrDefault(x.FromNode, x.ToNode))). ToList() )); } else if (this.game.States.Stars.At.Contains(this.Fleet.FleetData.Position)) { return(this.giveOrder(new AMission[0])); } return(this); }
Vector2 GetMagnitudes(StarInfo star, float minMag, float maxMag, float minAbsMag, float maxAbsMag) { float mag = (star.magnitude - minMag) / (maxMag - minMag); //float mag = (star.magnitude / maxMag); float absMag = (star.absoluteMagnitude - minAbsMag) / (maxAbsMag - minAbsMag); return(new Vector2(mag, absMag)); }
public void Setup(StarInfo starInfo) { id = starInfo.id; location = starInfo.location; isNeighbour = false; GetComponentInChildren <SpriteRenderer>().color = defaultColor; SetState(StarState.DEFAULT); }
public bool IsStarVisited(StarInfo star) { if (star == null) { throw new ArgumentNullException(nameof(star)); } return(this.PlayerInstance(this.gameInstance).Intelligence.About(star.Data).IsVisited); }
/// <summary> /// Initializes spawner object using information /// gathered from database. /// </summary> /// <param name="starID">Document ID of the star.</param> public void GetStar(ICouchDatabase dbObject, string starID) { starInfo = dbObject.GetDocument<StarInfo>(starID); // Planets inside the solar system. foreach (var planet in starInfo.planets) { Planet uPlanet = gameObject.AddComponent<Planet>(); uPlanet.planetInfo = planet; planets.Add(uPlanet); } }
public StarSystemController OpenStarSystem(StarInfo star) { var game = this.gameInstance; if (!game.States.Stars.Contains(star.Data)) { throw new ArgumentException("Star doesn't exist"); } return(new StarSystemController(game, star.Data, game.IsReadOnly, this)); }
void OnSceneGUI() { StarInfo go = target as StarInfo; if (Selection.Contains(go.gameObject)) { } else { Handles.ArrowCap(0, go.transform.position, go.transform.rotation, 1); } }
public void InitMeteor() { for (int ct = 0; ct < meteorNum; ct++) { StarInfo starInfo = new StarInfo(StarType.Meteor); MeteorEntity objGen = Instantiate(pfbMeteor).GetComponent <MeteorEntity>(); objGen.transform.SetParent(entityGroup); objGen.transform.localPosition = new Vector3(starInfo.sPos.x * scaleRate, starInfo.sPos.y * scaleRate, 0); objGen.Regist(starInfo, matMeteors[Random.Range(0, matMeteors.Count)], Random.Range(0.5f, 1.5F)); } }
public IEnumerable <ColonyInfo> KnownColonies(StarInfo star) { var game = this.gameInstance; var starKnowledge = this.PlayerInstance(game).Intelligence.About(star.Data); foreach (var colony in game.States.Colonies.AtStar[star.Data]) { if (starKnowledge.Planets[colony.Location.Planet].LastVisited != PlanetIntelligence.NeverVisited) { yield return(new ColonyInfo(colony, game.Derivates[colony])); } } }
private void showStarInfo(StarInfo star) { var starSystem = this.currentPlayer.OpenStarSystem(star); //TODO(later) update owner check when multiple stellarises can exist at the same star if (starSystem.StarsAdministration() != null && starSystem.StarsAdministration().Owner == this.currentPlayer.Info) { this.starInfo.SetView(this.currentPlayer.OpenStarSystem(this.selectedStar).StellarisController()); this.showBottomView(this.starInfo); } else { this.hideBottomView(); } }
private void AddOrRemoveStarLine() { //没有星星 直接返回 if (_stars == null) { return; } //生成星星间的连线 for (int i = 0; i < _starCount - 1; i++) { for (int j = i + 1; j < _starCount; j++) { StarInfo star1 = _stars[i]; double x1 = star1.X + star1.StarRef.Width / 2; double y1 = star1.Y + star1.StarRef.Height / 2; StarInfo star2 = _stars[j]; double x2 = star2.X + star2.StarRef.Width / 2; double y2 = star2.Y + star2.StarRef.Height / 2; double s = Math.Sqrt((y2 - y1) * (y2 - y1) + (x2 - x1) * (x2 - x1));//两个星星间的距离 double threshold = star1.StarRef.Width * _lineRate + star2.StarRef.Width * _lineRate; if (s <= threshold) { if (!star1.StarLines.ContainsKey(star2)) { Line line = new Line() { X1 = x1, Y1 = y1, X2 = x2, Y2 = y2, Stroke = GetStarLineBrush(star1.StarRef, star2.StarRef) }; star1.StarLines.Add(star2, line); grid_lineContainer.Children.Add(line); } } else { if (star1.StarLines.ContainsKey(star2)) { grid_lineContainer.Children.Remove(star1.StarLines[star2]); star1.StarLines.Remove(star2); } } } } }
private void ShowStar() { StarInfo starInfo = MapModel.Instance.starInfo; starButton.GetComponentInChildren <Text>().text = starInfo.crtStar + "/" + starInfo.openMapFullStar; starTipAnim.Stop(); List <config_chapter_item> datas = ResModel.Instance.config_chapter.data; int totalChapterCount = datas.Count; int i; for (i = 0; i < totalChapterCount; i++) { config_chapter_item config_chapter = datas[i]; List <int> mapIds = config_chapter.GetMapIds(); if (mapIds.Count > 0) { int allStars = 0; int fullStar = 0; int j; for (j = 0; j < mapIds.Count; j++) { config_map_item config_map = (config_map_item)ResModel.Instance.config_map.GetItem(mapIds[j]); MapInfo mapInfo = MapModel.Instance.GetMapInfo(config_map.id); if (mapInfo != null) { allStars += mapInfo.star; } fullStar += 3; } if (allStars >= fullStar) { ChapterInfo chapter = MapModel.Instance.GetChapterInfo(config_chapter.id); if (chapter == null || chapter.reward == false) { starTipAnim.Play(); return; } } } } }
private void OnOkClick(GameObject go) { config_map_item mapConfig = BattleModel.Instance.crtConfig; IVInfo starLimit = mapConfig.GetStarLimit(); if (starLimit.id > 0) { StarInfo starInfo = MapModel.Instance.starInfo; if (starLimit.id > starInfo.crtStar) // star short { MapInfo mapInfo = MapModel.Instance.GetMapInfo(mapConfig.id); if (mapInfo.buyPassed == false) // no buy { ModuleModel.Instance.AddUIModule((int)ModuleEnum.MAPLOCK); return; } } } WealthInfo energyInfo = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Energy); if (energyInfo.count >= GameModel.Instance.GetGameConfig(1001)) { PlayerModel.Instance.updateWealthsEvent -= UpdateView; energyInfo.count -= (int)GameModel.Instance.GetGameConfig(1001); PlayerModel.Instance.SaveWealths(); PlayerModel.Instance.CheckEnergyRecover(false); SkillModel.Instance.InitSeeds(); SkillModel.Instance.InitFightingEntitys(); SkillModel.Instance.crt_entity = null; PropModel.Instance.InitProps(); CollectModel.Instance.Clear(); BattleModel.Instance.play_mapId = BattleModel.Instance.crtBattle.mapId; BattleModel.Instance.ready_map = 0; ModuleModel.Instance.AddUIModule((int)ModuleEnum.FIGHT); } else { PlayerModel.Instance.ExchangeWealth((int)WealthTypeEnum.Energy, (int)GameModel.Instance.GetGameConfig(1001) - energyInfo.count, GotoFight); PromptModel.Instance.Pop(LanguageUtil.GetTxt(11901), false, (int)WealthTypeEnum.Energy); } }
private Color starNameColor(StarInfo star) { if (this.currentPlayer.IsStarVisited(star)) { var colonies = this.currentPlayer.KnownColonies(star); if (colonies.Any()) { var dominantPlayer = colonies.GroupBy(x => x.Owner).OrderByDescending(x => x.Count()).First().Key; return(dominantPlayer.Color); } return(Color.LightGray); } return(Color.FromArgb(64, 64, 64)); }
private void updateStarInfo(StarInfo star) { var starSystem = this.currentPlayer.OpenStarSystem(star); this.galaxyViewListener.SystemSelected(starSystem); //TODO(later) update owner check when multiple stellarises can exist at the same star if (starSystem.StarsAdministration() != null && starSystem.StarsAdministration().Owner == this.currentPlayer.Info) { this.starInfo.SetView(this.currentPlayer.OpenStarSystem(this.lastSelectedStar).StellarisController()); this.ShowElement(this.starInfo); } else { this.HideElement(this.starInfo); } }
//计算每个星球的关卡进度 public StarInfo GetStarInfo(int starID, int completeMissionID) { StarInfo starInfo = new StarInfo() { CompleteMissionCount = 0, TotalMissionCount = 0 }; List <WorldInfo> worldInfos = this.MissionConfig.GetAllWorlds(); if (worldInfos == null || worldInfos.Count == 0 || !worldInfos.Exists(t => t.ID == starID) || this.MissionConfig.GetStarIDByMissionID(completeMissionID) != starID) { Debug.LogWarningFormat("<><MissionDataManager.GetStarInfo>worldInfos is null or not exists star: {0}", starID); starInfo.TotalMissionCount = this.MissionConfig.GetMissionCount(starID); return(starInfo); } Debug.LogFormat("<><MissionDataManager.GetStarInfo>StarID: {0}, CompleteMissionID: {1}", starID, completeMissionID); int completeCount = 0, totalCount = 0; WorldInfo worldInfo = worldInfos.Find(t => t.ID == starID); if (worldInfos == null) { return(starInfo); } foreach (var sceneInfo in worldInfo.SceneInfos) { foreach (var missionInfo in sceneInfo.missionInfos) { if (missionInfo.missionId == PlayerData.sleepMission) { continue; } totalCount += 1; if (this.GetMisionState(missionInfo.missionId) != MissionState.eLock) { completeCount += 1; } } } starInfo.CompleteMissionCount = completeCount; starInfo.TotalMissionCount = totalCount; Debug.LogFormat("<><MissionDataManager.GetStarInfo>MissionCompleteCount: {0}, MissionTotalCount: {1}", completeCount, totalCount); return(starInfo); }
public void join(NStar parent, StarInfo starInfo) { this.starInfo = starInfo; starPositionInBubble = Random.Range(0, 360); // one time setup of parent if (parentStar == null && parent != null) { parentStar = parent; } if (parentStar != null) { parentStar.clearSelected(); parentStar.setChild(this); } }
void Update() { #if DEBUG if (Input.GetKeyUp(KeyCode.S) || Input.GetKey(KeyCode.B)) { StarInfo starInfo = new StarInfo(); starInfo.randomizeInfo(); spawnStar(starInfo); starPopulation.text = "# of stars: [" + starMap.Count.ToString() + "]"; } else if (Input.GetMouseButtonDown(0)) { createNewStellarSytem(); } if (Input.GetKeyUp(KeyCode.R)) { prepareNewStellarSystem(); } if (Input.GetKeyUp(KeyCode.V)) { getSelected().setVisited(); } if (Input.GetKeyUp(KeyCode.C)) { string currentStarId = getSelected().getStarId(); setCurrentStar(currentStarId); } if (Input.GetKeyUp(KeyCode.Space)) { mockSpawnStars(); starPopulation.text = "# of stars: [" + starMap.Count.ToString() + "]"; prepareNewStellarSystem(); } #endif updateUniverseBoundaryMeta(); #if DEBUG updateUniverseBoundMarker(); #endif }
// GET: Item public ActionResult Detail(string linkName) { var item = _context.Items.SingleOrDefault(i => i.LinkName == linkName); if (item == null) { return(View("Detail")); } var itemDetailModel = new ItemDetailModel(); itemDetailModel.Item = item; itemDetailModel.ItemSpecifications = getItemSpecificationsModel(item); itemDetailModel.ItemSpecificationGroups = getItemSpecificationGroups(itemDetailModel.ItemSpecifications); itemDetailModel.Reviews = _context.ItemReviews .Where(ir => ir.ItemId == item.Id) .Include(ir => ir.Customer) .Include(ir => ir.Customer.ApplicationUser) .OrderBy(ir => ir.Date) .ToArray(); itemDetailModel.Features = _context.ItemFeatures .Where(i => i.ItemId == item.Id) .ToArray(); var starInfos = new List <StarInfo>(); for (int i = 1; i < 6; i++) { var starInfo = new StarInfo(); starInfo.Value = i; starInfo.Count = itemDetailModel.Reviews.Count(r => r.Note == i); starInfo.Ratio = itemDetailModel.Reviews.Count() > 0 ? (decimal)starInfo.Count / itemDetailModel.Reviews.Count() : 0; starInfos.Add(starInfo); } itemDetailModel.Stars = starInfos.ToArray(); itemDetailModel.OtherItems = _context.ItemLinks .Where(i => i.MainItemId == item.Id) .Include(i => i.OtherItem) .Select(i => i.OtherItem) .ToArray(); return(View("Detail", itemDetailModel)); }
public void DrawStarInfo(StarInfo info) { //update StarInfoGUI objects according to given StarInfo StarInfoPrefab.SetActive(true); StarNameField.text = info.name; RankNum.text = "" + info.rank; for (int i = 0; i < info.planets.Length; i++) { PlanetController pc = info.planets[i].GetComponent <PlanetController>(); GameObject planetGUI = PlanetInfoPrefabs[i]; planetGUI.SetActive(true); planetGUI.transform.FindChild("Name Field").GetComponent <Text>().text = pc.planetInfo.name; planetGUI.transform.FindChild("Factory num").GetComponent <Text>().text = "" + pc.planetInfo.factories; planetGUI.transform.FindChild("Refinery num").GetComponent <Text>().text = "" + pc.planetInfo.refineries; planetGUI.transform.FindChild("habitable").GetComponent <Toggle>().isOn = pc.planetInfo.habitable; } }
public StarSystemController OpenStarSystem(StarInfo star) { if (star == null) { throw new ArgumentNullException(nameof(star)); } var game = this.gameInstance; if (!game.States.Stars.Contains(star.Data)) #pragma warning disable CA1303 // Do not pass literals as localized parameters { throw new ArgumentException("Star doesn't exist"); } #pragma warning restore CA1303 // Do not pass literals as localized parameters return(new StarSystemController(game, star.Data, game.IsReadOnly, this)); }
List <string[]> starList = new List <string[]>(); // The list of String arrays containing info for each star // Use this for initialization void Start() { StarData s = new StarData(); starList = s.getStarList(); // Sets the starList to the one obtained from reading the database StarInfo k = new StarInfo(); for (int i = 0; i < starList.Count; i++) { string properName = starList[i][0]; //Name to be displayed (Not yet implemented) double magnitude = k.Magntitude(starList[i][1]); //Not yet used but is the visibility of star in sky double angle = k.ConvertAngle(starList[i][2], starList[i][3]); //Gets vertical angle at which to spawn the star in deg double azimuth = k.ConvertAzimuth(starList[i][2], starList[i][3]); //Gets azimuth (horizontal position) at which to spawn star in deg Debug.Log("Name" + properName); Debug.Log("angle:" + angle); Debug.Log("azimth:" + azimuth); Debug.Log("Mag:" + magnitude); //Spawn sphere to use as star GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere); //Set name sphere.name = properName; //Sets distance from origin/ camera position sphere.transform.position = new Vector3(6f, 1.5f, 100f); //Sets size sphere.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); // Sets the vertical position sphere.transform.RotateAround(Vector3.zero, Vector3.right, Convert.ToSingle(angle)); // Sets the horizontal position sphere.transform.RotateAround(Vector3.zero, Vector3.up, Convert.ToSingle(azimuth)); } }
/// <summary> /// Initializes a new instance of the <see cref="Star"/> class. /// </summary> /// <param name="obj">Original Star object.</param> public Star(StarInfo obj) { starInfo = obj; planets = new List<Planet>(); }
/// <summary> /// Default constructor for Star object. /// Information data should be initialized before /// spawning the object. Defult constructor only /// creates an empty instance of the object. /// </summary> public Star() { starInfo = new StarInfo(); planets = new List<Planet>(); }