public MapSector(int x, int y) { sx = x; sy = y; for (int i = 0; i <= dimS*dimS*dimH - 1; i++) { N[i] = new MNode {BlockID = 0}; } bounding = new BoundingBox(new Vector3(0 + sx*dimS, 0 + sy*dimS, -0), new Vector3(15 + sx*dimS, 15 + sy*dimS, -1)); }
public NodeViewModel(MegaSDK megaSdk, MNode baseNode) { this._megaSdk = megaSdk; this._baseNode = baseNode; this.Name = baseNode.getName(); this.Size = baseNode.getSize(); this.CreationTime = ConvertDateToString(_baseNode.getCreationTime()).ToString("dd MMM yyyy"); this.ModificationTime = ConvertDateToString(_baseNode.getModificationTime()).ToString("dd MMM yyyy"); this.SizeAndSuffix = Size.ToStringAndSuffix(); this.Type = baseNode.getType(); this.NumberOfFiles = this.Type != MNodeType.TYPE_FOLDER ? null : String.Format("{0} {1}", this._megaSdk.getNumChildren(this._baseNode), UiResources.Files); if (this.Type == MNodeType.TYPE_FOLDER || this.Type == MNodeType.TYPE_FILE) this.ThumbnailImageUri = new Uri((String)new FileTypeToImageConverter().Convert(this, null, null, null), UriKind.Relative); }
/// <summary> /// Insert a node in the database. /// </summary> /// <param name="megaNode">Node to insert.</param> public static void InsertNode(MNode megaNode) { var offlineNodePath = OfflineService.GetOfflineNodePath(megaNode); var parentNode = SdkService.MegaSdk.getParentNode(megaNode); var sfoNode = new SavedForOfflineDB() { Fingerprint = SdkService.MegaSdk.getNodeFingerprint(megaNode), Base64Handle = megaNode.getBase64Handle(), LocalPath = offlineNodePath, ParentBase64Handle = parentNode != null? parentNode.getBase64Handle() : string.Empty }; InsertItem(sfoNode); }
protected override void Dequeue() { if (spawner.HasCustomersToSpawn()) { Debug.Log("dequeue"); //dequeue the queue in the spawner CustomerController controller = spawner.Dequeue(); if (!controller) { return; } positionNode = ParentObject(controller.gameObject); controller.InvokeSpecialMoveCompleteEvent(positionNode); } }
/// <summary> /// Insert a node in the database. /// </summary> /// <param name="megaNode">Node to insert.</param> /// <param name="isSelectedForOffline">Indicate if is specifically selected for offline.</param> public static void Insert(MNode megaNode, bool isSelectedForOffline = false) { var nodeOfflineLocalPath = Path.Combine(ApplicationData.Current.LocalFolder.Path, AppResources.DownloadsDirectory, SdkService.MegaSdk.getNodePath(megaNode).Remove(0, 1).Replace("/", "\\")); var sfoNode = new SavedForOffline() { Fingerprint = SdkService.MegaSdk.getNodeFingerprint(megaNode), Base64Handle = megaNode.getBase64Handle(), LocalPath = nodeOfflineLocalPath, ParentBase64Handle = (SdkService.MegaSdk.getParentNode(megaNode)).getBase64Handle(), IsSelectedForOffline = isSelectedForOffline }; Insert(sfoNode); }
// implementation of Held-Karp Algorithm public string[] fancySolveProblem() { string[] results = new string[3]; Stopwatch timer = new Stopwatch(); timer.Start(); initialBSSF = true; greedySolveProblem(); solutionFound = false; int n = Cities.Length; distance = new Double[n, n]; var set = new HashSet <int>(); heldKarpPath = new int[n]; memoize = new Dictionary <MNode, double> [n]; prev = new Dictionary <MNode, int> [n]; currentBssf = double.MaxValue; for (int i = 0; i < n; i++) { set.Add(i); for (int j = 0; j < n; j++) { if (i == j) { distance[i, j] = Double.PositiveInfinity; } else { distance[i, j] = Cities[i].costToGetTo(Cities[j]); } } } set.Remove(0); double cost = GetMinimumCostRoute(n); MNode node = new MNode { Vertex = 0, citySet = set }; timer.Stop(); results[COST] = bssf.costOfRoute().ToString(); // load results into array here, replacing these dummy values results[TIME] = timer.Elapsed.ToString(); results[COUNT] = "1"; return(results); }
public void onTransferStart(MegaSDK api, MTransfer transfer) { TransferObjectModel megaTransfer = null; if (transfer.getType() == MTransferType.TYPE_DOWNLOAD) { // If is a public node MNode node = transfer.getPublicMegaNode(); if (node == null) // If not { node = api.getNodeByHandle(transfer.getNodeHandle()); } if (node != null) { megaTransfer = new TransferObjectModel(api, NodeService.CreateNew(api, App.AppInformation, node, ContainerType.CloudDrive), TransferType.Download, transfer.getPath()); } } else { megaTransfer = new TransferObjectModel(api, App.MainPageViewModel.CloudDrive.FolderRootNode, TransferType.Upload, transfer.getPath()); } if (megaTransfer != null) { Deployment.Current.Dispatcher.BeginInvoke(() => { TransfersService.GetTransferAppData(transfer, megaTransfer); megaTransfer.Transfer = transfer; megaTransfer.Status = TransferStatus.Queued; megaTransfer.CancelButtonState = true; megaTransfer.TransferButtonIcon = new Uri("/Assets/Images/cancel transfers.Screen-WXGA.png", UriKind.Relative); megaTransfer.TransferButtonForegroundColor = new SolidColorBrush(Colors.White); megaTransfer.IsBusy = true; megaTransfer.TotalBytes = transfer.getTotalBytes(); megaTransfer.TransferedBytes = transfer.getTransferredBytes(); megaTransfer.TransferSpeed = transfer.getSpeed().ToStringAndSuffixPerSecond(); App.MegaTransfers.Add(megaTransfer); Transfers.Add(megaTransfer); }); } }
public NodeViewModel(MegaSDK megaSdk, MNode baseNode) { this._megaSdk = megaSdk; this._baseNode = baseNode; this.Name = baseNode.getName(); this.Size = baseNode.getSize(); this.CreationTime = ConvertDateToString(_baseNode.getCreationTime()).ToString("dd MMM yyyy"); this.ModificationTime = ConvertDateToString(_baseNode.getModificationTime()).ToString("dd MMM yyyy"); this.SizeAndSuffix = Size.ToStringAndSuffix(); this.Type = baseNode.getType(); this.NumberOfFiles = this.Type != MNodeType.TYPE_FOLDER ? null : String.Format("{0} {1}", this._megaSdk.getNumChildren(this._baseNode), UiResources.Files); if (this.Type == MNodeType.TYPE_FOLDER || this.Type == MNodeType.TYPE_FILE) { this.ThumbnailImageUri = new Uri((String) new FileTypeToImageConverter().Convert(this, null, null, null), UriKind.Relative); } }
void TakeRobotTurn() { MNode best = returnBestMove(); if (isValidMove(best.x, best.y)) { BoardCells [GetCellID(best.x, best.y)].sprite = GS.Inst.OppProp; best.player = 2; grid[best.x, best.y] = best; } if (isGameOver()) { UpdateStatus(); Invoke("StartNewGame", 2); } }
private void KnnNodeSearch( MNode <int> node, T queryObject, BoundablePriorityList <MNodeEntry <int>, double> nearestNeighboorList, BoundablePriorityList <MNode <int>, double> priorityQueue) { foreach (var entry in node.Entries) { var maxPriority = nearestNeighboorList.MaxPriority; if (node.IsInternalNode) { if ((node.ParentEntry == null) || (Math.Abs( this.Metric(this.internalArray[node.ParentEntry.Value], queryObject) - entry.DistanceFromParent) <= entry.CoveringRadius + maxPriority)) { var distanceFromQueryObject = this.Metric(this.internalArray[entry.Value], queryObject); var dMin = Math.Max(distanceFromQueryObject - entry.CoveringRadius, 0); if (dMin < maxPriority) { priorityQueue.Add(entry.ChildNode, dMin); var dMax = distanceFromQueryObject + entry.CoveringRadius; if (dMax < maxPriority) { nearestNeighboorList.Add(null, dMax); maxPriority = Math.Max(dMax, maxPriority); priorityQueue.RemoveAllPriorities(p => p > maxPriority); } } } } else if (Math.Abs(this.Metric(this.internalArray[node.ParentEntry.Value], queryObject) - entry.DistanceFromParent) < maxPriority) { var distanceFromQueryObject = this.Metric(this.internalArray[entry.Value], queryObject); if (distanceFromQueryObject < maxPriority) { nearestNeighboorList.Add(entry, distanceFromQueryObject); nearestNeighboorList.RemoveAllElements(e => e == null); maxPriority = Math.Max(distanceFromQueryObject, maxPriority); priorityQueue.RemoveAllPriorities(p => p > maxPriority); } } } }
private void RadialSearch(MNode <int> node, T ballCenter, double ballRadius, ICollection <int> results) { if (node == this.Root) // node is the root { foreach (var entry in node.Entries) { this.RadialSearch(entry.ChildNode, ballCenter, ballRadius, results); } } else { var distanceParentToCenter = this.Metric(this.internalArray[node.ParentEntry.Value], ballCenter); if (node.IsInternalNode) { foreach (var entry in node.Entries) { var combinedRadius = entry.CoveringRadius + ballRadius; var test = Math.Abs(distanceParentToCenter - entry.DistanceFromParent); if (test <= combinedRadius) { var distanceCurrentToCenter = this.Metric(this.internalArray[entry.Value], ballCenter); if (distanceCurrentToCenter <= combinedRadius) { this.RadialSearch(entry.ChildNode, ballCenter, ballRadius, results); } } } } else { foreach (var entry in node.Entries) { var test = Math.Abs(distanceParentToCenter - entry.DistanceFromParent); if (test <= ballRadius) { var distanceCurrentToCenter = this.Metric(this.internalArray[entry.Value], ballCenter); if (distanceCurrentToCenter <= ballRadius) { results.Add(entry.Value); } } } } } }
/// <summary> /// Import the node from its current location to a new folder destination /// </summary> /// <param name="newParentNode">The root node of the destination folder</param> /// <returns>Result of the action</returns> public async Task <NodeActionResult> ImportAsync(MNode newParentNode) { // User must be online to perform this operation if ((this.Parent?.Type != ContainerType.FolderLink) && !await IsUserOnlineAsync()) { return(NodeActionResult.NotOnline); } var copyNode = new CopyNodeRequestListenerAsync(); var result = await copyNode.ExecuteAsync(() => { SdkService.MegaSdk.copyNode( SdkService.MegaSdkFolderLinks.authorizeNode(OriginalMNode), newParentNode, copyNode); }); return(result ? NodeActionResult.Succeeded : NodeActionResult.Failed); }
public override void BrowseToHome() { if (this.FolderRootNode == null) { return; } MNode homeNode = NodeService.FindCameraUploadNode(this.MegaSdk, this.MegaSdk.getRootNode()); if (homeNode == null) { return; } this.FolderRootNode = NodeService.CreateNew(this.MegaSdk, this.AppInformation, homeNode, _containerType, ChildNodes); LoadChildNodes(); }
/// <summary> /// Get the account used space by the incoming shared folders /// </summary> /// <returns>Used space by the incoming shared folders</returns> private static ulong GetIncomingSharesUsedSpace() { MNodeList inSharesList = SdkService.MegaSdk.getInShares(); int inSharesListSize = inSharesList.size(); ulong inSharesUsedSpace = 0; for (int i = 0; i < inSharesListSize; i++) { MNode inShare = inSharesList.get(i); if (inShare != null) { inSharesUsedSpace += SdkService.MegaSdk.getSize(inShare); } } return(inSharesUsedSpace); }
private void CheckAndUpdateSFO(MNode megaNode) { this.IsAvailableOffline = false; this.IsSelectedForOffline = false; var nodePath = SdkService.MegaSdk.getNodePath(megaNode); if (String.IsNullOrWhiteSpace(nodePath)) { return; } var nodeOfflineLocalPath = Path.Combine(ApplicationData.Current.LocalFolder.Path, AppResources.DownloadsDirectory, nodePath.Remove(0, 1).Replace("/", "\\")); if (SavedForOffline.ExistsNodeByLocalPath(nodeOfflineLocalPath)) { var existingNode = SavedForOffline.ReadNodeByLocalPath(nodeOfflineLocalPath); if ((megaNode.getType() == MNodeType.TYPE_FILE && FileService.FileExists(nodeOfflineLocalPath)) || (megaNode.getType() == MNodeType.TYPE_FOLDER && FolderService.FolderExists(nodeOfflineLocalPath))) { this.IsAvailableOffline = true; this.IsSelectedForOffline = existingNode.IsSelectedForOffline; } else { SavedForOffline.DeleteNodeByLocalPath(nodeOfflineLocalPath); } } else { if (megaNode.getType() == MNodeType.TYPE_FILE && FileService.FileExists(nodeOfflineLocalPath)) { SavedForOffline.Insert(megaNode, true); this.IsAvailableOffline = this.IsSelectedForOffline = true; } else if (megaNode.getType() == MNodeType.TYPE_FOLDER && FolderService.FolderExists(nodeOfflineLocalPath)) { SavedForOffline.Insert(megaNode); this.IsAvailableOffline = true; this.IsSelectedForOffline = false; } } }
public async Task RemoveForOffline() { MNode parentNode = App.MegaSdk.getParentNode(this.OriginalMNode); String parentNodePath = Path.Combine(ApplicationData.Current.LocalFolder.Path, AppResources.DownloadsDirectory.Replace("\\", ""), (App.MegaSdk.getNodePath(parentNode)).Remove(0, 1).Replace("/", "\\")); String sfoRootPath = Path.Combine(ApplicationData.Current.LocalFolder.Path, AppResources.DownloadsDirectory.Replace("\\", "")); var nodePath = Path.Combine(parentNodePath, this.Name); if (this.IsFolder) { await RecursiveRemoveForOffline(parentNodePath, this.Name); FolderService.DeleteFolder(nodePath, true); } else { // Search if the file has a pending transfer for offline and cancel it on this case TransfersService.CancelPendingNodeOfflineTransfers(nodePath, this.IsFolder); FileService.DeleteFile(nodePath); } SavedForOffline.DeleteNodeByLocalPath(nodePath); this.IsAvailableOffline = this.IsSelectedForOffline = false; // Check if the previous folders of the path are empty and // remove from the offline and the DB on this case while (String.Compare(parentNodePath, sfoRootPath) != 0) { var folderPathToRemove = parentNodePath; parentNodePath = ((new DirectoryInfo(parentNodePath)).Parent).FullName; if (FolderService.IsEmptyFolder(folderPathToRemove)) { FolderService.DeleteFolder(folderPathToRemove); SavedForOffline.DeleteNodeByLocalPath(folderPathToRemove); } } }
public void KillBlock(int x, int y, int z) { MNode with = At(x, y, z); if (Main.dbobject.Data[with.BlockID].Dropafterdeath != 666) { Main.localitems.n.Add(new LocalItem { count = Main.dbobject.Data[At(x, y, z).BlockID].DropafterdeathNum, id = Main.dbobject.Data[with.BlockID].Dropafterdeath, pos = new Vector3(x, y, z) }); } //Main.iss.AddItem(Main.dbobject.Data[n[x, y, z].blockID].dropafterdeath, // Main.dbobject.Data[n[x, y, z].blockID].dropafterdeath_num); with.BlockID = 0; with.Health = 10; for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { if (GoodVector3(x + i, y + j, z)) { At(x + i, y + j, z).Explored = true; } } } if (GoodVector3(x, y, z + 1)) { At(x, y, z + 1).Explored = true; } if (with.BlockID == KnownIDs.StorageEntrance) { Main.globalstorage.n.Remove(new Vector3(x, y, z)); } SubterrainPersonaly(new Vector3(x, y, z)); N[x / MapSector.dimS * Sectn + y / MapSector.dimS].builded = false; }
List <MNode> getMoves() { List <MNode> result = new List <MNode>(); for (int row = 0; row < 3; row++) { for (int col = 0; col < 3; col++) { if (gameBoard[row, col] == null) { MNode newNode = new MNode(); newNode.x = row; newNode.y = col; result.Add(newNode); } } } return(result); }
private static void addToken(int tokenType) { string data = automata.getString(lastStart, automata.getIndex() - lastStart); MeanCS.verbosen("NEW TOKEN: ").print(data).print("\n"); MNode token = new MNode(currentExpr, tokenType, data); if (currentToken == null) { currentExpr.child = token; } else { currentToken.next = token; } currentExpr.numChildren++; currentToken = token; lastStart = automata.getIndex(); }
List <MNode> listAvailableMoves(int[,] currGameState) { List <MNode> result = new List <MNode> (); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { if (currGameState [i, j] == 0) { MNode temp = new MNode(); temp.x = i; temp.y = j; result.Add(temp); } } } return(result); }
/// <summary> /// Move the node from its current location to a new folder destination /// </summary> /// <param name="newParentNode">The new destination folder</param> /// <returns>Result of the action</returns> public async Task <NodeActionResult> MoveAsync(MNode newParentNode) { // User must be online to perform this operation if (!await IsUserOnlineAsync()) { return(NodeActionResult.NotOnline); } if (MegaSdk.checkMove(OriginalMNode, newParentNode).getErrorCode() != MErrorType.API_OK) { return(NodeActionResult.Failed); } var moveNode = new MoveNodeRequestListenerAsync(); var result = await moveNode.ExecuteAsync(() => MegaSdk.moveNode(OriginalMNode, newParentNode, moveNode)); return(result ? NodeActionResult.Succeeded : NodeActionResult.Failed); }
//returns a list of MNodes, each MNode being a position that is empty and available List <MNode> getMoves() { List <MNode> result = new List <MNode>(); for (int row = 0; row < 3; row++) { for (int col = 0; col < 3; col++) { if (grid[row, col] == null) { MNode newNode = new MNode(); newNode.x = row; newNode.y = col; result.Add(newNode); //if the space is empty, add it to the list of results } } } return(result); }
/// <summary> /// Method to import the content of a recently created node folder during /// the process to import a folder link. /// </summary> /// <param name="nodeToImport">Node folder to import.</param> /// <param name="parentNode">Parent folder of the node to import.</param> private void ImportNodeContents(MNode nodeToImport, MNode parentNode) { // Obtain the child nodes and the number of them. var childNodes = App.MegaSdkFolderLinks.getChildren(nodeToImport); var childNodesSize = childNodes.size(); // Explore the child nodes. Store the folders in a new list and add them to // the corresponding dictionary. Copy the file nodes. List <MNode> folderNodesToImport = new List <MNode>(); for (int i = 0; i < childNodesSize; i++) { var node = childNodes.get(i); if (node.isFolder()) { folderNodesToImport.Add(node); if (!App.LinkInformation.FolderPaths.ContainsKey(node.getBase64Handle())) { App.LinkInformation.FolderPaths.Add(node.getBase64Handle(), App.MegaSdkFolderLinks.getNodePath(node)); } } else { App.MegaSdk.copyNode(node, parentNode, new CopyNodeRequestListener(true)); } } // Add the list with the new folder nodes to import to the corresponding dictionary. if (!App.LinkInformation.FoldersToImport.ContainsKey(parentNode.getBase64Handle())) { App.LinkInformation.FoldersToImport.Add(parentNode.getBase64Handle(), folderNodesToImport); } // Create all the new folder nodes. foreach (var node in folderNodesToImport) { App.MegaSdk.createFolder(node.getName(), parentNode, new CreateFolderRequestListener(true)); } }
/// <summary> /// Update core data associated with the SDK MNode object /// </summary> /// <param name="megaNode">Node to update</param> /// <param name="externalUpdate">Indicates if is an update external to the app. For example from an `onNodesUpdate`</param> public override async void Update(MNode megaNode, bool externalUpdate = false) { base.Update(megaNode, externalUpdate); var owner = SdkService.MegaSdk.getUserFromInShare(megaNode); var contactAttributeRequestListener = new GetUserAttributeRequestListenerAsync(); var firstName = await contactAttributeRequestListener.ExecuteAsync(() => SdkService.MegaSdk.getUserAttribute(owner, (int)MUserAttrType.USER_ATTR_FIRSTNAME, contactAttributeRequestListener)); var lastName = await contactAttributeRequestListener.ExecuteAsync(() => SdkService.MegaSdk.getUserAttribute(owner, (int)MUserAttrType.USER_ATTR_LASTNAME, contactAttributeRequestListener)); OnUiThread(() => { this.Owner = string.IsNullOrWhiteSpace(firstName) && string.IsNullOrWhiteSpace(lastName) ? owner.getEmail() : string.Format("{0} {1}", firstName, lastName); }); }
public void InvokeMoveCompleteEvent() { positionNode = GameManager.Instance.RefreshNodeParent(player); OnMoveComplete?.Invoke(positionNode); //at the front of the queue is the destination where the player is currently in //DequeuePath(); temorarily commented out //if there is no more destination queued, return if (path.Count == 0) { return; } //if there is still destination queued, peek at the destination which is now at the front Transform nextDestination = DequeuePath(); //go to the next path in the queue if there is a destination queued TransportPlayer(nextDestination); }
public FolderNodeViewModel(MegaSDK megaSdk, AppInformation appInformation, MNode megaNode, ContainerType parentContainerType, ObservableCollection <IMegaNode> parentCollection = null, ObservableCollection <IMegaNode> childCollection = null) : base(megaSdk, appInformation, megaNode, parentContainerType, parentCollection, childCollection) { SetFolderInfo(); this.IsDefaultImage = true; this.DefaultImagePathData = VisualResources.FolderTypePath_default; if (megaSdk.isShared(megaNode)) { this.DefaultImagePathData = VisualResources.FolderTypePath_shared; } if (!megaNode.getName().ToLower().Equals("camera uploads")) { return; } this.DefaultImagePathData = VisualResources.FolderTypePath_photo; }
public override bool GoFolderUp() { if (this.FolderRootNode == null) { return(false); } MNode parentNode = this.MegaSdk.getParentNode(this.FolderRootNode.OriginalMNode); if (parentNode == null || parentNode.getType() == MNodeType.TYPE_UNKNOWN || parentNode.getType() == MNodeType.TYPE_ROOT) { return(false); } this.FolderRootNode = NodeService.CreateNew(this.MegaSdk, this.AppInformation, parentNode, _containerType, ChildNodes); LoadChildNodes(); return(true); }
public static MNode FindCameraUploadNode(MegaSDK megaSdk, MNode rootNode) { var childs = megaSdk.getChildren(rootNode); for (int x = 0; x < childs.size(); x++) { var node = childs.get(x); if (node.getType() != MNodeType.TYPE_FOLDER) { continue; } if (!node.getName().ToLower().Equals("camera uploads")) { continue; } return(node); } return(null); }
private static void addBlock() { byte inputByte = automata.getInputByte(); int blockType = 0; if (inputByte == '(') { blockType = NODE_PARENTHESIS; } else if (inputByte == '[') { blockType = NODE_SQUARE_BRACKETS; } else if (inputByte == '{') { blockType = NODE_CURLY_BRACKETS; } else { MeanCS.assertion(false, null, "unhandled block start: " + inputByte); } lastStart = -1; MNode block = new MNode(currentExpr, blockType, "<BLOCK>"); if (currentToken == null) { currentExpr.child = block; } else { currentToken.next = block; } currentExpr.numChildren++; currentBlock = block; MNode expr = new MNode(currentBlock, 0, "<EXPR>"); currentBlock.child = expr; currentExpr = expr; currentToken = null; }
/// <summary> /// Locate the Camera Uploads folder node in the specified root /// </summary> /// <param name="rootNode">Current root node</param> /// <returns>Camera Uploads folder node in</returns> private MNode FindCameraUploadNode(MNode rootNode) { var childs = SdkService.MegaSdk.getChildren(rootNode); for (int x = 0; x < childs.size(); x++) { var node = childs.get(x); // Camera Uploads is a folder if (node.getType() != MNodeType.TYPE_FOLDER) { continue; } // Check the folder name if (!node.getName().ToLower().Equals("camera uploads")) { continue; } return(node); } return(null); }
public async Task CreateRootNodeIfNotExists() { MNode cameraUploadsNode = NodeService.FindCameraUploadNode(this.MegaSdk, this.MegaSdk.getRootNode()); if (cameraUploadsNode != null) { return; } var tcs = new TaskCompletionSource <bool>(); var createFolderListener = new CreateCameraUploadsRequestListener(); createFolderListener.RequestFinished += (sender, args) => { tcs.TrySetResult(args.Succeeded); }; MegaSdk.createFolder("Camera Uploads", this.MegaSdk.getRootNode(), createFolderListener); await tcs.Task; }
private void CheckForEndState(MNode node) { if (CheckPlayerPositionRequirements(node, out float ticketValue)) { bool end = TransferItem(); float _ticketValue = playerNode.GetTicketValue(); if (end || _ticketValue != 0) { //update customer satisfaction float grade = patience.ResetPatience(); satisfaction.ComputeSatisfaction(grade, ticketValue); float index = satisfaction.ComputeSatisfaction(-1, _ticketValue); float payment = satisfaction.ComputePayment(); PerformStateProcesses(index, payment); renderer.enabled = false; UnsubscribeEvents(); animator.SetTrigger("MoveState"); } } }
public virtual void initialize(System.String baseDir, System.String configFile) { wp = new WPhead[5000]; for (int i = 0; i < 5000; i++) { wp[i] = new WPhead(this); } wp_end = 1; mn = new MNode[10000]; for (int i = 0; i < 10000; i++) { mn[i] = new MNode(this); } mn_end = 1; JSONReader json = new JSONReader(configFile); PWT_POS_TDBM_FILE = baseDir + "/" + json.getValue("pwt.pos"); PTT_POS_TDBM_FILE = baseDir + "/" + json.getValue("ptt.pos"); PTT_WP_TDBM_FILE = baseDir + "/" + json.getValue("ptt.wp"); pwt_pos_tf = new ProbabilityDBM(PWT_POS_TDBM_FILE); ptt_wp_tf = new ProbabilityDBM(PTT_WP_TDBM_FILE); ptt_pos_tf = new ProbabilityDBM(PTT_POS_TDBM_FILE); }