Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Prototype version updated 11/13 --IFB
  • Loading branch information
ifb10001 committed Nov 13, 2013
1 parent 3a30942 commit aee962d
Show file tree
Hide file tree
Showing 17 changed files with 70 additions and 16 deletions.
Binary file modified Assembly-CSharp-firstpass.pidb
Binary file not shown.
Binary file modified Assembly-CSharp.pidb
Binary file not shown.
Binary file modified Assembly-UnityScript-firstpass.pidb
Binary file not shown.
Binary file modified Assets/Materials/bgTemp.mat
Binary file not shown.
Binary file modified Assets/Prefabs/Background.prefab
Binary file not shown.
Binary file modified Assets/Prefabs/FlyingEnemy.prefab
Binary file not shown.
Binary file modified Assets/Prefabs/GroundEnemy.prefab
Binary file not shown.
Binary file modified Assets/Prefabs/Player.prefab
Binary file not shown.
Binary file modified Assets/Prefabs/PortalOut.prefab
Binary file not shown.
Binary file modified Assets/Prefabs/Powerup.prefab
Binary file not shown.
13 changes: 11 additions & 2 deletions Assets/Scripts/EnemyPhysics.cs
Expand Up @@ -5,7 +5,7 @@ using System.Collections;
public class EnemyPhysics : MonoBehaviour {

public LayerMask collisionMask;

public bool hasPowerup= false;
private BoxCollider colliderX;
private Vector3 s;
private Vector3 c;
Expand All @@ -18,6 +18,7 @@ public class EnemyPhysics : MonoBehaviour {
private float dirY;
private float direction = -1;
private Vector3 movement;
public GameObject PowerupPrefabz;

[HideInInspector]
public bool grounded;
Expand Down Expand Up @@ -114,7 +115,15 @@ public class EnemyPhysics : MonoBehaviour {

void OnTriggerEnter(Collider other) {
lastHit = other.tag;
if (lastHit =="Backboard"){Debug.Log (lastHit);}
if (lastHit =="Backboard"){
//Debug.Log (lastHit);
}
else if (lastHit=="Weapon"){
if (hasPowerup){
Instantiate (PowerupPrefabz, transform.position, Quaternion.identity);
}
DestroyObject (this.gameObject);
}
}


Expand Down
8 changes: 5 additions & 3 deletions Assets/Scripts/OutPortal.cs
Expand Up @@ -13,9 +13,11 @@ public class OutPortal : MonoBehaviour {
}

void OnTriggerEnter(Collider other) {
hitP=true;
particles.emissionRate *= 3;
rotateSpeed *= 3;
if (other.tag=="Player"){
hitP=true;
particles.emissionRate *= 3;
rotateSpeed *= 3;
}
}

void Update () {
Expand Down
61 changes: 52 additions & 9 deletions Assets/Scripts/PlayerController.cs
Expand Up @@ -8,42 +8,69 @@ public class PlayerController : MonoBehaviour {
//public float acceleration;
public float jumpHeight = 12;
//public GameObject portal;

private Vector3 mousePos;
[HideInInspector]
public bool pDead = false;
private Vector2 movement;
private float playerHP = 1;
public GameObject WeaponPortal;
private PlayerPhysics playerPhysics;
private bool portalExist = false;
private GameObject currentPortal;
private bool gotHit=false;
private bool gotPower=false;

void Start () {

playerPhysics = GetComponent<PlayerPhysics>();
}

void OnGUI(){
if (gotHit){
GUI.TextField (new Rect (0, 0, 90, 20), "Hit by enemy!", 25);
}
if (gotPower){
GUI.TextField (new Rect (0, 0, 60, 20), "Powerup!", 25);
}
}
void OnTriggerEnter(Collider other) {
string derp = other.tag;

if (derp == "Powerup"){
gotPower=true;
Invoke ("resetPower", 1f);
playerHP++;
Debug.Log ("Powered up!");
//Debug.Log ("Powered up!");
}

else if (derp == "EndPortal"){
DestroyObject (this.gameObject);
Debug.Log ("hit portal");
//Debug.Log ("hit portal");
}
else if (derp == "Backboard"){}
else{
gotHit=true;
Invoke ("resetHit", 1f);
playerHP--;
Debug.Log ("phit");
//Debug.Log ("phit");
}
}
void resetHit(){
gotHit=false;
}
void resetPower(){
gotPower=false;
}
void playerDead() {
DestroyObject(this.gameObject);
pDead = true;
print (pDead);

}
void Update () {

if (playerHP <= 0) {
playerDead ();
}

float amtToMove = Input.GetAxisRaw ("Horizontal") * PlayerSpeed * Time.deltaTime;

if(playerPhysics.grounded) {
Expand All @@ -59,9 +86,25 @@ public class PlayerController : MonoBehaviour {

playerPhysics.move (movement);

if (playerHP == 0) {
playerDead ();
}

CastRayToWorld ();

if(Input.GetMouseButtonDown(0)){
if (portalExist) {DestroyObject(currentPortal.gameObject);}
//Vector3 position = new Vector3(transform.position.x, transform.position.y + (transform.localScale.y / 2), 0);
currentPortal = (Instantiate (WeaponPortal, mousePos, Quaternion.identity) as GameObject);

portalExist = true;
//Debug.Log (mousePos);
}
}


void CastRayToWorld() {
Ray ray= Camera.main.ScreenPointToRay(Input.mousePosition);
Vector3 point= ray.origin + (ray.direction);
mousePos = new Vector3(point.x, point.y, 0.0f);
//Debug.Log( "World point " + pointZero);
}

}
2 changes: 1 addition & 1 deletion Assets/Scripts/Powerups.cs
Expand Up @@ -4,7 +4,7 @@ using System.Collections;
public class Powerups : MonoBehaviour {

void OnTriggerEnter(Collider other) {
if (other.tag=="Player"){
if (other.tag=="Player" || other.tag=="Enemy"){
DestroyObject (this.gameObject);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/enemyCollide.cs
Expand Up @@ -4,6 +4,6 @@ using System.Collections;
public class enemyCollide : MonoBehaviour {

void OnTriggerEnter(Collider other) {
Debug.Log ("hit");
//Debug.Log ("hit");
}
}
Binary file modified Assets/TestLevel2.unity
Binary file not shown.
Binary file modified ProjectSettings/TagManager.asset
Binary file not shown.

0 comments on commit aee962d

Please sign in to comment.