public void DisableLayer(LogicColor color) { foreach (var layer in _layers) { layer.gameObject.GetComponent <TilemapCollider2D>().enabled = (layer.Color != color); } }
public static Vector3 colorToVector(LogicColor c) { Vector3 result = Vector3.zero; result.x = ((int)c >> 2) & 1; result.y = ((int)c >> 1) & 1; result.z = ((int)c >> 0) & 1; return result; }
public void SetColor(LogicColor color, bool force = false) { if (!force && (color == LogicColor)) { return; } LogicColor = color; GetComponent <SpriteRenderer>().color = color.ToColor(); Director.Instance.DisableLayer(LogicColor); }
public static Color ToColor(this LogicColor logicColor) { switch (logicColor) { case LogicColor.Disabled: default: return(new Color(0, 0, 0, 0)); case LogicColor.White: return(new Color(1, 1, 1)); case LogicColor.Gray: return(new Color(99f / 255f, 99f / 255f, 99f / 255f)); case LogicColor.LightGray: return(new Color(163f / 255f, 163f / 255f, 163f / 255f)); } }