diff --git a/Assembly-CSharp-firstpass.pidb b/Assembly-CSharp-firstpass.pidb index 3945593..f96e337 100644 Binary files a/Assembly-CSharp-firstpass.pidb and b/Assembly-CSharp-firstpass.pidb differ diff --git a/Assembly-CSharp.pidb b/Assembly-CSharp.pidb index 0f4e2aa..414f88a 100644 Binary files a/Assembly-CSharp.pidb and b/Assembly-CSharp.pidb differ diff --git a/Assembly-UnityScript-firstpass.pidb b/Assembly-UnityScript-firstpass.pidb index 71e5b2a..4129180 100644 Binary files a/Assembly-UnityScript-firstpass.pidb and b/Assembly-UnityScript-firstpass.pidb differ diff --git a/Assets/Materials/bgTemp.mat b/Assets/Materials/bgTemp.mat index e3ada6c..8c3eefe 100644 Binary files a/Assets/Materials/bgTemp.mat and b/Assets/Materials/bgTemp.mat differ diff --git a/Assets/Prefabs/Background.prefab b/Assets/Prefabs/Background.prefab index 089ff65..206a67a 100644 Binary files a/Assets/Prefabs/Background.prefab and b/Assets/Prefabs/Background.prefab differ diff --git a/Assets/Prefabs/FlyingEnemy.prefab b/Assets/Prefabs/FlyingEnemy.prefab index b1a6476..35189b1 100644 Binary files a/Assets/Prefabs/FlyingEnemy.prefab and b/Assets/Prefabs/FlyingEnemy.prefab differ diff --git a/Assets/Prefabs/GroundEnemy.prefab b/Assets/Prefabs/GroundEnemy.prefab index c25a64b..4c0e470 100644 Binary files a/Assets/Prefabs/GroundEnemy.prefab and b/Assets/Prefabs/GroundEnemy.prefab differ diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index 115339b..724a0a8 100644 Binary files a/Assets/Prefabs/Player.prefab and b/Assets/Prefabs/Player.prefab differ diff --git a/Assets/Prefabs/PortalOut.prefab b/Assets/Prefabs/PortalOut.prefab index ee92d0a..02e276d 100644 Binary files a/Assets/Prefabs/PortalOut.prefab and b/Assets/Prefabs/PortalOut.prefab differ diff --git a/Assets/Prefabs/Powerup.prefab b/Assets/Prefabs/Powerup.prefab index 25772b7..7c8a096 100644 Binary files a/Assets/Prefabs/Powerup.prefab and b/Assets/Prefabs/Powerup.prefab differ diff --git a/Assets/Scripts/EnemyPhysics.cs b/Assets/Scripts/EnemyPhysics.cs index 06550b3..b4755cf 100644 --- a/Assets/Scripts/EnemyPhysics.cs +++ b/Assets/Scripts/EnemyPhysics.cs @@ -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; @@ -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; @@ -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); + } } diff --git a/Assets/Scripts/OutPortal.cs b/Assets/Scripts/OutPortal.cs index 07e78be..45cd327 100644 --- a/Assets/Scripts/OutPortal.cs +++ b/Assets/Scripts/OutPortal.cs @@ -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 () { diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index fe52f62..0c6b0e6 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -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(); } - + 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) { @@ -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); } } diff --git a/Assets/Scripts/Powerups.cs b/Assets/Scripts/Powerups.cs index aed2728..434b00f 100644 --- a/Assets/Scripts/Powerups.cs +++ b/Assets/Scripts/Powerups.cs @@ -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); } } diff --git a/Assets/Scripts/enemyCollide.cs b/Assets/Scripts/enemyCollide.cs index fbfccdd..be83bd3 100644 --- a/Assets/Scripts/enemyCollide.cs +++ b/Assets/Scripts/enemyCollide.cs @@ -4,6 +4,6 @@ using System.Collections; public class enemyCollide : MonoBehaviour { void OnTriggerEnter(Collider other) { - Debug.Log ("hit"); + //Debug.Log ("hit"); } } diff --git a/Assets/TestLevel2.unity b/Assets/TestLevel2.unity index fe3c631..92ce832 100644 Binary files a/Assets/TestLevel2.unity and b/Assets/TestLevel2.unity differ diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 9f1bf43..15a3950 100644 Binary files a/ProjectSettings/TagManager.asset and b/ProjectSettings/TagManager.asset differ