Skip to content

Instantly share code, notes, and snippets.

@yanniboi
yanniboi / main.yml
Last active November 25, 2022 13:57
Deploy Itch.io Github Action
name: GameCI Template 🎮
on:
workflow_dispatch:
push:
tags:
- v*
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
ITCH_USERNAME: yanniboi
@yanniboi
yanniboi / HealthController.cs
Created June 19, 2021 11:48
Devlog - Tower Offender - Radial heart fill
public class HealthController : MonoBehaviour
{
[SerializeField]
private Image[] _hearts;
private float _currentHealth;
public void UpdateDisplay()
{
@yanniboi
yanniboi / SpriteChange.cs
Created May 28, 2021 20:10
Spike Collider for longy.
public class SpriteChange : Monobehaviour
{
public Sprite[] spriteArray;
public Sprite spikeSprite;
public SpriteRenderer spriteRenderer;
public int currentSprite;
private void OnCollisionEnter2D (Collision2D col)
{
if (col.gameObject.tag == "spike")
@yanniboi
yanniboi / EditorValueDisplay.cs
Created May 28, 2021 19:42
Displays text at certain zoom level in Unity Editor. By Alex Strook (https://twitter.com/AlexStrook/status/1398304186505236487)
using UnityEditor;
using UnityEditor.SceneManagement;
public class EditorValueDisplay : MonoBehaviour
{
public string const = "0000";
private float _visibilityDistance = 2.5;
private float _worldOffset = 0.1f;
@yanniboi
yanniboi / README.md
Created May 18, 2021 09:38
Reverse a keyframe animation in Unity

Original solution can be found here: http://answers.unity.com/answers/477764/view.html

This is an editor script to reverse an AnimationClip. Since it's an editor script you have to put it in a folder called "Editor". Once it's there a new mainmenu item called "Tools" will appear (if not just click the "File" menu once).

How to use:

Now you have to duplicate the AnimationClip in Unity by pressing CTRL+D while you have selected the AnimationClip. Select the duplicated Clip and click on Tools/ReverseAnimation. This will reverse the animation.

@yanniboi
yanniboi / ParallaxBackground.cs
Created April 16, 2021 09:24
Parallax background script (by codemonkey)
using UnityEngine;
public class ParallaxBackground : MonoBehaviour {
[SerializeField] private Vector2 parallaxEffectMultiplier;
[SerializeField] private bool infiniteHorizontal;
[SerializeField] private bool infiniteVertical;
private Transform cameraTransform;
private Vector3 lastCameraPosition;
@yanniboi
yanniboi / docker_update.sh
Created September 20, 2016 10:31
Docker command cheatsheet
#!/bin/sh
# Get docker image.
docker pull yanniboi/ubuntu-php
cd yanniboi-php
# Start a new container
docker run -it --name mycontainer1 yanniboi/ubuntu-php
@yanniboi
yanniboi / statuscake_create.sh
Created September 19, 2016 22:59
Statuscake create new test using API
#!/bin/bash
curl -H "API: [API KEY]" -H "Username: [USERNAME]" -d "WebsiteURL=google.com&WebsiteName=MySite&CheckRate=300" -X PUT https://www.statuscake.com/API/Tests/Update
@yanniboi
yanniboi / cmi_test.install.php
Created January 20, 2016 17:03
Drupal 8 views alter
<?php
/**
* @file
* Install file to handle module install and uninstall.
*/
/**
* Implements hook_install().
* Add an exposed filter for comment approval.
@yanniboi
yanniboi / cmi_test.module.php
Last active January 20, 2016 17:16
Drupal 7 views alter
<?php
/**
* @file
* Module file for cmi_test to register module with views.
*/
/**
* Implements hook_views_api().
*/