示例#1
0
    void AttempToMove(Vector2 position)
    {
        MDTile   tile = MapManager.shared.map.GetTileAt((int)position.x, (int)position.y);
        MDObject obj  = MapManager.shared.map.GetObjectAt(position);
        MDUnit   unit = MapManager.shared.map.GetUnitAt(position);

        if (tile == null || tile.solid || (tile.liquid && !onBoat))
        {
            Debug.Log("Solid surface!");
        }
        else if (obj != null && obj.solid)
        {
            Interact(obj);
        }
        else if (unit != null)
        {
            if (unit.friendly)
            {
                Talk(unit);
            }
            else
            {
                Attack(unit);
            }
        }
        else
        {
            _transform.position = position;
            MapManager.shared.UpdateChunks();
        }
    }
示例#2
0
 // Установить юнит по координатам
 public bool SetUnitAt(Vector2 position, MDUnit unit)
 {
     if (units.ContainsKey(position))
     {
         return(false);
     }
     else
     {
         units.Add(position, unit);
         return(true);
     }
 }
示例#3
0
 void Attack(MDUnit unit)
 {
     Debug.Log("Attack!");
 }
示例#4
0
 void Talk(MDUnit unit)
 {
     Debug.Log("Talk!");
 }