Advertisement
nlbi21

TileClickeable - Unity - Grid Pathfiding (Español)

Dec 9th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class TileClickeable : MonoBehaviour {
  6.    
  7.     // Creamos 2 variables para los valores de (x,y) del tile.
  8.     public int tileX;
  9.     public int tileY;
  10.  
  11.     // variable del contenedor de los tiles.
  12.         public Map map;
  13.  
  14.         // Cada vez que hagamos click a un tile la consola nos dara un "click!".
  15.         void OnMouseUp(){
  16.                 Debug.Log("Click!");
  17.  
  18.                 // Función para mover la unidad seleccionada al tile clickeado.
  19.                 map.MoverUnidadSeleccionadaA(tileX,tileY);
  20.         }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement