// 星座データの収集 ConstellationData CollectConstellationData(ConstellationNameData name) { var data = new ConstellationData(); // 星座の名前登録 data.Name = name; // 星座IDが同じものを登録 data.Position = constellationPositionData.FirstOrDefault(s => name.Id == s.Id); // 星座の略称が同じものを登録 data.Lines = constellationLineData.Where(s => name.Summary == s.Name).ToList(); // 星座線が使用している星を登録 data.Stars = new List <StarData>(); foreach (var line in data.Lines) { var start = starData.FirstOrDefault(s => s.Hip == line.StartHip); data.Stars.Add(start); var end = starData.FirstOrDefault(s => s.Hip == line.EndHip); data.Stars.Add(end); // 星座で使用される星 start.UseConstellation = end.UseConstellation = true; } return(data); }
ConstellationNode NodeForConstellation(ConstellationData constellation) { foreach (var node in constellationNodes) { if (node.linkedConstellation == constellation) { return(node); } } throw new Exception("The constellation " + constellation.name + " was not found in the galaxy."); }
public void Awake() { try { if (ConstellationData == null && Application.isPlaying) { ConstellationData = ScriptableObject.CreateInstance <ConstellationScript>(); ConstellationData.InitializeData(); ConstellationData.IsInstance = true; } Initialize(); } catch (ConstellationError e) { Debug.LogError(e.GetError().GetFormatedError()); } }
// 星座データの整理 void ArrangementData() { // 星データを統合 MergeStarData(); constellationData = new List <ConstellationData>(); // 星座名から星座に必要なダータを収集 foreach (var name in constellationNameData) { constellationData.Add(CollectConstellationData(name)); } // 星座に使われていない星の収集 var data = new ConstellationData(); data.Stars = starData.Where(s => s.UseConstellation == false).ToList(); constellationData.Add(data); }
void LoadConstellations() { constellationNames = new string[constNum]; constellationsData = new ConstellationData[constNum]; for (int i = 0; i < constNum; i++) { ConstellationData cd = new ConstellationData(); constellationsData[i] = cd; constellationNames[i] = constellations[i].name; string cmanagerStr = constellationNames[i] + constellationManagerEndString; string ctrophStr = constellationNames[i] + constellationTrophyEndString; constellationsData[i].name = constellationNames[i]; constellationsData[i].isCompleted = false; constellationsData[i].hasRegisteredCompleted = false; constellationsData[i].completedAsSelected = false; constellationsData[i].gameConstellation = GameObject.Find(cmanagerStr).GetComponent <ConstellationManager>(); constellationsData[i].viewConstellation = constellations[i]; constellationsData[i].trophy = GameObject.Find(ctrophStr); constellationsData[i].difficulty = GameObject.Find(cmanagerStr).GetComponent <ConstellationManager>().constellation.difficulty; constellationsData[i].constellationScore = gm.GetDifficultyScore(constellationsData[i].difficulty); } }
public void ShowConstellation(ConstellationData constellation) { focusNode = NodeForConstellation(constellation); starPath.starSlot = focusNode.transform; focusObject = focusNode.gameObject; }