Ejemplo n.º 1
0
 /** Performs Swap actions if player clicks on SwapCube.
  *  Gets called by OnSwapClick() in MK_SwapHandler
  *
  *  @param sender
  *  @param args has target for teleportation
  */
 private void OnSwapClick(object sender, SwapEventArgs args)
 {
     if (args.target.tag == "SwapCube" && _swapCooldown == 0)
     {
         swapping = true;
         args.target.GetComponent <SwapCubeAction>().performAction(transform);
         _swapCooldown = swapCooldown;
     }
 }
Ejemplo n.º 2
0
 /** Raycast object detection.
  *  ray from camera direction.
  *  object saved in SwapEventArgs.
  */
 void Update() {
     if (Input.GetMouseButtonDown(0) && !MK_MenuControl.paused){
         Ray raycast = new Ray(transform.position, /*Camera direction*/transform.GetChild(0).forward);
         RaycastHit hit;
         bool bHit = Physics.Raycast(raycast, out hit);
         if (bHit) { 
             SwapEventArgs args = new SwapEventArgs();
             args.target = hit.transform;
             OnSwapClick(args);
         }
     }       
 }
Ejemplo n.º 3
0
 private async void OnSwapReceivedEventHandler(object sender, SwapEventArgs args)
 {
     try
     {
         await SwapManager
         .HandleSwapAsync(args.Swap)
         .ConfigureAwait(false);
     }
     catch (Exception e)
     {
         OnError(TerminalService.Exchange, e);
     }
 }
Ejemplo n.º 4
0
 private void HandleSwap(object sender, SwapEventArgs e)
 {
     model.FindMatch();
 }
Ejemplo n.º 5
0
 /** Event which can be used in other classes.
  *  
  *  @param e Has Teleport target. 
  */
 public virtual void OnSwapClick(SwapEventArgs e) {
     if (SwapClick != null) { SwapClick(this, e); }
 }