Skip to content

Instantly share code, notes, and snippets.

@alexsaaf
alexsaaf / main.py
Created April 5, 2019 20:49
Simple Snake, led matrix
#!/usr/bin/env python
# Authors: Viktor Holmgren (holmgr), Alexander Sääf (alexsaaf)
from pynput import keyboard
import colorsys
import time
import sys
import numpy
import unicornhat as unicorn
using System.Collections.Generic;
using UnityEngine;
public class LaserHandler : MonoBehaviour {
public Transform laserHolder;
public GameObject laserPrefab;
public int numberOfLasers = 20;
public int laserRange = 10;
@alexsaaf
alexsaaf / Musicplayer.cs
Created November 30, 2016 19:15
Unity script for a basic musicplayer which loops over a tracklist and allows player to change track. Made for https://www.reddit.com/r/DailyUnity/comments/5fo78u/challenge_4_beginner_add_looping_background_music/
using UnityEngine;
public class MusicPlayer : MonoBehaviour {
public static MusicPlayer instance = null;
public AudioClip[] tracks;
private int currentTrack;
@alexsaaf
alexsaaf / SphereController.cs
Created November 28, 2016 19:24
Unity component which avoids walls by raycasting and applying forces. Made for https://www.reddit.com/r/DailyUnity/comments/5f8iuo/challenge_3_intermediate_create_a_constantly/
using UnityEngine;
//This component wont work without a rigidbody
[RequireComponent(typeof(Rigidbody))]
public class SphereController : MonoBehaviour {
//We mask ourselves out with this layermask
public LayerMask mask;
[Tooltip("The distance raycasts are sent out")]
public float maxDistance;
@alexsaaf
alexsaaf / ColorRandomizer.cs
Created November 26, 2016 08:54
Unity script which smoothly changes an objects color between random colors. Made for https://www.reddit.com/r/DailyUnity/comments/5essu9/challenge_2_beginner_change_color_of_an_object/
using UnityEngine;
using System.Collections;
/// <summary>
/// Script that switches the color of an object to a random color.
/// Does not produce very pretty colors, but if you want completely
/// random colors they wont be.
/// </summary>
[RequireComponent(typeof(MeshRenderer))]
public class ColorRandomizer : MonoBehaviour {
using UnityEngine;
/// <summary>
/// Basic camera controller script which follows its
/// target around with dampening.
///
/// If the dampTime is too high it may not be able to keep
/// up with the target, meaning the target will leave the screen
/// </summary>
public class CameraController : MonoBehaviour {