This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class SnapToGrid : MonoBehaviour { | |
public float PPU = 19; // pixels per unit (your tile size) | |
private void LateUpdate() { | |
Vector3 position = transform.localPosition; | |
position.x = (Mathf.Round(transform.parent.position.x * PPU) / PPU) - transform.parent.position.x; | |
position.y = (Mathf.Round(transform.parent.position.y * PPU) / PPU) - transform.parent.position.y; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { memory } from "system"; | |
// Debug logs. | |
// Set `debugEnabled` to false hide debug logs | |
var debugEnabled = true; | |
export function log(message) { | |
if (debugEnabled) { | |
console.log(message); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MapViewController.swift | |
// Mapbox Clustering Test | |
// | |
// Created by Ester Sanchez on 18/01/17. | |
// Copyright © 2017 misato.es. All rights reserved. | |
// | |
import UIKit | |
import Mapbox |