Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
using System.Collections;
public class SmoothCamFollow : MonoBehaviour {
public GameObject target;
public float smooth;
public Vector3 position;
public Quaternion rotation;
using UnityEngine;
using System.Collections;
public class WaveSpawner : MonoBehaviour {
public enum SpawnState { SPAWNING, WAITING, COUNTING };
[System.Serializable]
public class Wave {
public string name;//name of the wave
using UnityEngine;
using System.Collections;
public class EnemyHealth : MonoBehaviour {
public float hitPoints = 100f;//max health
public float currentHitPoints;//current health
public GameObject destroyFX;//not sure why you use GameObject rather than Transform...
public GameObject healthbar;
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class EnemyHealth : MonoBehaviour {
public float hitPoints = 100f;//max health
public float currentHitPoints;//current health
public GameObject destroyFX;//not sure why you use GameObject rather than Transform...
//public GameObject healthbar;
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class EnemyHealth : MonoBehaviour {
public float hitPoints = 100f;//max health
public float currentHitPoints;//current health
public GameObject destroyFX;
public Image healthbar;
using UnityEngine;
using System.Collections;
public class EasyAI : MonoBehaviour {
public float fpsTargetDistance; //how far away the player is from the enemy
public float enemyLookDistance; //how close the player needs to be for the enemy to look at the player
public float attackDistance; //how close the player needs to be for the enemy to attack the player
public float enemyMovementSpeed; //how fast the enemy moves
public float turning;
@fiskefyren
fiskefyren / gist:817bb01f863af7cbed76
Created November 17, 2015 19:50
Player shooting script
using UnityEngine;
using System.Collections;
public class PlayerShooting : MonoBehaviour {
public GameObject shot;
public Transform showSpawn;
public float fireRate;
public float cooldown;
@fiskefyren
fiskefyren / gist:0362897928cef2af1b59
Created November 17, 2015 19:52
Projectile script
using UnityEngine;
using System.Collections;
public class LaserProjectile : MonoBehaviour {
public float speed = 2f; //speed at which the projectile travels in world space
public int damage = 25; //damage dealt to other objects this projectile hits
private Transform thisTransform; //cached transform for this projectile
public Transform lasterHitFXPrefab;
using UnityEngine;
using System.Collections;
public class PlayerShooting : MonoBehaviour {
public float fireRate;
public float cooldown;//wait amout of time before we can shoot again
//check to see if we're actually firing
public bool isFiring = false;
// https://www.youtube.com/watch?v=UTLApMrHr5I
// https://www.youtube.com/watch?v=188SMf9f6UY <- this one is better?
using UnityEngine;
using System.Collections;
public class EasyAI : MonoBehaviour {
public float fpsTargetDistance;//how far away the player is from the enemy
public float enemyMovementSpeed;//how fast the enemy moves