Skip to content

Instantly share code, notes, and snippets.

@jcordeiro67
jcordeiro67 / Defender.cs
Last active February 10, 2017 19:30
My Defender Script / Used to change the attackers color of the defender when attacked
/* DESCRIPTION:
* Changes the color of the sprite when hit
* by a Projectile then back to it's original
* color over a float time in the IEnumerator's
* waitforSeconds.
*
* REQUIRED:
* Requires a Sprite Renderer component on the
* child gameObject of the defender.
*
@jcordeiro67
jcordeiro67 / DefenderSpawner.cs
Last active February 8, 2017 23:11
Alternate Code for CalculateWorldPointOfMouseClick
/* DESCRIPTION:
* Spawns defenders on the grid by converting
* mouse position when clicked on screne to world cordinates.
* Rounds the world cordinates to a whole gid number and
* spawns a defender in that location.
*
* Collider2D:
* Used for getting OnMouseDown message
*/
@jcordeiro67
jcordeiro67 / UIFadeIn.cs
Created January 23, 2017 20:07
Alternate Code Adding Fade Transitions
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class UIFadeIn : MonoBehaviour {
public float fadeInDelay;
void Start () {
GetComponent <Image>().CrossFadeAlpha (0, fadeInDelay, true);
@jcordeiro67
jcordeiro67 / Paddle.cs
Last active November 22, 2017 23:36
Automating the Paddle's clamp values relative to the paddle size
// Created by: John Cordeiro
// [email protected]
using UnityEngine;
using System.Collections;
public class Paddle : MonoBehaviour {
// Set the public variables to private after functioning.
@jcordeiro67
jcordeiro67 / LooseLevel
Last active December 14, 2016 19:27
LevelManager script reference using private instead of public
using UnityEngine;
using System.Collections;
public class LooseLevel : MonoBehaviour {
private LevelManager levelManager;
void Start () {