Skip to content

Instantly share code, notes, and snippets.

View llamacademy's full-sized avatar
🔥

Chris Kurhan llamacademy

🔥
View GitHub Profile
@llamacademy
llamacademy / Damageable.cs
Last active February 2, 2021 13:10
Scripts for Floating Damage Text in the video: https://www.youtube.com/watch?v=3eM-6qlwFuU. If you get value from LlamAcademy, consider becoming a Patreon supporter at https://www.patreon.com/llamacademy
using UnityEngine;
public class Damageable : MonoBehaviour
{
public FadeOutTextTween DamagePrefab;
public string NumberFormat = "N0";
// for your game, probably don't need this piece. It should instead be damage from the attacking object
private RangeInt DamageRange = new RangeInt(10, 20_000);
private ObjectPool DamageTextPool;
@llamacademy
llamacademy / AutoDestroyPoolableObject.cs
Last active April 19, 2023 18:15
Scripts from Object Pooling video: https://www.youtube.com/watch?v=fsDE_mO4RZM. If you get value from LlamAcademy, consider becoming a Patreon supporter at https://www.patreon.com/llamacademy
public class AutoDestroyPoolableObject : PoolableObject
{
public float AutoDestroyTime = 5f;
private const string DisableMethodName = "Disable";
public virtual void OnEnable()
{
CancelInvoke(DisableMethodName);
@llamacademy
llamacademy / BuildDisplayer.cs
Last active May 5, 2024 12:51
Build Incrementor Scripts from https://www.youtube.com/watch?v=PbFE0m9UMtE. If you get value from LlamAcademy, consider becoming a Patreon supporter at https://www.patreon.com/llamacademy
using TMPro;
using UnityEngine;
[RequireComponent(typeof(TextMeshProUGUI))]
public class BuildDisplayer : MonoBehaviour
{
private TextMeshProUGUI Text;
private void Awake()
{
@llamacademy
llamacademy / FadeAlpha.cs
Last active March 14, 2024 08:47
Introduction to Coroutines in Unity scripts from https://www.youtube.com/watch?v=FfgI0BJ38P4. If you get value from LlamAcademy, consider becoming a Patreon supporter at https://www.patreon.com/llamacademy
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
[RequireComponent(typeof(Image))]
public class FadeAlpha : MonoBehaviour
{
public bool UseRealtimeWait = false;
private Image Image;
@llamacademy
llamacademy / NumberCounter.CS
Last active March 14, 2024 08:47
Scripts from the Animate Text video https://www.youtube.com/watch?v=SbDiFLfFcCs. If you get value from LlamAcademy, consider becoming a Patreon supporter at https://www.patreon.com/llamacademy
using System.Collections;
using TMPro;
using UnityEngine;
[RequireComponent(typeof(TextMeshProUGUI))]
public class NumberCounter : MonoBehaviour
{
public TextMeshProUGUI Text;
public int CountFPS = 30;
public float Duration = 1f;