Skip to content

Instantly share code, notes, and snippets.

@SteveSwink
SteveSwink / IDamageEventReciever
Created August 13, 2013 16:53
Not sure how this is supposed to become a component in Unity?
using UnityEngine;
using System.Collections;
//[System.Serializable]
public interface IDamageEventReciever {
void TookDamage(int damage);
void TookDamage(int damage, Collision col);
void TookDamage(int damage, Collider col);
void TookDamage(int damage, ControllerColliderHit col);
}
@SteveSwink
SteveSwink / Heart.cs
Created August 13, 2013 16:51
Heart.cs - handles damage from any type of collision
using UnityEngine;
using System.Collections;
public class Heart : MonoBehaviour {
IDamageEventReciever damageReciever;
public int maxHealth;
int health;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
/* State Template
*
// IDLE STATE
bool enterIDLE ()
{
return true;
@SteveSwink
SteveSwink / Player.cs
Created March 8, 2013 23:31
super simple statemachine based player example
using UnityEngine;
using System.Collections;
// An example of how to embed a StateMachine in a Character
// and load a few locally defined state methods into it.
public class Player : MonoBehaviour
{
public float walkSpeed;
public float jumpBurst;
public float gravity;
@SteveSwink
SteveSwink / Statemachine.cs
Created March 8, 2013 22:51
Statemachine C# for unity using mad delegatessss
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
/* State Template
*
// IDLE STATE
bool enterIDLE ()
{
return true;
@SteveSwink
SteveSwink / ScaleableObject.cs
Created February 27, 2013 02:37
Scaleable object script
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class ScaleableObject : MonoBehaviour {
[ExecuteInEditMode]
public TextMesh juiceReadoutObject;
public int minJuice = 1;
public int maxJuice = 500;
@SteveSwink
SteveSwink / MouseOrbitClickAndDrag.cs
Created February 19, 2013 22:58
Click and drag to rotate
using UnityEngine;
using System.Collections;
public class MouseOrbitClickAndDrag : MonoBehaviour {
public Transform target;
public float distance = 5.0f;
public float xAccel = 0.3f;
public float maxXSpeed = 0.5f;
@SteveSwink
SteveSwink / StarMap.cs
Created February 19, 2013 22:57
star map
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class StarMap : MonoBehaviourSingleton<StarMap>{
public List<MapPoint> mapPoints = new List<MapPoint>();
public MapPoint currentLocation;
@SteveSwink
SteveSwink / _State.cs
Created January 25, 2013 01:20
State class to go with Sven's state system
using UnityEngine;
using System.Collections;
using System;
//wont show up because its a ScriptableObject
[AddComponentMenu("LD24/State")]
[Serializable]
public class _State : ScriptableObject {
@SteveSwink
SteveSwink / GrapplePlayer.cs
Last active December 11, 2015 12:18
broken grapple stuff
using UnityEngine;
using System.Collections;
public class GPlayerLogic : MonoBehaviour {
public GameObject grappleHitParicle;
public float speed = 6.0F;
public float jumpBurst = 8.0F;
public float gravity = 20.0F;