private static EscortSaveData GetEscortSaveData(IMyEntity escort, NpcGroupSaveData npcGroupSaveData) { foreach (var escortSaveData in npcGroupSaveData.Escorts) { if (escortSaveData.EscortEntityId == escort.EntityId) { return(escortSaveData); } } throw new ArgumentException("Can't find escort save data: " + escort.EntityId); }
internal NpcGroupSaveData GetSaveData() { var saveData = new NpcGroupSaveData { LeaderUnitType = GetLeaderUnitType(), GroupId = GroupLeaderId, Escorts = GetEscortSaveData(), State = GroupState, GroupDestination = Destination, NpcGroupType = groupType, SpawnTime = GroupSpawnTime.ToBinary() }; return(saveData); }
internal void ReConnectEscort(IMyCubeGrid escort, NpcGroupSaveData npcGroupSaveData) { var escortSaveData = GetEscortSaveData(escort, npcGroupSaveData); escortDic.Add(escortSaveData.EscortPosition, escort); }