Possible
How do I use Possible
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: PhotonNetwork.cs
Copy
2479 internal static void RPC(PhotonView view, string methodName, PhotonTargets target, bool encrypt, params object[] parameters)
2480 {
2481 if (!VerifyCanUseNetwork())
2482 {
2483 return;
2484 }
2485
2486 if (room == null)
2487 {
2488 Debug.LogWarning("Cannot send RPCs in Lobby! RPC dropped.");
2489 return;
2490 }
2491
2492 if (networkingPeer != null)
2493 {
2494 networkingPeer.RPC(view, methodName, target, encrypt, parameters);
2495 }
2496 else
2497 {
2498 Debug.LogWarning("Could not execute RPC " + methodName + ". Possible scene loading in progress?");
2499 }
2500 }
File name: PhotonNetwork.cs
Copy
2505 internal static void RPC(PhotonView view, string methodName, PhotonPlayer targetPlayer, bool encrpyt, params object[] parameters)
2506 {
2507 if (!VerifyCanUseNetwork())
2508 {
2509 return;
2510 }
2511
2512 if (room == null)
2513 {
2514 Debug.LogWarning("Cannot send RPCs in Lobby, only processed locally");
2515 return;
2516 }
2517
2518 if (player == null)
2519 {
2520 Debug.LogError("Error; Sending RPC to player null! Aborted \"" + methodName + "\"");
2521 }
2522
2523 if (networkingPeer != null)
2524 {
2525 networkingPeer.RPC(view, methodName, targetPlayer, encrpyt, parameters);
2526 }
2527 else
2528 {
2529 Debug.LogWarning("Could not execute RPC " + methodName + ". Possible scene loading in progress?");
2530 }
2531 }
File name: VSCode.cs
Copy
403 static string AutodetectCodePath()
404 {
405 string[] possiblePaths =
406#if UNITY_EDITOR_OSX
407 {
408 "/Applications/Visual Studio Code.app",
409 "/Applications/Visual Studio Code - Insiders.app"
410 };
411#elif UNITY_EDITOR_WIN
412 {
413 ProgramFilesx86() + Path.DirectorySeparatorChar + "Microsoft VS Code"
414 + Path.DirectorySeparatorChar + "bin" + Path.DirectorySeparatorChar + "code.cmd",
415 ProgramFilesx86() + Path.DirectorySeparatorChar + "Microsoft VS Code Insiders"
416 + Path.DirectorySeparatorChar + "bin" + Path.DirectorySeparatorChar + "code-insiders.cmd"
417 };
418#else
419 {
420 "/usr/bin/code",
421 "/bin/code",
422 "/usr/local/bin/code"
423 };
424#endif
425 for(int i = 0; i < possiblePaths.Length; i++)
426 {
427 if(VSCodeExists(possiblePaths[i]))
428 {
429 return possiblePaths[i];
430 }
431 }
432 PrintNotFound(possiblePaths[0]);
433 return possiblePaths[0]; //returns the default one, printing a warning message 'executable not found'
434 }
File name: Movement.cs
Copy
25 public Movement(GCPlayer player, Piece piece) {
26 this.player = player;
27 this.piece = piece;
28 BoundComputations += ClearPossibles;
29 }
File name: Movement.cs
Copy
49 public void ClearPossibles() {
50 piece.ClearPossibleEats();
51 piece.ClearPossibleMoves();
52 }
File name: Movement.cs
Copy
54 public bool ComputeMovePiece(Node toCheckNode) {
55 if (toCheckNode == null) return false;
56 if (toCheckNode.EmptySpace) {
57 piece.AddPossibleMoves(toCheckNode);
58 return true;
59 }
60
61 return false;
62 }
File name: Movement.cs
Copy
74 public bool ComputeMoveOrEatPiece(Node toCheckNode) {
75 if (toCheckNode == null) return false;
76 if (toCheckNode.EmptySpace) {
77 piece.AddPossibleMoves(toCheckNode);
78 return true;
79 } else if (Rules.IsEnemy(piece, toCheckNode.Piece)) {
80 AddToCheckOrEat(toCheckNode);
81 return true;
82 }
83
84 return false;
85 }
File name: Movement.cs
Copy
93 public bool ComputeMoveOrEatPieceEnemyAlly(Node toCheckNode) {
94 if (toCheckNode == null) return false;
95 if (toCheckNode.EmptySpace) {
96 piece.AddPossibleMoves(toCheckNode);
97 } else if (Rules.IsEnemy(piece, toCheckNode.Piece)) {
98 AddToCheckOrEat(toCheckNode);
99 if (toCheckNode != toCheckNode.Piece.Node) {
100 return false;
101 } else {
102 return true;
103 }
104 } else {
105 return true;
106 }
107
108 return false;
109 }
File name: Movement.cs
Copy
111 private void AddToCheckOrEat(Node toCheckNode) {
112 if (Rules.CheckKing(player, piece.Node, toCheckNode)) {
113 //playerPiece.Check = toCheckPiece;
114 } else {
115 piece.AddPossibleEats(toCheckNode);
116 }
117 }
Possible 138 lượt xem
Gõ tìm kiếm nhanh...