Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Nearing final state build
  • Loading branch information
ifb10001 committed Dec 3, 2013
1 parent 4704d44 commit 6d0fa95
Show file tree
Hide file tree
Showing 110 changed files with 625 additions and 123 deletions.
Binary file modified Assembly-CSharp.pidb
Binary file not shown.
Binary file added Assets/ControlScreen.unity
Binary file not shown.
Binary file added Assets/Credits.unity
Binary file not shown.
Binary file added Assets/Level1.unity
Binary file not shown.
Binary file added Assets/Level2.unity
Binary file not shown.
Binary file added Assets/Level3.unity
Binary file not shown.
Binary file added Assets/Materials/BACKGROUND 1.mat
Binary file not shown.
Binary file added Assets/Materials/BACKGROUND1.mat
Binary file not shown.
Binary file added Assets/Materials/BACKGROUND2.mat
Binary file not shown.
Binary file added Assets/Materials/BACKGROUND3.mat
Binary file not shown.
Binary file added Assets/Materials/BACKGROUND4.mat
Binary file not shown.
Binary file added Assets/Materials/BACKGROUNDbw.mat
Binary file not shown.
Binary file not shown.
Binary file modified Assets/Materials/Ground.mat
Binary file not shown.
Binary file added Assets/Materials/Lightning 1.mat
Binary file not shown.
Binary file modified Assets/Materials/Player.mat
Binary file not shown.
Binary file modified Assets/Materials/PlayerSpriteSheet.mat
Binary file not shown.
Binary file modified Assets/Materials/PlayerSpriteSheet2.mat
Binary file not shown.
Binary file added Assets/Materials/PortalWeapon.mat
Binary file not shown.
Binary file added Assets/Materials/Splash.mat
Binary file not shown.
Binary file modified Assets/Materials/bgTemp.mat
Binary file not shown.
Binary file added Assets/Materials/blankBG.mat
Binary file not shown.
Binary file added Assets/Materials/colorBG.mat
Binary file not shown.
Binary file modified Assets/Prefabs/Background.prefab
Binary file not shown.
Binary file added Assets/Prefabs/Background1.prefab
Binary file not shown.
Binary file added Assets/Prefabs/Background2.prefab
Binary file not shown.
Binary file added Assets/Prefabs/Background3.prefab
Binary file not shown.
Binary file added Assets/Prefabs/Background4.prefab
Binary file not shown.
Binary file added Assets/Prefabs/BlankBG.prefab
Binary file not shown.
Binary file added Assets/Prefabs/Cat.prefab
Binary file not shown.
Binary file modified Assets/Prefabs/FlyingEnemy.prefab
Binary file not shown.
Binary file modified Assets/Prefabs/Ground.prefab
Binary file not shown.
Binary file modified Assets/Prefabs/GroundEnemy.prefab
Binary file not shown.
Binary file modified Assets/Prefabs/Lighting.prefab
Binary file not shown.
Binary file modified Assets/Prefabs/Main Camera.prefab
Binary file not shown.
Binary file modified Assets/Prefabs/Player.prefab
Binary file not shown.
Binary file modified Assets/Prefabs/PortalIn.prefab
Binary file not shown.
Binary file modified Assets/Prefabs/Powerup.prefab
Binary file not shown.
Binary file added Assets/Prefabs/PowerupCoat.prefab
Binary file not shown.
Binary file added Assets/Prefabs/PowerupGlasses.prefab
Binary file not shown.
Binary file added Assets/Prefabs/StaticBulletCeil.prefab
Binary file not shown.
Binary file added Assets/Prefabs/StaticBulletFloor.prefab
Binary file not shown.
Binary file added Assets/Prefabs/StaticBulletSide.prefab
Binary file not shown.
Binary file added Assets/Prefabs/StaticShooterCeil.prefab
Binary file not shown.
Binary file added Assets/Prefabs/StaticShooterFloor.prefab
Binary file not shown.
Binary file added Assets/Prefabs/StaticShooterSide.prefab
Binary file not shown.
Binary file added Assets/Prefabs/WeaponPortalPrefab.prefab
Binary file not shown.
Binary file added Assets/Prefabs/colorBG.prefab
Binary file not shown.
Binary file added Assets/Prefabs/monoBG.prefab
Binary file not shown.
128 changes: 41 additions & 87 deletions Assets/Scripts/Anim2D.cs
Expand Up @@ -2,136 +2,90 @@
using System.Collections;

