Skip to content

Instantly share code, notes, and snippets.

@wtrebella
wtrebella / WTLabel
Created August 3, 2013 08:50
Word wrapping and coloring labels
using UnityEngine;
using System.Collections;
public class WTLabel : FLabel {
protected Color[] quadColors_;
public WTLabel(string fontName, string text) : base(fontName, text) {
}
@wtrebella
wtrebella / WTAbstractSceneContainer
Created July 10, 2013 14:59
Subclass of FContainer that has some cool zoom-in and out effects.
using UnityEngine;
using System.Collections;
public class WTAbstractSceneContainer : FContainer {
public SceneType sceneType;
public SceneType nextSceneType;
public bool isActive = true;
public FContainer everythingContainer = new FContainer();
public FSprite backgroundLayer;
@wtrebella
wtrebella / WTPath.cs
Created June 23, 2013 19:49
This shows how the path in Pivvot is drawn (as well as the tapered player tail)
override public void PopulateRenderLayer()
{
if(_isOnStage && _firstFacetIndex != -1 && pathPointsToRender_ != null) // if this is false, the sprite hasn't been initiated correctly yet
{
_isMeshDirty = false;
int vertexIndex0 = _firstFacetIndex * 4;
int quadVerticeCount = (pathPointsToRender_.Length - 1) * 4;
Vector3[] quadVertices = _renderLayer.vertices;
@wtrebella
wtrebella / WTPulsator.cs
Created June 6, 2013 02:42
This will pulsate the float properties of any object added to that so that they are all in time with a specific bpm.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
public class WTPulsator {
public List<WTPulsatorObject> objects = new List<WTPulsatorObject>();
public float totalTime = 0;
public float bpm;
bool isPulsating = false;
@wtrebella
wtrebella / WTDrawingPolygonsScene.cs
Last active December 16, 2015 13:48
This is a collection of classes that will allow you to simply make an array of vertices and have them drawn on screen as a polygon (with a solid color). You will also be able to collide a circle with that polygon, or just get the vertex points based on its rotation, scale, and position.
using UnityEngine;
using System.Collections;
// This is just an example of how to use the polygon sprite
public class WTDrawingPolygonsScene : MonoBehaviour {
void Start () {
FutileParams fp = new FutileParams(true, true, false, false);
fp.AddResolutionLevel(480f, 1.0f, 1.0f, "-res1");
fp.backgroundColor = Color.black;
fp.origin = Vector2.zero;