Skip to content

Instantly share code, notes, and snippets.

@graphicbeacon
graphicbeacon / main.dart
Created March 19, 2020 20:11
"Learn Dart Before you Flutter" Youtube video solution
class Order {
var _id;
var _reference;
var date;
var code;
List<String> bookings;
Order(this._id, this._reference, {this.date});
Order.withDiscount(this._id, this._reference, [this.code]) {
date = DateTime.now();
@ditzel
ditzel / PhysicsHelper.cs
Created January 20, 2019 16:54
Unity Helper for Physic Functions
using UnityEngine;
namespace Ditzelgames
{
public static class PhysicsHelper
{
public static void ApplyForceToReachVelocity(Rigidbody rigidbody, Vector3 velocity, float force = 1, ForceMode mode = ForceMode.Force)
{
if (force == 0 || velocity.magnitude == 0)
using UnityEngine;
using UnityEngine.UI;
/*
Radial Layout Group by Just a Pixel (Danny Goodayle) - http://www.justapixel.co.uk
Copyright (c) 2015
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
Shader "UnityCommunity/Sprites/SpriteDropShadow"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
_ShadowColor ("Shadow", Color) = (0,0,0,1)
_ShadowOffset ("ShadowOffset", Vector) = (0,-0.1,0,0)
}
Shader "Custom/WireFrame" {
Properties {
_LineColor ("LineColor", Color) = (1, 1, 1, 1)
_MainColor ("_MainColor", Color) = (1, 1, 1, 1)
_LineWidth ("Line width", Range(0, 1)) = 0.1
_ParcelSize ("ParcelSize", Range(0, 100)) = 1
}
SubShader {
Tags { "Queue"="Transparent" "RenderType"="Transparent" }
@PopupAsylumUK
PopupAsylumUK / HexGridLayout.cs
Last active May 3, 2024 02:04
A Layout group for arranging children in a hexagon grid, and a Hexagon graphic
using UnityEngine;
using UnityEngine.UI;
public class HexGridLayout : LayoutGroup {
const float SQUARE_ROOT_OF_3 = 1.73205f;
public enum Axis { Horizontal = 0, Vertical = 1 }
public enum Constraint { Flexible = 0, FixedColumnCount = 1, FixedRowCount = 2 }
using System;
using System.Collections.Generic;
using UnityEngine;
public class Sokoban : MonoBehaviour
{
// タイルの種類
private enum TileType
{
NONE, // 何も無い
using UnityEngine;
using UnityEngine.UI;
/*
Radial Layout Group by Just a Pixel (Danny Goodayle) - http://www.justapixel.co.uk
Copyright (c) 2015
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
using System.Collections.Generic;
/// <summary>
/// Modified Gradient effect script from http://answers.unity3d.com/questions/1086415/gradient-text-in-unity-522-basevertexeffect-is-obs.html
/// -Uses Unity's Gradient class to define the color
/// -Offset is now limited to -1,1
/// -Multiple color blend modes
///
/// Remember that the colors are applied per-vertex so if you have multiple points on your gradient where the color changes and there aren't enough vertices, you won't see all of the colors.
/// </summary>
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class RadialSlider : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerDownHandler, IPointerUpHandler
{
bool isPointerDown = false;
// Called when the pointer enters our GUI component.