public class Anim2D : MonoBehaviour {

// calculation variables
private Vector3 tempVector;
private Vector3 tempVector2;
private int i;

// animation variables (variables used for processing aniamtion)

public float sheetRows = 5; // Total columns in sprite sheet
public float sheetColumns = 4; // Total Rows in sprite sheet

public float FrameRate = 11f; // how many frames to play per second

public float frameRate = 11f; // how many frames to play per second

private float frameNum = 1; // the current frame being played,
private string currentAnim; // the ID of the current animation being played
[HideInInspector]
public string currentAnim; // the ID of the current animation being played
private float currentStart = 0; //Dynamic variable that tells the animation system what the first frame of the current animation is
private float currentEnd = 0;
private bool loopCheck; //Does this animation loop?
private float AnimTime = 0f; // time to pass before playing next animation
private float animTime = 0f; // time to pass before playing next animation
private Vector2 sheetPos; // the X, Y position of the frame
private Vector2 sheetOffset; // the offset value of the X, Y coordinate for the texture



//This Class allows us to create a bunch of data and store it in this specific container
[System.Serializable]
public class AnimClass
{
public string Name;
public bool looping;
public int anim_Min;
public int anim_Max;
public class AnimClass {
public string name;
public bool looping;
public int anim_Min;
public int anim_Max;
}

public AnimClass[] Animz;




// Use this for initialization
void Start () {

void Start() {
//Telling this controller that Idle is the default animation so that it doesn't throw an error
currentAnim = "Idle";
}


void Update () {

HandleAnimation();
KeyCommands();

}

void HandleAnimation () // handles all animation
{

void Update() {
FindAnimation(currentAnim);
ProcessAnimation();

}

//Here we decide
void FindAnimation (string currentAnim)
{

for (var i = 0; i < Animz.Length; i++){
if ( Animz[i].Name == currentAnim){

//Here we decide
void FindAnimation(string currentAnim) {
for (int i = 0; i < Animz.Length; i++){
if ( Animz[i].name == currentAnim){
loopCheck = Animz[i].looping;
currentStart = Animz[i].anim_Min;
currentEnd = Animz[i].anim_Max;

i = Animz.Length;
}
}
}

//These are dummy key input sensors. You should have a seperate player controller (or AI controller) that declares "currentAnim" to this script
void KeyCommands(){
if (Input.GetKeyDown(KeyCode.UpArrow)){
currentAnim = "Idle";
}
if (Input.GetKeyDown(KeyCode.RightArrow)){
currentAnim = "Kill";
}

public void SetAnim(string anim) {
currentAnim = anim;
}


void ProcessAnimation ()
{


public string GetAnim() {
return currentAnim;
}

void ProcessAnimation() {
// AnimTime -= Time.deltaTime; subtract the number
// of seconds passed since the last frame, if the game
// is running at 30 frames per second the variable will
// subtract by 0.033 of a second (1/30)

AnimTime -= Time.deltaTime;

if (AnimTime <= 0)
{
animTime -= Time.deltaTime;

if (animTime <= 0) {
frameNum += 1;
// one play animations (play from start to finish)

frameNum = Mathf.Clamp(frameNum,currentStart,currentEnd+1);
if ( loopCheck == true){

if (loopCheck == true){
if (frameNum > currentEnd){
frameNum = currentStart;
}
}

// if the FrameRate is 11, 1/11 is one eleventh of a second, that is the time we are waiting before we
//play the next frame.

AnimTime += (1/FrameRate);
animTime += (1/frameRate);
}

sheetPos.y = Mathf.Floor(frameNum/sheetRows);

sheetPos.x = (frameNum % sheetRows) - 1; // find the X coordinate of the frame to play

sheetPos.y = 0;

// find the number of frames down the animation is and set the y coordinate accordingly
for (i=(int)frameNum; i > 5; i-=5)
{
sheetPos.y += 1;
}

sheetPos.x = i - 1; // find the X coordinate of the frame to play
sheetOffset = new Vector2(1 - (sheetPos.x/sheetRows),1 -(sheetPos.y/sheetColumns)); // find the X and Y coordinate of the frame to display

renderer.material.SetTextureOffset ("_MainTex", sheetOffset); // offset the texture to display the correct frame
}

}
sheetOffset = new Vector2(1-(sheetPos.x/sheetRows), 1-(sheetPos.y/sheetColumns)); // find the X and Y coordinate of the frame to display

renderer.material.SetTextureOffset("_MainTex", sheetOffset); // offset the texture to display the correct frame
}
}
135 changes: 135 additions & 0 deletions Assets/Scripts/CatScript.cs
@@ -0,0 +1,135 @@
using UnityEngine;
using System.Collections;

[RequireComponent(typeof(BoxCollider))]
public class CatScript : MonoBehaviour {


public LayerMask collisionMask;
private BoxCollider colliderX;
private Vector3 s;
private Vector3 c;
public float EnemySpeed;
public float gravity;
private float skin = .005f;
private float dirX;
private float dirY;
private float direction = 1;
private Vector3 movement;
private Vector3 originalSize;
private Vector3 originalCenter;
private float colliderScaleX;

[HideInInspector]
public bool grounded;
[HideInInspector]
public bool movementStopped;

Ray rayV;
Ray rayD;
Ray rayH;
RaycastHit hit;

void Start(){
//audio.Play ();
colliderX = GetComponent<BoxCollider>();
s = colliderX.size;
c = colliderX.center;
colliderScaleX = transform.localScale.x;
SetCollider (s, c);
}

public void move(Vector2 moveAmt) {

float deltaY = moveAmt.y *Time.deltaTime;
float deltaX = moveAmt.x;
Vector2 p = transform.position;

grounded= false;
for (int i = 0; i <3; i++) {
dirY = Mathf.Sign (deltaY);
float x = (p.x + c.x - s.x/2) + s.x/2 * i;
float y = p.y + c.y +s.y/2 * dirY;

rayV = new Ray(new Vector2(x,y), new Vector2(0,dirY));
Debug.DrawRay (rayV.origin, rayV.direction);
if (Physics.Raycast (rayV,out hit, Mathf.Abs (deltaY) + skin, collisionMask)) {

float dst = Vector3.Distance (rayV.origin, hit.point);


if (dst > skin) {
deltaY = -dst - skin * dirY;
}
else{
deltaY = 0;
}
grounded = true;
break;

}
}

movementStopped = false;
for (int i = 0; i <3; i++) {
dirX = Mathf.Sign (deltaX);
float x = p.x + c.x + s.x/2 * dirX;
float y = (p.y + c.y - s.y/2) + s.y/2 * i;

rayH = new Ray(new Vector2(x,y), new Vector2(dirX,0));
Debug.DrawRay (rayH.origin, rayH.direction);
if (Physics.Raycast (rayH,out hit, Mathf.Abs (deltaX) + skin, collisionMask)) {

float dst = Vector3.Distance (rayH.origin, hit.point);


if (dst > skin) {
deltaX = dst * dirX - skin * dirX;
}
else{
//deltaX = 0;
}
movementStopped = true;
break;

}
}
if (!grounded && !movementStopped) {
Vector3 playerDir = new Vector3(deltaX,deltaY);
Vector3 o = new Vector3((p.x + c.x + s.x/2 * dirX),(p.y + c.y +s.y/2 * dirY));
Debug.DrawRay (o, playerDir.normalized);
rayD = new Ray(o, playerDir.normalized);
if(Physics.Raycast (rayD,Mathf.Sqrt (deltaX*deltaX + deltaY*deltaY),collisionMask)){
grounded = true;
deltaY = 0;
}
}

Vector2 finalTransform = new Vector2 (deltaX,deltaY);
transform.Translate(finalTransform, Space.World);
//movement = new Vector3(finalTransform.x, finalTransform.y, 0);
}


void Update () {
move (movement);
if (transform.position.x > 11){SelfDestruct ();}
float amtToMove = EnemySpeed * Time.deltaTime * direction;

movement.x = amtToMove;
movement.y -= gravity * Time.deltaTime;

}

void SelfDestruct(){
DestroyObject (this.gameObject);
}

public void SetCollider(Vector3 size, Vector3 center){
colliderX.size = size;
colliderX.center= center;

s = size * colliderScaleX;
c = center * colliderScaleX;
}
}
19 changes: 19 additions & 0 deletions Assets/Scripts/ClickThroughMenu.cs
@@ -0,0 +1,19 @@
using UnityEngine;
using System.Collections;

public class ClickThroughMenu : MonoBehaviour {
public Texture backgroundTexture;
public int nextScene;
// Use this for initialization
void Start () {

}
void OnGUI(){
GUI.DrawTexture (new Rect(0,0,Screen.width,Screen.height), backgroundTexture);
}
void Update () {
if(Input.GetMouseButtonDown(0)){
Application.LoadLevel (nextScene);
}
}
}

0 comments on commit 6d0fa95

Please sign in to comment.