From 1a6c36a39f7cd7d10445acf99c2777269ef3c428 Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Tue, 12 Apr 2016 21:09:09 -0400 Subject: [PATCH 01/28] Create RigidbodyFPSController.cs --- RigidbodyFPSController.cs | 59 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 RigidbodyFPSController.cs diff --git a/RigidbodyFPSController.cs b/RigidbodyFPSController.cs new file mode 100644 index 0000000..df11119 --- /dev/null +++ b/RigidbodyFPSController.cs @@ -0,0 +1,59 @@ +using UnityEngine; +using System.Collections; + +[RequireComponent (typeof (Rigidbody))] +[RequireComponent (typeof (CapsuleCollider))] + +public class CharacterControls : MonoBehaviour { + + public float speed = 10.0f; + public float gravity = 10.0f; + public float maxVelocityChange = 10.0f; + public bool canJump = true; + public float jumpHeight = 2.0f; + private bool grounded = false; + + + + void Awake () { + rigidbody.freezeRotation = true; + rigidbody.useGravity = false; + } + + void FixedUpdate () { + if (grounded) { + // Calculate how fast we should be moving + Vector3 targetVelocity = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); + targetVelocity = transform.TransformDirection(targetVelocity); + targetVelocity *= speed; + + // Apply a force that attempts to reach our target velocity + Vector3 velocity = rigidbody.velocity; + Vector3 velocityChange = (targetVelocity - velocity); + velocityChange.x = Mathf.Clamp(velocityChange.x, -maxVelocityChange, maxVelocityChange); + velocityChange.z = Mathf.Clamp(velocityChange.z, -maxVelocityChange, maxVelocityChange); + velocityChange.y = 0; + rigidbody.AddForce(velocityChange, ForceMode.VelocityChange); + + // Jump + if (canJump && Input.GetButton("Jump")) { + rigidbody.velocity = new Vector3(velocity.x, CalculateJumpVerticalSpeed(), velocity.z); + } + } + + // We apply gravity manually for more tuning control + rigidbody.AddForce(new Vector3 (0, -gravity * rigidbody.mass, 0)); + + grounded = false; + } + + void OnCollisionStay () { + grounded = true; + } + + float CalculateJumpVerticalSpeed () { + // From the jump height and gravity we deduce the upwards speed + // for the character to reach at the apex. + return Mathf.Sqrt(2 * jumpHeight * gravity); + } +} From d8507edfc13d0d2381449476c4bbdfb7724def78 Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Tue, 12 Apr 2016 21:21:28 -0400 Subject: [PATCH 02/28] Create WepScript.cs https://www.youtube.com/watch?v=kTzR3ypM_Qc --- WepScript.cs | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 WepScript.cs diff --git a/WepScript.cs b/WepScript.cs new file mode 100644 index 0000000..d6cfbc5 --- /dev/null +++ b/WepScript.cs @@ -0,0 +1,42 @@ +using UnityEngine; +using System.Collections; + +public class wepScript : MonoBehaviour { + + public Camera fpsCam; + public GameObject hitPar; + public int damage = 30; + public int range = 10000; + + public Animation am; + public AnimationClip shoot; + + + + + void Update(){ + if (Input.GetMouseButton (0)) { + fireShot (); + } + } + + public void fireShot(){ + if (!am.IsPlaying (shoot.name)) { + am.CrossFade (shoot.name); + RaycastHit hit; + Ray ray = fpsCam.ScreenPointToRay (new Vector3 (Screen.width / 2, Screen.height / 2, 0)); + + if (Physics.Raycast (ray, out hit, range)) { + if (hit.transform.tag == "Player") { + hit.transform.GetComponent ().RPC ("applyDamage", PhotonTargets.AllBuffered, damage); + } + GameObject particleClone; + particleClone = PhotonNetwork.Instantiate (hitPar.name, hit.point, Quaternion.LookRotation (hit.normal), 0) as GameObject; + Destroy (particleClone, 2); + Debug.Log (hit.transform.name); + + } + + } + } +} From f98bc2fd863782dddaf8ff2d174ca8031aad0e4d Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Tue, 12 Apr 2016 21:23:09 -0400 Subject: [PATCH 03/28] Adds GUI and animations https://www.youtube.com/watch?v=5-HHywqUEcM&index=15&list=PLu2K_XrV43vBp40aez8XAjPt-MmzLdJnG --- WepScript.cs | 49 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/WepScript.cs b/WepScript.cs index d6cfbc5..c0ebad4 100644 --- a/WepScript.cs +++ b/WepScript.cs @@ -7,9 +7,13 @@ public class wepScript : MonoBehaviour { public GameObject hitPar; public int damage = 30; public int range = 10000; + public int ammo = 10; + public int clipSize = 10; + public int clipCount = 5; public Animation am; public AnimationClip shoot; + public AnimationClip reloadA; @@ -18,25 +22,46 @@ void Update(){ if (Input.GetMouseButton (0)) { fireShot (); } + + if (Input.GetKeyDown (KeyCode.R)) { + reload(); + } } public void fireShot(){ - if (!am.IsPlaying (shoot.name)) { - am.CrossFade (shoot.name); - RaycastHit hit; - Ray ray = fpsCam.ScreenPointToRay (new Vector3 (Screen.width / 2, Screen.height / 2, 0)); + if (!am.IsPlaying (reloadA.name) && ammo >= 1) { + if(!am.IsPlaying (shoot.name)){ + am.CrossFade (shoot.name); + ammo = ammo - 1; + + RaycastHit hit; + Ray ray = fpsCam.ScreenPointToRay (new Vector3 (Screen.width / 2, Screen.height / 2, 0)); - if (Physics.Raycast (ray, out hit, range)) { - if (hit.transform.tag == "Player") { - hit.transform.GetComponent ().RPC ("applyDamage", PhotonTargets.AllBuffered, damage); - } - GameObject particleClone; - particleClone = PhotonNetwork.Instantiate (hitPar.name, hit.point, Quaternion.LookRotation (hit.normal), 0) as GameObject; - Destroy (particleClone, 2); - Debug.Log (hit.transform.name); + if (Physics.Raycast (ray, out hit, range)) { + if (hit.transform.tag == "Player") { + hit.transform.GetComponent ().RPC ("applyDamage", PhotonTargets.AllBuffered, damage); + } + GameObject particleClone; + particleClone = PhotonNetwork.Instantiate (hitPar.name, hit.point, Quaternion.LookRotation (hit.normal), 0) as GameObject; + Destroy (particleClone, 2); + Debug.Log (hit.transform.name); + } } } } + + public void reload(){ + if (clipCount >= 1) { + am.CrossFade (reloadA.name); + ammo = clipSize; + clipCount = clipCount - 1; + } + + } + + void OnGUI(){ + GUI.Box (new Rect(110,10,150,30), "Ammo: " + ammo + "/" + clipSize + "/" + clipCount); + } } From bf823bbc40d99f42b08f2144695b5fca7bb0d310 Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Sun, 8 May 2016 21:20:19 -0400 Subject: [PATCH 04/28] Added files via upload --- BarScript.cs | 31 ++++++++ Crosshair.cs | 9 +++ DestroyCubes.cs | 19 +++++ FPSWalkerEnhanced.cs | 159 +++++++++++++++++++++++++++++++++++++++ FieldLight.cs | 15 ++++ GlowOn.cs | 41 ++++++++++ GunAnimSounds.cs | 27 +++++++ RigidbodyFPSWalker.cs | 146 +++++++++++++++++++++++++++++++++++ Shoot.cs | 33 ++++++++ SimpleSmoothMouseLook.cs | 80 ++++++++++++++++++++ WepScript.cs | 146 ++++++++++++++++++----------------- 11 files changed, 639 insertions(+), 67 deletions(-) create mode 100644 BarScript.cs create mode 100644 Crosshair.cs create mode 100644 DestroyCubes.cs create mode 100644 FPSWalkerEnhanced.cs create mode 100644 FieldLight.cs create mode 100644 GlowOn.cs create mode 100644 GunAnimSounds.cs create mode 100644 RigidbodyFPSWalker.cs create mode 100644 Shoot.cs create mode 100644 SimpleSmoothMouseLook.cs diff --git a/BarScript.cs b/BarScript.cs new file mode 100644 index 0000000..f60736b --- /dev/null +++ b/BarScript.cs @@ -0,0 +1,31 @@ +using UnityEngine; +using System.Collections; +using UnityEngine.UI; + +public class BarScript : MonoBehaviour { + + public RigidbodyFPSWalker rfps; + + [SerializeField] + private float fillAmount = 1; + + [SerializeField] + private Image content; + + + + // Use this for initialization + void Start () { + + } + + // Update is called once per frame + void Update () { + HandleBar (); + } + + private void HandleBar(){ + + content.fillAmount = (rfps.chaseLimit / rfps.limit); + } +} diff --git a/Crosshair.cs b/Crosshair.cs new file mode 100644 index 0000000..2365279 --- /dev/null +++ b/Crosshair.cs @@ -0,0 +1,9 @@ +using UnityEngine; +using System.Collections; + +public class Crosshair : MonoBehaviour { + + void OnGUI(){ + GUI.Box(new Rect((Screen.width/2) - 5,(Screen.height/2) - 5, 10, 10), ""); + } +} diff --git a/DestroyCubes.cs b/DestroyCubes.cs new file mode 100644 index 0000000..4b38b55 --- /dev/null +++ b/DestroyCubes.cs @@ -0,0 +1,19 @@ +using UnityEngine; +using System.Collections; + +public class DestroyCubes : MonoBehaviour +{ + void OnCollisionEnter (Collision col) + { + if (col.gameObject.tag == "Enemy") { + Destroy (col.gameObject); + Destroy (this.gameObject); + } else if (col.gameObject.tag == "Terrain" || col.gameObject.tag == "Untagged") { + Destroy (this.gameObject); + } + else if (col.gameObject.tag == "Light Object") { + + } + + } +} \ No newline at end of file diff --git a/FPSWalkerEnhanced.cs b/FPSWalkerEnhanced.cs new file mode 100644 index 0000000..fe50d6d --- /dev/null +++ b/FPSWalkerEnhanced.cs @@ -0,0 +1,159 @@ +using UnityEngine; +using System.Collections; + +[RequireComponent (typeof (CharacterController))] +public class FPSWalkerEnhanced: MonoBehaviour { + + public float walkSpeed = 6.0f; + + public float runSpeed = 11.0f; + + // If true, diagonal speed (when strafing + moving forward or back) can't exceed normal move speed; otherwise it's about 1.4 times faster + public bool limitDiagonalSpeed = true; + + // If checked, the run key toggles between running and walking. Otherwise player runs if the key is held down and walks otherwise + // There must be a button set up in the Input Manager called "Run" + public bool toggleRun = false; + + public float jumpSpeed = 8.0f; + public float gravity = 20.0f; + + // Units that player can fall before a falling damage function is run. To disable, type "infinity" in the inspector + public float fallingDamageThreshold = 10.0f; + + // If the player ends up on a slope which is at least the Slope Limit as set on the character controller, then he will slide down + public bool slideWhenOverSlopeLimit = false; + + // If checked and the player is on an object tagged "Slide", he will slide down it regardless of the slope limit + public bool slideOnTaggedObjects = false; + + public float slideSpeed = 12.0f; + + // If checked, then the player can change direction while in the air + public bool airControl = false; + + // Small amounts of this results in bumping when walking down slopes, but large amounts results in falling too fast + public float antiBumpFactor = .75f; + + // Player must be grounded for at least this many physics frames before being able to jump again; set to 0 to allow bunny hopping + public int antiBunnyHopFactor = 1; + + private Vector3 moveDirection = Vector3.zero; + private bool grounded = false; + private CharacterController controller; + private Transform myTransform; + private float speed; + private RaycastHit hit; + private float fallStartLevel; + private bool falling; + private float slideLimit; + private float rayDistance; + private Vector3 contactPoint; + private bool playerControl = false; + private int jumpTimer; + + void Start() { + controller = GetComponent(); + myTransform = transform; + speed = walkSpeed; + rayDistance = controller.height * .5f + controller.radius; + slideLimit = controller.slopeLimit - .1f; + jumpTimer = antiBunnyHopFactor; + } + + void FixedUpdate() { + float inputX = Input.GetAxis("Horizontal"); + float inputY = Input.GetAxis("Vertical"); + // If both horizontal and vertical are used simultaneously, limit speed (if allowed), so the total doesn't exceed normal move speed + float inputModifyFactor = (inputX != 0.0f && inputY != 0.0f && limitDiagonalSpeed)? .7071f : 1.0f; + + if (grounded) { + bool sliding = false; + // See if surface immediately below should be slid down. We use this normally rather than a ControllerColliderHit point, + // because that interferes with step climbing amongst other annoyances + if (Physics.Raycast(myTransform.position, -Vector3.up, out hit, rayDistance)) { + if (Vector3.Angle(hit.normal, Vector3.up) > slideLimit) + sliding = true; + } + // However, just raycasting straight down from the center can fail when on steep slopes + // So if the above raycast didn't catch anything, raycast down from the stored ControllerColliderHit point instead + else { + Physics.Raycast(contactPoint + Vector3.up, -Vector3.up, out hit); + if (Vector3.Angle(hit.normal, Vector3.up) > slideLimit) + sliding = true; + } + + // If we were falling, and we fell a vertical distance greater than the threshold, run a falling damage routine + if (falling) { + falling = false; + if (myTransform.position.y < fallStartLevel - fallingDamageThreshold) + FallingDamageAlert (fallStartLevel - myTransform.position.y); + } + + // If running isn't on a toggle, then use the appropriate speed depending on whether the run button is down + if (!toggleRun) + speed = Input.GetButton("Run")? runSpeed : walkSpeed; + + // If sliding (and it's allowed), or if we're on an object tagged "Slide", get a vector pointing down the slope we're on + if ( (sliding && slideWhenOverSlopeLimit) || (slideOnTaggedObjects && hit.collider.tag == "Slide") ) { + Vector3 hitNormal = hit.normal; + moveDirection = new Vector3(hitNormal.x, -hitNormal.y, hitNormal.z); + Vector3.OrthoNormalize (ref hitNormal, ref moveDirection); + moveDirection *= slideSpeed; + playerControl = false; + } + // Otherwise recalculate moveDirection directly from axes, adding a bit of -y to avoid bumping down inclines + else { + moveDirection = new Vector3(inputX * inputModifyFactor, -antiBumpFactor, inputY * inputModifyFactor); + moveDirection = myTransform.TransformDirection(moveDirection) * speed; + playerControl = true; + } + + // Jump! But only if the jump button has been released and player has been grounded for a given number of frames + if (!Input.GetButton("Jump")) + jumpTimer++; + else if (jumpTimer >= antiBunnyHopFactor) { + moveDirection.y = jumpSpeed; + jumpTimer = 0; + } + } + else { + // If we stepped over a cliff or something, set the height at which we started falling + if (!falling) { + falling = true; + fallStartLevel = myTransform.position.y; + } + + // If air control is allowed, check movement but don't touch the y component + if (airControl && playerControl) { + moveDirection.x = inputX * speed * inputModifyFactor; + moveDirection.z = inputY * speed * inputModifyFactor; + moveDirection = myTransform.TransformDirection(moveDirection); + } + } + + // Apply gravity + moveDirection.y -= gravity * Time.deltaTime; + + // Move the controller, and set grounded true or false depending on whether we're standing on something + grounded = (controller.Move(moveDirection * Time.deltaTime) & CollisionFlags.Below) != 0; + } + + void Update () { + // If the run button is set to toggle, then switch between walk/run speed. (We use Update for this... + // FixedUpdate is a poor place to use GetButtonDown, since it doesn't necessarily run every frame and can miss the event) + if (toggleRun && grounded && Input.GetButtonDown("Run")) + speed = (speed == walkSpeed? runSpeed : walkSpeed); + } + + // Store point that we're in contact with for use in FixedUpdate if needed + void OnControllerColliderHit (ControllerColliderHit hit) { + contactPoint = hit.point; + } + + // If falling damage occured, this is the place to do something about it. You can make the player + // have hitpoints and remove some of them based on the distance fallen, add sound effects, etc. + void FallingDamageAlert (float fallDistance) { + print ("Ouch! Fell " + fallDistance + " units!"); + } +} \ No newline at end of file diff --git a/FieldLight.cs b/FieldLight.cs new file mode 100644 index 0000000..4ce6849 --- /dev/null +++ b/FieldLight.cs @@ -0,0 +1,15 @@ +using UnityEngine; +using System.Collections; + +public class FieldLight : MonoBehaviour { + + // Use this for initialization + void Start () { + + } + + // Update is called once per frame + void Update () { + + } +} diff --git a/GlowOn.cs b/GlowOn.cs new file mode 100644 index 0000000..9081ac3 --- /dev/null +++ b/GlowOn.cs @@ -0,0 +1,41 @@ +using UnityEngine; +using System.Collections; + +public class GlowOn : MonoBehaviour { + public int lightOn = -1; + public Material matWhite; + public Material matBlack; + public float targetTimeDuration = 2.0f; + public float timeCounter = 0.0f; + + // Use this for initialization + void Start () { + + } + + void Update() { + + if (lightOn == -1) { + GetComponent ().material = matBlack; + } else if (lightOn == 1) { + GetComponent ().material = matWhite; + } + if (timeCounter > targetTimeDuration) { + lightOn = -1; + timeCounter = 0; + + } + timeCounter += Time.deltaTime; + } + + void OnCollisionEnter (Collision col){ + if (col.gameObject.tag == "Projectile") { + lightOn *= -1; + timeCounter = 0; + } else if (col.gameObject.tag == "Player") { + lightOn = 1; + timeCounter = 0; + + } + } +} diff --git a/GunAnimSounds.cs b/GunAnimSounds.cs new file mode 100644 index 0000000..9d96f27 --- /dev/null +++ b/GunAnimSounds.cs @@ -0,0 +1,27 @@ +using UnityEngine; +using System.Collections; + +public class GunAnimSound : MonoBehaviour { + + public float delayTime = 1f; + private float counter = 0f; + + // Use this for initialization + void Start () { + + } + + void Awake () + { + } + + // Update is called once per frame + void FixedUpdate () { + if (Input.GetButtonDown("Fire1") && counter > delayTime) + { + + counter = 0; + } + counter += Time.deltaTime; + } +} \ No newline at end of file diff --git a/RigidbodyFPSWalker.cs b/RigidbodyFPSWalker.cs new file mode 100644 index 0000000..41eef03 --- /dev/null +++ b/RigidbodyFPSWalker.cs @@ -0,0 +1,146 @@ +using UnityEngine; +using System.Collections; + +[RequireComponent (typeof (Rigidbody))] +[RequireComponent (typeof (CapsuleCollider))] + +public class RigidbodyFPSWalker : MonoBehaviour{ + + public float speed = 10.0f; + public float gravity = 10.0f; + public float maxVelocityChange = 10.0f; + public bool canJump = true; + public float jumpHeight = 2.0f; + public float thrust = 4; + public float limit = 1.0f; + public float chaseLimit; + public Rigidbody jetpackUser; + public bool isJumping = false; + public float regenFactor = 4f; + public float deprecFactor = 2f; + private bool grounded = false; + private bool isFlying = false; + private bool inAir = false; + private bool gotFuel = true; + private float chaseThrust; + + + void Awake () { + GetComponent().freezeRotation = true; + GetComponent().useGravity = false; + } + + void Start(){ + chaseLimit = limit; + chaseThrust = thrust; + } + + void FixedUpdate () { + if (isJumping || inAir) { + inAir = true; + grounded = false; + } else { + inAir = false; + grounded = true; + } + JetpackFuel (); + Jetpack (); + + + if (grounded || inAir || isJumping) { + Move (); + + } + + + // We apply gravity manually for more tuning control + GetComponent().AddForce(new Vector3 (0, -gravity * GetComponent().mass, 0)); + grounded = false; + } + + void Move(){ + // Calculate how fast we should be moving + Vector3 targetVelocity = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); + targetVelocity = transform.TransformDirection(targetVelocity); + targetVelocity *= speed; + + // Apply a force that attempts to reach our target velocity + Vector3 velocity = GetComponent().velocity; + Vector3 velocityChange = (targetVelocity - velocity); + velocityChange.x = Mathf.Clamp(velocityChange.x, -maxVelocityChange, maxVelocityChange); + velocityChange.z = Mathf.Clamp(velocityChange.z, -maxVelocityChange, maxVelocityChange); + velocityChange.y = 0; + GetComponent().AddForce(velocityChange, ForceMode.VelocityChange); + + + if (canJump && Input.GetButtonDown ("Jump") && grounded) { + GetComponent ().velocity = new Vector3 (velocity.x, CalculateJumpVerticalSpeed (), velocity.z); + isJumping = true; + } + else if (inAir && Input.GetButton("Jump")) { + isJumping = true; + } + else { + isJumping = false; + } + + } + + + void OnCollisionStay (Collision col) { + if (col.gameObject.tag == "Terrain") { + grounded = true; + inAir = false; + } + } + + void JetpackFuel() { + bool fullTank = false; + + if (chaseLimit < 0) { + gotFuel = false; + fullTank = false; + chaseLimit = 0; + } else if (chaseLimit == limit) { + fullTank = true; + gotFuel = true; + } else { + gotFuel = true; + fullTank = false; + } + + if (isFlying) { + chaseLimit -= Time.deltaTime / (deprecFactor / 2f); + } else if (!fullTank && (grounded || Input.GetButtonDown("Jump"))) { + + if (limit - chaseLimit <= 0.01f) { + chaseLimit = limit; + } else { + chaseLimit += Time.deltaTime / regenFactor; + } + + } + + } + + void Jetpack() { + Vector3 velocity = GetComponent().velocity; + float jumpSpeed = 1f; + if (Input.GetButton ("Fire2") && gotFuel && chaseLimit > 0) { + jumpSpeed = thrust * chaseLimit; + jetpackUser.velocity = new Vector3 (velocity.x, jumpSpeed, velocity.z); + inAir = true; + isFlying = true; + } else { + + isFlying = false; + } + + } + + float CalculateJumpVerticalSpeed () { + // From the jump height and gravity we deduce the upwards speed + // for the character to reach at the apex. + return Mathf.Sqrt(2 * jumpHeight * gravity); + } +} \ No newline at end of file diff --git a/Shoot.cs b/Shoot.cs new file mode 100644 index 0000000..f8a35b2 --- /dev/null +++ b/Shoot.cs @@ -0,0 +1,33 @@ +using UnityEngine; +using System.Collections; + +[RequireComponent (typeof (AudioSource))] +[RequireComponent (typeof (Animation))] + + +public class Shoot : MonoBehaviour +{ + + public GameObject bullet; + public float delayTime = 1f; + private float counter = 0f; + + // Use this for initialization + void Start() + { + + } + + // Update is called once per frame + void FixedUpdate() + { + if (Input.GetButtonDown("Fire1") && counter > delayTime) + { + Instantiate(bullet, transform.position, transform.rotation); + GetComponent().Play(); + GetComponent().Play(); + counter = 0; + } + counter += Time.deltaTime; + } +} \ No newline at end of file diff --git a/SimpleSmoothMouseLook.cs b/SimpleSmoothMouseLook.cs new file mode 100644 index 0000000..7c0deb0 --- /dev/null +++ b/SimpleSmoothMouseLook.cs @@ -0,0 +1,80 @@ +using UnityEngine; + +// Very simple smooth mouselook modifier for the MainCamera in Unity +// by Francis R. Griffiths-Keam - www.runningdimensions.com + +[AddComponentMenu("Camera/Simple Smooth Mouse Look ")] +public class SimpleSmoothMouseLook : MonoBehaviour +{ + Vector2 _mouseAbsolute; + Vector2 _smoothMouse; + + public Vector2 clampInDegrees = new Vector2(360, 180); + public bool lockCursor; + public Vector2 sensitivity = new Vector2(2, 2); + public Vector2 smoothing = new Vector2(3, 3); + public Vector2 targetDirection; + public Vector2 targetCharacterDirection; + + // Assign this if there's a parent object controlling motion, such as a Character Controller. + // Yaw rotation will affect this object instead of the camera if set. + public GameObject characterBody; + + void Start() + { + // Set target direction to the camera's initial orientation. + targetDirection = transform.localRotation.eulerAngles; + + // Set target direction for the character body to its inital state. + if (characterBody) targetCharacterDirection = characterBody.transform.localRotation.eulerAngles; + } + + void Update() + { + // Ensure the cursor is always locked when set + Screen.lockCursor = lockCursor; + + // Allow the script to clamp based on a desired target value. + var targetOrientation = Quaternion.Euler(targetDirection); + var targetCharacterOrientation = Quaternion.Euler(targetCharacterDirection); + + // Get raw mouse input for a cleaner reading on more sensitive mice. + var mouseDelta = new Vector2(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y")); + + // Scale input against the sensitivity setting and multiply that against the smoothing value. + mouseDelta = Vector2.Scale(mouseDelta, new Vector2(sensitivity.x * smoothing.x, sensitivity.y * smoothing.y)); + + // Interpolate mouse movement over time to apply smoothing delta. + _smoothMouse.x = Mathf.Lerp(_smoothMouse.x, mouseDelta.x, 1f / smoothing.x); + _smoothMouse.y = Mathf.Lerp(_smoothMouse.y, mouseDelta.y, 1f / smoothing.y); + + // Find the absolute mouse movement value from point zero. + _mouseAbsolute += _smoothMouse; + + // Clamp and apply the local x value first, so as not to be affected by world transforms. + if (clampInDegrees.x < 360) + _mouseAbsolute.x = Mathf.Clamp(_mouseAbsolute.x, -clampInDegrees.x * 0.5f, clampInDegrees.x * 0.5f); + + var xRotation = Quaternion.AngleAxis(-_mouseAbsolute.y, targetOrientation * Vector3.right); + transform.localRotation = xRotation; + + // Then clamp and apply the global y value. + if (clampInDegrees.y < 360) + _mouseAbsolute.y = Mathf.Clamp(_mouseAbsolute.y, -clampInDegrees.y * 0.5f, clampInDegrees.y * 0.5f); + + transform.localRotation *= targetOrientation; + + // If there's a character body that acts as a parent to the camera + if (characterBody) + { + var yRotation = Quaternion.AngleAxis(_mouseAbsolute.x, characterBody.transform.up); + characterBody.transform.localRotation = yRotation; + characterBody.transform.localRotation *= targetCharacterOrientation; + } + else + { + var yRotation = Quaternion.AngleAxis(_mouseAbsolute.x, transform.InverseTransformDirection(Vector3.up)); + transform.localRotation *= yRotation; + } + } +} diff --git a/WepScript.cs b/WepScript.cs index c0ebad4..a9443e6 100644 --- a/WepScript.cs +++ b/WepScript.cs @@ -1,67 +1,79 @@ -using UnityEngine; -using System.Collections; - -public class wepScript : MonoBehaviour { - - public Camera fpsCam; - public GameObject hitPar; - public int damage = 30; - public int range = 10000; - public int ammo = 10; - public int clipSize = 10; - public int clipCount = 5; - - public Animation am; - public AnimationClip shoot; - public AnimationClip reloadA; - - - - - void Update(){ - if (Input.GetMouseButton (0)) { - fireShot (); - } - - if (Input.GetKeyDown (KeyCode.R)) { - reload(); - } - } - - public void fireShot(){ - if (!am.IsPlaying (reloadA.name) && ammo >= 1) { - if(!am.IsPlaying (shoot.name)){ - am.CrossFade (shoot.name); - ammo = ammo - 1; - - RaycastHit hit; - Ray ray = fpsCam.ScreenPointToRay (new Vector3 (Screen.width / 2, Screen.height / 2, 0)); - - if (Physics.Raycast (ray, out hit, range)) { - if (hit.transform.tag == "Player") { - hit.transform.GetComponent ().RPC ("applyDamage", PhotonTargets.AllBuffered, damage); - } - GameObject particleClone; - particleClone = PhotonNetwork.Instantiate (hitPar.name, hit.point, Quaternion.LookRotation (hit.normal), 0) as GameObject; - Destroy (particleClone, 2); - Debug.Log (hit.transform.name); - - } - } - - } - } - - public void reload(){ - if (clipCount >= 1) { - am.CrossFade (reloadA.name); - ammo = clipSize; - clipCount = clipCount - 1; - } - - } - - void OnGUI(){ - GUI.Box (new Rect(110,10,150,30), "Ammo: " + ammo + "/" + clipSize + "/" + clipCount); - } -} +using UnityEngine; +using System.Collections; + +public class WepScript : MonoBehaviour +{ + public GameObject enemy; + public Rigidbody projectile; + public float speed = 40f; + public float shootDelay = 0.5f; + public int magazineSize = 3; + public int currRounds = 3; + public int totalAmmo = 90; + public float timeAlive = 2f; + public float gunSpread = 20f; + public float tilt = 1f; + public float reloadTime = 1f; + private float counter = 0.0f; + private bool reloading = false; + + // Update is called once per frame + void Update () + { + if (!reloading && Input.GetButton ("Fire1") && counter > shootDelay && currRounds > 0) { + ShottyBullet (); + currRounds -= 1; + counter = 0; + } else if (Input.GetButtonDown ("Reload")) + { + reloading = true; + Invoke("Reload", reloadTime); + } + Debug.Log (currRounds); + counter += Time.deltaTime; + } + + void Reload () + { + int difference = magazineSize - currRounds; + if (totalAmmo - difference >= 0) { + currRounds += difference; + totalAmmo -= difference; + } else if (totalAmmo - difference < 0) { + currRounds = totalAmmo; + totalAmmo = 0; + } + Debug.Log ("Total: " + totalAmmo); + reloading = false; + } + + void ShottyBullet () + { + Debug.Log (transform.position + " " + transform.rotation); + + Vector3 toZero = transform.TransformPoint (0, -0.3f, 1f); + Vector3 toRight = transform.TransformPoint (0.1f, -0.3f, 1f); + Vector3 toLeft = transform.TransformPoint (-0.1f, -0.3f, 1f); + + float zRightBullet = speed * Mathf.Cos(gunSpread * (Mathf.PI/180)); + float xRightBullet = speed * Mathf.Sin(gunSpread * (Mathf.PI/180)); + + + //var diagonalSpeed = Mathf.Pow(((speed * speed)/ 2), (0.5f)); + + Rigidbody instantiatedProjectile = Instantiate (projectile, toZero, transform.rotation)as Rigidbody; + instantiatedProjectile.velocity = transform.TransformDirection (new Vector3 (0, tilt, speed)); + + Rigidbody instantiatedProjectileRight = Instantiate (projectile, toRight, transform.rotation)as Rigidbody; + instantiatedProjectileRight.velocity = transform.TransformDirection (new Vector3 (xRightBullet, tilt, zRightBullet)); + + Rigidbody instantiatedProjectileLeft = Instantiate (projectile, toLeft, transform.rotation)as Rigidbody; + instantiatedProjectileLeft.velocity = transform.TransformDirection (new Vector3 (-xRightBullet, tilt, zRightBullet)); + + Destroy (instantiatedProjectile.gameObject, timeAlive); + Destroy (instantiatedProjectileRight.gameObject, timeAlive); + Destroy (instantiatedProjectileLeft.gameObject, timeAlive); + + + } +} \ No newline at end of file From 0fe2ca2042c3d09842d582559abe9a3df6edfc6b Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Tue, 14 Jun 2016 13:54:25 -0400 Subject: [PATCH 05/28] Create WepMelee.cs --- WepMelee.cs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 WepMelee.cs diff --git a/WepMelee.cs b/WepMelee.cs new file mode 100644 index 0000000..c57a9ab --- /dev/null +++ b/WepMelee.cs @@ -0,0 +1,31 @@ +using UnityEngine; +using System.Collections; + +public class WepMelee : MonoBehaviour +{ + public GameObject enemy; + + + public void Update (){ + Attack (); + yield WaitForSeconds(2); + + } + + void Attack(){ + if (Input.GetButtonDown ("Fire1")){ + Vector3 enemyDelta = (enemy.transform.position - transform.position); + if ( Vector3.Angle( transform.forward, enemyDelta ) < 45 ) + { + if ((enemy.transform.position - transform.position).magnitude < 2) { + enemy.health -= 1; + } + } + } + } + + + + + +} From 23c4cbf6713aed55a4b71763667d1ea540aa9e6f Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Thu, 16 Jun 2016 21:52:02 -0400 Subject: [PATCH 06/28] Delete BarScript.cs --- BarScript.cs | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 BarScript.cs diff --git a/BarScript.cs b/BarScript.cs deleted file mode 100644 index f60736b..0000000 --- a/BarScript.cs +++ /dev/null @@ -1,31 +0,0 @@ -using UnityEngine; -using System.Collections; -using UnityEngine.UI; - -public class BarScript : MonoBehaviour { - - public RigidbodyFPSWalker rfps; - - [SerializeField] - private float fillAmount = 1; - - [SerializeField] - private Image content; - - - - // Use this for initialization - void Start () { - - } - - // Update is called once per frame - void Update () { - HandleBar (); - } - - private void HandleBar(){ - - content.fillAmount = (rfps.chaseLimit / rfps.limit); - } -} From 6542484319441de0c205d356b7e683ad080eeff9 Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Thu, 16 Jun 2016 21:52:07 -0400 Subject: [PATCH 07/28] Delete Crosshair.cs --- Crosshair.cs | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 Crosshair.cs diff --git a/Crosshair.cs b/Crosshair.cs deleted file mode 100644 index 2365279..0000000 --- a/Crosshair.cs +++ /dev/null @@ -1,9 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class Crosshair : MonoBehaviour { - - void OnGUI(){ - GUI.Box(new Rect((Screen.width/2) - 5,(Screen.height/2) - 5, 10, 10), ""); - } -} From 9bbbfbd6023490893706c9dd91bbaab165ddd8fd Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Thu, 16 Jun 2016 21:52:12 -0400 Subject: [PATCH 08/28] Delete DestroyCubes.cs --- DestroyCubes.cs | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 DestroyCubes.cs diff --git a/DestroyCubes.cs b/DestroyCubes.cs deleted file mode 100644 index 4b38b55..0000000 --- a/DestroyCubes.cs +++ /dev/null @@ -1,19 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class DestroyCubes : MonoBehaviour -{ - void OnCollisionEnter (Collision col) - { - if (col.gameObject.tag == "Enemy") { - Destroy (col.gameObject); - Destroy (this.gameObject); - } else if (col.gameObject.tag == "Terrain" || col.gameObject.tag == "Untagged") { - Destroy (this.gameObject); - } - else if (col.gameObject.tag == "Light Object") { - - } - - } -} \ No newline at end of file From a2eb9b58de07e0ea5d4e409aabdbf2d5be1aaca8 Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Thu, 16 Jun 2016 21:52:18 -0400 Subject: [PATCH 09/28] Delete FPSWalkerEnhanced.cs --- FPSWalkerEnhanced.cs | 159 ------------------------------------------- 1 file changed, 159 deletions(-) delete mode 100644 FPSWalkerEnhanced.cs diff --git a/FPSWalkerEnhanced.cs b/FPSWalkerEnhanced.cs deleted file mode 100644 index fe50d6d..0000000 --- a/FPSWalkerEnhanced.cs +++ /dev/null @@ -1,159 +0,0 @@ -using UnityEngine; -using System.Collections; - -[RequireComponent (typeof (CharacterController))] -public class FPSWalkerEnhanced: MonoBehaviour { - - public float walkSpeed = 6.0f; - - public float runSpeed = 11.0f; - - // If true, diagonal speed (when strafing + moving forward or back) can't exceed normal move speed; otherwise it's about 1.4 times faster - public bool limitDiagonalSpeed = true; - - // If checked, the run key toggles between running and walking. Otherwise player runs if the key is held down and walks otherwise - // There must be a button set up in the Input Manager called "Run" - public bool toggleRun = false; - - public float jumpSpeed = 8.0f; - public float gravity = 20.0f; - - // Units that player can fall before a falling damage function is run. To disable, type "infinity" in the inspector - public float fallingDamageThreshold = 10.0f; - - // If the player ends up on a slope which is at least the Slope Limit as set on the character controller, then he will slide down - public bool slideWhenOverSlopeLimit = false; - - // If checked and the player is on an object tagged "Slide", he will slide down it regardless of the slope limit - public bool slideOnTaggedObjects = false; - - public float slideSpeed = 12.0f; - - // If checked, then the player can change direction while in the air - public bool airControl = false; - - // Small amounts of this results in bumping when walking down slopes, but large amounts results in falling too fast - public float antiBumpFactor = .75f; - - // Player must be grounded for at least this many physics frames before being able to jump again; set to 0 to allow bunny hopping - public int antiBunnyHopFactor = 1; - - private Vector3 moveDirection = Vector3.zero; - private bool grounded = false; - private CharacterController controller; - private Transform myTransform; - private float speed; - private RaycastHit hit; - private float fallStartLevel; - private bool falling; - private float slideLimit; - private float rayDistance; - private Vector3 contactPoint; - private bool playerControl = false; - private int jumpTimer; - - void Start() { - controller = GetComponent(); - myTransform = transform; - speed = walkSpeed; - rayDistance = controller.height * .5f + controller.radius; - slideLimit = controller.slopeLimit - .1f; - jumpTimer = antiBunnyHopFactor; - } - - void FixedUpdate() { - float inputX = Input.GetAxis("Horizontal"); - float inputY = Input.GetAxis("Vertical"); - // If both horizontal and vertical are used simultaneously, limit speed (if allowed), so the total doesn't exceed normal move speed - float inputModifyFactor = (inputX != 0.0f && inputY != 0.0f && limitDiagonalSpeed)? .7071f : 1.0f; - - if (grounded) { - bool sliding = false; - // See if surface immediately below should be slid down. We use this normally rather than a ControllerColliderHit point, - // because that interferes with step climbing amongst other annoyances - if (Physics.Raycast(myTransform.position, -Vector3.up, out hit, rayDistance)) { - if (Vector3.Angle(hit.normal, Vector3.up) > slideLimit) - sliding = true; - } - // However, just raycasting straight down from the center can fail when on steep slopes - // So if the above raycast didn't catch anything, raycast down from the stored ControllerColliderHit point instead - else { - Physics.Raycast(contactPoint + Vector3.up, -Vector3.up, out hit); - if (Vector3.Angle(hit.normal, Vector3.up) > slideLimit) - sliding = true; - } - - // If we were falling, and we fell a vertical distance greater than the threshold, run a falling damage routine - if (falling) { - falling = false; - if (myTransform.position.y < fallStartLevel - fallingDamageThreshold) - FallingDamageAlert (fallStartLevel - myTransform.position.y); - } - - // If running isn't on a toggle, then use the appropriate speed depending on whether the run button is down - if (!toggleRun) - speed = Input.GetButton("Run")? runSpeed : walkSpeed; - - // If sliding (and it's allowed), or if we're on an object tagged "Slide", get a vector pointing down the slope we're on - if ( (sliding && slideWhenOverSlopeLimit) || (slideOnTaggedObjects && hit.collider.tag == "Slide") ) { - Vector3 hitNormal = hit.normal; - moveDirection = new Vector3(hitNormal.x, -hitNormal.y, hitNormal.z); - Vector3.OrthoNormalize (ref hitNormal, ref moveDirection); - moveDirection *= slideSpeed; - playerControl = false; - } - // Otherwise recalculate moveDirection directly from axes, adding a bit of -y to avoid bumping down inclines - else { - moveDirection = new Vector3(inputX * inputModifyFactor, -antiBumpFactor, inputY * inputModifyFactor); - moveDirection = myTransform.TransformDirection(moveDirection) * speed; - playerControl = true; - } - - // Jump! But only if the jump button has been released and player has been grounded for a given number of frames - if (!Input.GetButton("Jump")) - jumpTimer++; - else if (jumpTimer >= antiBunnyHopFactor) { - moveDirection.y = jumpSpeed; - jumpTimer = 0; - } - } - else { - // If we stepped over a cliff or something, set the height at which we started falling - if (!falling) { - falling = true; - fallStartLevel = myTransform.position.y; - } - - // If air control is allowed, check movement but don't touch the y component - if (airControl && playerControl) { - moveDirection.x = inputX * speed * inputModifyFactor; - moveDirection.z = inputY * speed * inputModifyFactor; - moveDirection = myTransform.TransformDirection(moveDirection); - } - } - - // Apply gravity - moveDirection.y -= gravity * Time.deltaTime; - - // Move the controller, and set grounded true or false depending on whether we're standing on something - grounded = (controller.Move(moveDirection * Time.deltaTime) & CollisionFlags.Below) != 0; - } - - void Update () { - // If the run button is set to toggle, then switch between walk/run speed. (We use Update for this... - // FixedUpdate is a poor place to use GetButtonDown, since it doesn't necessarily run every frame and can miss the event) - if (toggleRun && grounded && Input.GetButtonDown("Run")) - speed = (speed == walkSpeed? runSpeed : walkSpeed); - } - - // Store point that we're in contact with for use in FixedUpdate if needed - void OnControllerColliderHit (ControllerColliderHit hit) { - contactPoint = hit.point; - } - - // If falling damage occured, this is the place to do something about it. You can make the player - // have hitpoints and remove some of them based on the distance fallen, add sound effects, etc. - void FallingDamageAlert (float fallDistance) { - print ("Ouch! Fell " + fallDistance + " units!"); - } -} \ No newline at end of file From a64da3792ac5b4c18029efe1f2c99cf8bb55f7f4 Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Thu, 16 Jun 2016 21:52:23 -0400 Subject: [PATCH 10/28] Delete FieldLight.cs --- FieldLight.cs | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 FieldLight.cs diff --git a/FieldLight.cs b/FieldLight.cs deleted file mode 100644 index 4ce6849..0000000 --- a/FieldLight.cs +++ /dev/null @@ -1,15 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class FieldLight : MonoBehaviour { - - // Use this for initialization - void Start () { - - } - - // Update is called once per frame - void Update () { - - } -} From b1262fb26a01297c0718337a4c421d944c634008 Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Thu, 16 Jun 2016 21:52:28 -0400 Subject: [PATCH 11/28] Delete GlowOn.cs --- GlowOn.cs | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 GlowOn.cs diff --git a/GlowOn.cs b/GlowOn.cs deleted file mode 100644 index 9081ac3..0000000 --- a/GlowOn.cs +++ /dev/null @@ -1,41 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class GlowOn : MonoBehaviour { - public int lightOn = -1; - public Material matWhite; - public Material matBlack; - public float targetTimeDuration = 2.0f; - public float timeCounter = 0.0f; - - // Use this for initialization - void Start () { - - } - - void Update() { - - if (lightOn == -1) { - GetComponent ().material = matBlack; - } else if (lightOn == 1) { - GetComponent ().material = matWhite; - } - if (timeCounter > targetTimeDuration) { - lightOn = -1; - timeCounter = 0; - - } - timeCounter += Time.deltaTime; - } - - void OnCollisionEnter (Collision col){ - if (col.gameObject.tag == "Projectile") { - lightOn *= -1; - timeCounter = 0; - } else if (col.gameObject.tag == "Player") { - lightOn = 1; - timeCounter = 0; - - } - } -} From 603f47d7192c35f5e422dfd6b6f464c176f835d9 Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Thu, 16 Jun 2016 21:52:32 -0400 Subject: [PATCH 12/28] Delete GunAnimSounds.cs --- GunAnimSounds.cs | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 GunAnimSounds.cs diff --git a/GunAnimSounds.cs b/GunAnimSounds.cs deleted file mode 100644 index 9d96f27..0000000 --- a/GunAnimSounds.cs +++ /dev/null @@ -1,27 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class GunAnimSound : MonoBehaviour { - - public float delayTime = 1f; - private float counter = 0f; - - // Use this for initialization - void Start () { - - } - - void Awake () - { - } - - // Update is called once per frame - void FixedUpdate () { - if (Input.GetButtonDown("Fire1") && counter > delayTime) - { - - counter = 0; - } - counter += Time.deltaTime; - } -} \ No newline at end of file From e21d4461d47d2b7a9739fa5f95cc1baaad42f2c3 Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Thu, 16 Jun 2016 21:52:39 -0400 Subject: [PATCH 13/28] Delete RigidbodyFPSController.cs --- RigidbodyFPSController.cs | 59 --------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 RigidbodyFPSController.cs diff --git a/RigidbodyFPSController.cs b/RigidbodyFPSController.cs deleted file mode 100644 index df11119..0000000 --- a/RigidbodyFPSController.cs +++ /dev/null @@ -1,59 +0,0 @@ -using UnityEngine; -using System.Collections; - -[RequireComponent (typeof (Rigidbody))] -[RequireComponent (typeof (CapsuleCollider))] - -public class CharacterControls : MonoBehaviour { - - public float speed = 10.0f; - public float gravity = 10.0f; - public float maxVelocityChange = 10.0f; - public bool canJump = true; - public float jumpHeight = 2.0f; - private bool grounded = false; - - - - void Awake () { - rigidbody.freezeRotation = true; - rigidbody.useGravity = false; - } - - void FixedUpdate () { - if (grounded) { - // Calculate how fast we should be moving - Vector3 targetVelocity = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); - targetVelocity = transform.TransformDirection(targetVelocity); - targetVelocity *= speed; - - // Apply a force that attempts to reach our target velocity - Vector3 velocity = rigidbody.velocity; - Vector3 velocityChange = (targetVelocity - velocity); - velocityChange.x = Mathf.Clamp(velocityChange.x, -maxVelocityChange, maxVelocityChange); - velocityChange.z = Mathf.Clamp(velocityChange.z, -maxVelocityChange, maxVelocityChange); - velocityChange.y = 0; - rigidbody.AddForce(velocityChange, ForceMode.VelocityChange); - - // Jump - if (canJump && Input.GetButton("Jump")) { - rigidbody.velocity = new Vector3(velocity.x, CalculateJumpVerticalSpeed(), velocity.z); - } - } - - // We apply gravity manually for more tuning control - rigidbody.AddForce(new Vector3 (0, -gravity * rigidbody.mass, 0)); - - grounded = false; - } - - void OnCollisionStay () { - grounded = true; - } - - float CalculateJumpVerticalSpeed () { - // From the jump height and gravity we deduce the upwards speed - // for the character to reach at the apex. - return Mathf.Sqrt(2 * jumpHeight * gravity); - } -} From f01a3ce2cd25aced21b7c940e2498202ad740b90 Mon Sep 17 00:00:00 2001 From: Vincent Mak Date: Thu, 16 Jun 2016 21:53:16 -0400 Subject: [PATCH 14/28] Create WoodDestruction.cs --- WoodDestruction.cs | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 WoodDestruction.cs diff --git a/WoodDestruction.cs b/WoodDestruction.cs new file mode 100644 index 0000000..b21aadd --- /dev/null +++ b/WoodDestruction.cs @@ -0,0 +1,56 @@ +using UnityEngine; +using System.Collections; + +public class WoodDestruction : MonoBehaviour +{ + public static bool initialHit = false; + public static bool woodDestroy = false; + public static bool hitWoodAbove = false; + public GameObject debrisPrefab; + [SerializeField]private int destructionStage = 0; + + + // Use this for initialization + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } + + void OnCollisionEnter(Collision col) + { + + if (initialHit == true) + { + destructionStage += 1; + Debug.Log(destructionStage); + initialHit = false; + } + + if (destructionStage == 3 && hitWoodAbove == false) + { + // setting up position of debris such that it doesnt spawn in the air, rather on the ground + transform.position = new Vector3(transform.position.x, -0.5f, transform.position.z); + Instantiate(debrisPrefab, transform.position, transform.rotation); + + // switching woodDestroy true which effects BulletHole script, destroying bulletholes on the wall at the same time the wall breaks + woodDestroy = true; + Destroy(this.gameObject); + } + if (destructionStage == 3 && hitWoodAbove == true) + { + Instantiate(debrisPrefab, transform.position, transform.rotation); + woodDestroy = true; + Destroy(this.gameObject); + } + else + { + woodDestroy = false; + } + } +} From 12fa700ffb7e9c7305db93356a91693ea3a4303e Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Thu, 16 Jun 2016 21:54:08 -0400 Subject: [PATCH 15/28] Delete RigidbodyFPSWalker.cs --- RigidbodyFPSWalker.cs | 146 ------------------------------------------ 1 file changed, 146 deletions(-) delete mode 100644 RigidbodyFPSWalker.cs diff --git a/RigidbodyFPSWalker.cs b/RigidbodyFPSWalker.cs deleted file mode 100644 index 41eef03..0000000 --- a/RigidbodyFPSWalker.cs +++ /dev/null @@ -1,146 +0,0 @@ -using UnityEngine; -using System.Collections; - -[RequireComponent (typeof (Rigidbody))] -[RequireComponent (typeof (CapsuleCollider))] - -public class RigidbodyFPSWalker : MonoBehaviour{ - - public float speed = 10.0f; - public float gravity = 10.0f; - public float maxVelocityChange = 10.0f; - public bool canJump = true; - public float jumpHeight = 2.0f; - public float thrust = 4; - public float limit = 1.0f; - public float chaseLimit; - public Rigidbody jetpackUser; - public bool isJumping = false; - public float regenFactor = 4f; - public float deprecFactor = 2f; - private bool grounded = false; - private bool isFlying = false; - private bool inAir = false; - private bool gotFuel = true; - private float chaseThrust; - - - void Awake () { - GetComponent().freezeRotation = true; - GetComponent().useGravity = false; - } - - void Start(){ - chaseLimit = limit; - chaseThrust = thrust; - } - - void FixedUpdate () { - if (isJumping || inAir) { - inAir = true; - grounded = false; - } else { - inAir = false; - grounded = true; - } - JetpackFuel (); - Jetpack (); - - - if (grounded || inAir || isJumping) { - Move (); - - } - - - // We apply gravity manually for more tuning control - GetComponent().AddForce(new Vector3 (0, -gravity * GetComponent().mass, 0)); - grounded = false; - } - - void Move(){ - // Calculate how fast we should be moving - Vector3 targetVelocity = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); - targetVelocity = transform.TransformDirection(targetVelocity); - targetVelocity *= speed; - - // Apply a force that attempts to reach our target velocity - Vector3 velocity = GetComponent().velocity; - Vector3 velocityChange = (targetVelocity - velocity); - velocityChange.x = Mathf.Clamp(velocityChange.x, -maxVelocityChange, maxVelocityChange); - velocityChange.z = Mathf.Clamp(velocityChange.z, -maxVelocityChange, maxVelocityChange); - velocityChange.y = 0; - GetComponent().AddForce(velocityChange, ForceMode.VelocityChange); - - - if (canJump && Input.GetButtonDown ("Jump") && grounded) { - GetComponent ().velocity = new Vector3 (velocity.x, CalculateJumpVerticalSpeed (), velocity.z); - isJumping = true; - } - else if (inAir && Input.GetButton("Jump")) { - isJumping = true; - } - else { - isJumping = false; - } - - } - - - void OnCollisionStay (Collision col) { - if (col.gameObject.tag == "Terrain") { - grounded = true; - inAir = false; - } - } - - void JetpackFuel() { - bool fullTank = false; - - if (chaseLimit < 0) { - gotFuel = false; - fullTank = false; - chaseLimit = 0; - } else if (chaseLimit == limit) { - fullTank = true; - gotFuel = true; - } else { - gotFuel = true; - fullTank = false; - } - - if (isFlying) { - chaseLimit -= Time.deltaTime / (deprecFactor / 2f); - } else if (!fullTank && (grounded || Input.GetButtonDown("Jump"))) { - - if (limit - chaseLimit <= 0.01f) { - chaseLimit = limit; - } else { - chaseLimit += Time.deltaTime / regenFactor; - } - - } - - } - - void Jetpack() { - Vector3 velocity = GetComponent().velocity; - float jumpSpeed = 1f; - if (Input.GetButton ("Fire2") && gotFuel && chaseLimit > 0) { - jumpSpeed = thrust * chaseLimit; - jetpackUser.velocity = new Vector3 (velocity.x, jumpSpeed, velocity.z); - inAir = true; - isFlying = true; - } else { - - isFlying = false; - } - - } - - float CalculateJumpVerticalSpeed () { - // From the jump height and gravity we deduce the upwards speed - // for the character to reach at the apex. - return Mathf.Sqrt(2 * jumpHeight * gravity); - } -} \ No newline at end of file From adf4f150fec9392025f7b420b351e2386763f5bb Mon Sep 17 00:00:00 2001 From: Vincent Mak Date: Thu, 16 Jun 2016 21:54:09 -0400 Subject: [PATCH 16/28] Create StackedWood.cs --- StackedWood.cs | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 StackedWood.cs diff --git a/StackedWood.cs b/StackedWood.cs new file mode 100644 index 0000000..43d459f --- /dev/null +++ b/StackedWood.cs @@ -0,0 +1,37 @@ +using UnityEngine; +using System.Collections; + +public class StackedWood : MonoBehaviour { + public static bool stackedHit = false; + public GameObject debrisPrefab; + public Rigidbody rb; + private float timer = 0; + private float counter = 0.53f; + + // Use this for initialization + void Start () { + rb = gameObject.GetComponent(); + } + + // Update is called once per frame + void Update () + { + RaycastHit hit; + Ray ray = new Ray(transform.position, -transform.up); + if (Physics.Raycast(ray, out hit, 5f)) + { + Debug.DrawLine(transform.position, hit.point, Color.green); + if (hit.collider.tag != "Wood" && hit.collider.tag != "Player") + { + rb.AddForce(Physics.gravity * rb.mass * 2.75f); + rb.isKinematic = false; + timer += Time.deltaTime; + + if (timer > counter) { + Destroy(this.gameObject); + Instantiate(debrisPrefab, transform.position, transform.rotation); + } + } + } + } +} From 535018502afb1d073efd6f2fe7850adf03d6c795 Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Thu, 16 Jun 2016 21:54:14 -0400 Subject: [PATCH 17/28] Delete Shoot.cs --- Shoot.cs | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 Shoot.cs diff --git a/Shoot.cs b/Shoot.cs deleted file mode 100644 index f8a35b2..0000000 --- a/Shoot.cs +++ /dev/null @@ -1,33 +0,0 @@ -using UnityEngine; -using System.Collections; - -[RequireComponent (typeof (AudioSource))] -[RequireComponent (typeof (Animation))] - - -public class Shoot : MonoBehaviour -{ - - public GameObject bullet; - public float delayTime = 1f; - private float counter = 0f; - - // Use this for initialization - void Start() - { - - } - - // Update is called once per frame - void FixedUpdate() - { - if (Input.GetButtonDown("Fire1") && counter > delayTime) - { - Instantiate(bullet, transform.position, transform.rotation); - GetComponent().Play(); - GetComponent().Play(); - counter = 0; - } - counter += Time.deltaTime; - } -} \ No newline at end of file From ae7a36d046af59e6b1895982942e506e44e2a9e3 Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Thu, 16 Jun 2016 21:54:19 -0400 Subject: [PATCH 18/28] Delete SimpleSmoothMouseLook.cs --- SimpleSmoothMouseLook.cs | 80 ---------------------------------------- 1 file changed, 80 deletions(-) delete mode 100644 SimpleSmoothMouseLook.cs diff --git a/SimpleSmoothMouseLook.cs b/SimpleSmoothMouseLook.cs deleted file mode 100644 index 7c0deb0..0000000 --- a/SimpleSmoothMouseLook.cs +++ /dev/null @@ -1,80 +0,0 @@ -using UnityEngine; - -// Very simple smooth mouselook modifier for the MainCamera in Unity -// by Francis R. Griffiths-Keam - www.runningdimensions.com - -[AddComponentMenu("Camera/Simple Smooth Mouse Look ")] -public class SimpleSmoothMouseLook : MonoBehaviour -{ - Vector2 _mouseAbsolute; - Vector2 _smoothMouse; - - public Vector2 clampInDegrees = new Vector2(360, 180); - public bool lockCursor; - public Vector2 sensitivity = new Vector2(2, 2); - public Vector2 smoothing = new Vector2(3, 3); - public Vector2 targetDirection; - public Vector2 targetCharacterDirection; - - // Assign this if there's a parent object controlling motion, such as a Character Controller. - // Yaw rotation will affect this object instead of the camera if set. - public GameObject characterBody; - - void Start() - { - // Set target direction to the camera's initial orientation. - targetDirection = transform.localRotation.eulerAngles; - - // Set target direction for the character body to its inital state. - if (characterBody) targetCharacterDirection = characterBody.transform.localRotation.eulerAngles; - } - - void Update() - { - // Ensure the cursor is always locked when set - Screen.lockCursor = lockCursor; - - // Allow the script to clamp based on a desired target value. - var targetOrientation = Quaternion.Euler(targetDirection); - var targetCharacterOrientation = Quaternion.Euler(targetCharacterDirection); - - // Get raw mouse input for a cleaner reading on more sensitive mice. - var mouseDelta = new Vector2(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y")); - - // Scale input against the sensitivity setting and multiply that against the smoothing value. - mouseDelta = Vector2.Scale(mouseDelta, new Vector2(sensitivity.x * smoothing.x, sensitivity.y * smoothing.y)); - - // Interpolate mouse movement over time to apply smoothing delta. - _smoothMouse.x = Mathf.Lerp(_smoothMouse.x, mouseDelta.x, 1f / smoothing.x); - _smoothMouse.y = Mathf.Lerp(_smoothMouse.y, mouseDelta.y, 1f / smoothing.y); - - // Find the absolute mouse movement value from point zero. - _mouseAbsolute += _smoothMouse; - - // Clamp and apply the local x value first, so as not to be affected by world transforms. - if (clampInDegrees.x < 360) - _mouseAbsolute.x = Mathf.Clamp(_mouseAbsolute.x, -clampInDegrees.x * 0.5f, clampInDegrees.x * 0.5f); - - var xRotation = Quaternion.AngleAxis(-_mouseAbsolute.y, targetOrientation * Vector3.right); - transform.localRotation = xRotation; - - // Then clamp and apply the global y value. - if (clampInDegrees.y < 360) - _mouseAbsolute.y = Mathf.Clamp(_mouseAbsolute.y, -clampInDegrees.y * 0.5f, clampInDegrees.y * 0.5f); - - transform.localRotation *= targetOrientation; - - // If there's a character body that acts as a parent to the camera - if (characterBody) - { - var yRotation = Quaternion.AngleAxis(_mouseAbsolute.x, characterBody.transform.up); - characterBody.transform.localRotation = yRotation; - characterBody.transform.localRotation *= targetCharacterOrientation; - } - else - { - var yRotation = Quaternion.AngleAxis(_mouseAbsolute.x, transform.InverseTransformDirection(Vector3.up)); - transform.localRotation *= yRotation; - } - } -} From 7388fde2000a3c681c3ca2c11cdd187d94712a61 Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Thu, 16 Jun 2016 21:54:31 -0400 Subject: [PATCH 19/28] Delete StackedWood.cs --- StackedWood.cs | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 StackedWood.cs diff --git a/StackedWood.cs b/StackedWood.cs deleted file mode 100644 index 43d459f..0000000 --- a/StackedWood.cs +++ /dev/null @@ -1,37 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class StackedWood : MonoBehaviour { - public static bool stackedHit = false; - public GameObject debrisPrefab; - public Rigidbody rb; - private float timer = 0; - private float counter = 0.53f; - - // Use this for initialization - void Start () { - rb = gameObject.GetComponent(); - } - - // Update is called once per frame - void Update () - { - RaycastHit hit; - Ray ray = new Ray(transform.position, -transform.up); - if (Physics.Raycast(ray, out hit, 5f)) - { - Debug.DrawLine(transform.position, hit.point, Color.green); - if (hit.collider.tag != "Wood" && hit.collider.tag != "Player") - { - rb.AddForce(Physics.gravity * rb.mass * 2.75f); - rb.isKinematic = false; - timer += Time.deltaTime; - - if (timer > counter) { - Destroy(this.gameObject); - Instantiate(debrisPrefab, transform.position, transform.rotation); - } - } - } - } -} From 7c90494ce1591b5ae5ee5254c0f060baa9561dbe Mon Sep 17 00:00:00 2001 From: Vincent Mak Date: Thu, 16 Jun 2016 21:54:33 -0400 Subject: [PATCH 20/28] Create EnemyAI.cs --- EnemyAI.cs | 197 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 197 insertions(+) create mode 100644 EnemyAI.cs diff --git a/EnemyAI.cs b/EnemyAI.cs new file mode 100644 index 0000000..b080428 --- /dev/null +++ b/EnemyAI.cs @@ -0,0 +1,197 @@ +using UnityEngine; +using System.Collections; + + +public class EnemyAI : MonoBehaviour +{ + NavMeshAgent agent; + public Transform target; + // AI movespeed on beeline mode, regular movespeed = 3.5 (nav mesh agent speed) + public float moveSpeed = 1.5f; + public static bool initialHit = false; + public static bool enemyHit = false; + [SerializeField]private float wanderDist = 100; + //--- AI states ---// + [SerializeField]private bool wander = true; // default state + [SerializeField]private bool chase = false; // underlying state, if all other states are false will chase, as the nav mesh agent takes over + [SerializeField]private bool scared = false; // hurt state + [SerializeField]private bool manualMovement = false; // dumb, beeline state + //-----------------// + [SerializeField]private float health = 100; + [SerializeField]private float stamina = 100; + private bool sight = false; + private float rotationSpeed = 1.5f; + private float hitCooldown = 0; + private float hitCountdown = 1.5f; + private float runBoredomCounter = 7; + private float currentRunBoredom = 0; + private float sightTimer = 0; + private float sightMinimum = 2; + + // Use this for initialization + void Start() + { + // setting up handle to refer to nav mesh agent, or smart AI component + agent = GetComponent(); + } + + // Update is called once per frame + void Update() + { + hitCooldown += Time.deltaTime; + agent.SetDestination(target.position); + + // raycast to detect for player to hit + RaycastHit hit; + Ray ray = new Ray(transform.position, transform.forward); + Ray ray2 = new Ray(transform.position / 1.5f, transform.forward); + Ray ray3 = new Ray(transform.position / 2.5f, transform.forward); + if (Physics.Raycast(ray, out hit, 1f)) + { + if (hit.collider.tag == "Player") + { + if (hitCooldown > hitCountdown) + { + PlayerHealth.health -= 20; + hitCooldown = 0; + } + } + } + + // new raycast to simulate line of sight + if (Physics.Raycast(ray, out hit, 30) || Physics.Raycast(ray2, out hit, 30) || Physics.Raycast(ray3, out hit, 30)) + { + Debug.Log(sightTimer); + Debug.DrawLine(transform.position, hit.point, Color.green); + if (hit.collider.tag == "Player") + { + sight = true; + } + + } + + if (sight == true) + { + chase = true; + wander = false; + } + else + { + chase = false; + wander = true; + } + + if (stamina <= 0) + { + chase = false; + wander = true; + } + + // default state is wander, only changes if raycast detects player + if (wander == true) + { + Vector3 newPos = RandomNavSphere(transform.position, wanderDist, -1)/ 6; + agent.SetDestination(newPos); + agent.speed = 3; + if (stamina <= 100) + { + stamina += Time.deltaTime * 6; + } + } + + // second state, chase, disabling wander and taking on regular AI patterns + if (chase == true) + { + stamina -= Time.deltaTime * 5; + if (stamina <= 10) + { + chase = false; + wander = true; + } + } + + if (wander == false && scared == false) + { + chase = true; + } + + // third state, scared, runs away from player + if (scared == true) + { + Vector3 moveDirection = transform.position - target.transform.position; + agent.SetDestination (moveDirection); + currentRunBoredom += Time.deltaTime; + agent.speed = 4; + chase = false; + + if (currentRunBoredom >= runBoredomCounter) + { + scared = false; + wander = true; + } + } + + // fourth state, moves straight to player position, ignoring obstacles + if (manualMovement == true && target != null) + { + // turns off smart ai and begins a process to slowly crawl over debris, switches off once off debris + transform.position += (target.position - transform.position).normalized * moveSpeed * Time.deltaTime; + transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(target.position - transform.position), rotationSpeed * Time.deltaTime); + } + + // switches to scared state when hurt badly + if (health <= 40 && currentRunBoredom <= runBoredomCounter) + { + scared = true; + } + + // dead + if (health <= 0) + { + Destroy(this.gameObject); + } + } + + // wandering calculations + public static Vector3 RandomNavSphere(Vector3 origin, float dist, int layermask) + { + Vector3 randDirection = Random.insideUnitSphere * dist; + randDirection += origin; + NavMeshHit navHit; + NavMesh.SamplePosition(randDirection, out navHit, dist, layermask); + return navHit.position; + } + + void OnCollisionEnter(Collision col) + { + // put enemy hit in collision function to maintain individual health variable in each enemy + if (initialHit == true) + { + // damages first target + health -= 20; + initialHit = false; + chase = true; + wander = false; + scared = false; + } + + if (col.gameObject.tag == "Debris" && woodDebris.settled == true && scared == false) + { + // turns off smart AI and turns on dumb beeline enemies that can get through the rubble + wander = false; + manualMovement = true; + gameObject.GetComponent().enabled = false; + } + // prevents flying debris right after destruction from glitching the AI + else if (col.gameObject.tag == "Debris" && woodDebris.settled == false) + { + gameObject.GetComponent().enabled = false; + } + else + { + // once off debris, turns smart AI back on to find path of least resistance + manualMovement = false; + gameObject.GetComponent().enabled = true; + } + } +} From 57b1ca69303eae1fa29f53b3462f74fa2c6c8c81 Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Thu, 16 Jun 2016 21:54:37 -0400 Subject: [PATCH 21/28] Delete WepMelee.cs --- WepMelee.cs | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 WepMelee.cs diff --git a/WepMelee.cs b/WepMelee.cs deleted file mode 100644 index c57a9ab..0000000 --- a/WepMelee.cs +++ /dev/null @@ -1,31 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class WepMelee : MonoBehaviour -{ - public GameObject enemy; - - - public void Update (){ - Attack (); - yield WaitForSeconds(2); - - } - - void Attack(){ - if (Input.GetButtonDown ("Fire1")){ - Vector3 enemyDelta = (enemy.transform.position - transform.position); - if ( Vector3.Angle( transform.forward, enemyDelta ) < 45 ) - { - if ((enemy.transform.position - transform.position).magnitude < 2) { - enemy.health -= 1; - } - } - } - } - - - - - -} From 7405d5592b2f4b3c27ca3b90a30131cf62f39cdb Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Thu, 16 Jun 2016 21:54:45 -0400 Subject: [PATCH 22/28] Delete WepScript.cs --- WepScript.cs | 79 ---------------------------------------------------- 1 file changed, 79 deletions(-) delete mode 100644 WepScript.cs diff --git a/WepScript.cs b/WepScript.cs deleted file mode 100644 index a9443e6..0000000 --- a/WepScript.cs +++ /dev/null @@ -1,79 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class WepScript : MonoBehaviour -{ - public GameObject enemy; - public Rigidbody projectile; - public float speed = 40f; - public float shootDelay = 0.5f; - public int magazineSize = 3; - public int currRounds = 3; - public int totalAmmo = 90; - public float timeAlive = 2f; - public float gunSpread = 20f; - public float tilt = 1f; - public float reloadTime = 1f; - private float counter = 0.0f; - private bool reloading = false; - - // Update is called once per frame - void Update () - { - if (!reloading && Input.GetButton ("Fire1") && counter > shootDelay && currRounds > 0) { - ShottyBullet (); - currRounds -= 1; - counter = 0; - } else if (Input.GetButtonDown ("Reload")) - { - reloading = true; - Invoke("Reload", reloadTime); - } - Debug.Log (currRounds); - counter += Time.deltaTime; - } - - void Reload () - { - int difference = magazineSize - currRounds; - if (totalAmmo - difference >= 0) { - currRounds += difference; - totalAmmo -= difference; - } else if (totalAmmo - difference < 0) { - currRounds = totalAmmo; - totalAmmo = 0; - } - Debug.Log ("Total: " + totalAmmo); - reloading = false; - } - - void ShottyBullet () - { - Debug.Log (transform.position + " " + transform.rotation); - - Vector3 toZero = transform.TransformPoint (0, -0.3f, 1f); - Vector3 toRight = transform.TransformPoint (0.1f, -0.3f, 1f); - Vector3 toLeft = transform.TransformPoint (-0.1f, -0.3f, 1f); - - float zRightBullet = speed * Mathf.Cos(gunSpread * (Mathf.PI/180)); - float xRightBullet = speed * Mathf.Sin(gunSpread * (Mathf.PI/180)); - - - //var diagonalSpeed = Mathf.Pow(((speed * speed)/ 2), (0.5f)); - - Rigidbody instantiatedProjectile = Instantiate (projectile, toZero, transform.rotation)as Rigidbody; - instantiatedProjectile.velocity = transform.TransformDirection (new Vector3 (0, tilt, speed)); - - Rigidbody instantiatedProjectileRight = Instantiate (projectile, toRight, transform.rotation)as Rigidbody; - instantiatedProjectileRight.velocity = transform.TransformDirection (new Vector3 (xRightBullet, tilt, zRightBullet)); - - Rigidbody instantiatedProjectileLeft = Instantiate (projectile, toLeft, transform.rotation)as Rigidbody; - instantiatedProjectileLeft.velocity = transform.TransformDirection (new Vector3 (-xRightBullet, tilt, zRightBullet)); - - Destroy (instantiatedProjectile.gameObject, timeAlive); - Destroy (instantiatedProjectileRight.gameObject, timeAlive); - Destroy (instantiatedProjectileLeft.gameObject, timeAlive); - - - } -} \ No newline at end of file From 6e9ced26907b0979d11846622e953de224464ba3 Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Thu, 16 Jun 2016 21:54:51 -0400 Subject: [PATCH 23/28] Delete EnemyAI.cs --- EnemyAI.cs | 197 ----------------------------------------------------- 1 file changed, 197 deletions(-) delete mode 100644 EnemyAI.cs diff --git a/EnemyAI.cs b/EnemyAI.cs deleted file mode 100644 index b080428..0000000 --- a/EnemyAI.cs +++ /dev/null @@ -1,197 +0,0 @@ -using UnityEngine; -using System.Collections; - - -public class EnemyAI : MonoBehaviour -{ - NavMeshAgent agent; - public Transform target; - // AI movespeed on beeline mode, regular movespeed = 3.5 (nav mesh agent speed) - public float moveSpeed = 1.5f; - public static bool initialHit = false; - public static bool enemyHit = false; - [SerializeField]private float wanderDist = 100; - //--- AI states ---// - [SerializeField]private bool wander = true; // default state - [SerializeField]private bool chase = false; // underlying state, if all other states are false will chase, as the nav mesh agent takes over - [SerializeField]private bool scared = false; // hurt state - [SerializeField]private bool manualMovement = false; // dumb, beeline state - //-----------------// - [SerializeField]private float health = 100; - [SerializeField]private float stamina = 100; - private bool sight = false; - private float rotationSpeed = 1.5f; - private float hitCooldown = 0; - private float hitCountdown = 1.5f; - private float runBoredomCounter = 7; - private float currentRunBoredom = 0; - private float sightTimer = 0; - private float sightMinimum = 2; - - // Use this for initialization - void Start() - { - // setting up handle to refer to nav mesh agent, or smart AI component - agent = GetComponent(); - } - - // Update is called once per frame - void Update() - { - hitCooldown += Time.deltaTime; - agent.SetDestination(target.position); - - // raycast to detect for player to hit - RaycastHit hit; - Ray ray = new Ray(transform.position, transform.forward); - Ray ray2 = new Ray(transform.position / 1.5f, transform.forward); - Ray ray3 = new Ray(transform.position / 2.5f, transform.forward); - if (Physics.Raycast(ray, out hit, 1f)) - { - if (hit.collider.tag == "Player") - { - if (hitCooldown > hitCountdown) - { - PlayerHealth.health -= 20; - hitCooldown = 0; - } - } - } - - // new raycast to simulate line of sight - if (Physics.Raycast(ray, out hit, 30) || Physics.Raycast(ray2, out hit, 30) || Physics.Raycast(ray3, out hit, 30)) - { - Debug.Log(sightTimer); - Debug.DrawLine(transform.position, hit.point, Color.green); - if (hit.collider.tag == "Player") - { - sight = true; - } - - } - - if (sight == true) - { - chase = true; - wander = false; - } - else - { - chase = false; - wander = true; - } - - if (stamina <= 0) - { - chase = false; - wander = true; - } - - // default state is wander, only changes if raycast detects player - if (wander == true) - { - Vector3 newPos = RandomNavSphere(transform.position, wanderDist, -1)/ 6; - agent.SetDestination(newPos); - agent.speed = 3; - if (stamina <= 100) - { - stamina += Time.deltaTime * 6; - } - } - - // second state, chase, disabling wander and taking on regular AI patterns - if (chase == true) - { - stamina -= Time.deltaTime * 5; - if (stamina <= 10) - { - chase = false; - wander = true; - } - } - - if (wander == false && scared == false) - { - chase = true; - } - - // third state, scared, runs away from player - if (scared == true) - { - Vector3 moveDirection = transform.position - target.transform.position; - agent.SetDestination (moveDirection); - currentRunBoredom += Time.deltaTime; - agent.speed = 4; - chase = false; - - if (currentRunBoredom >= runBoredomCounter) - { - scared = false; - wander = true; - } - } - - // fourth state, moves straight to player position, ignoring obstacles - if (manualMovement == true && target != null) - { - // turns off smart ai and begins a process to slowly crawl over debris, switches off once off debris - transform.position += (target.position - transform.position).normalized * moveSpeed * Time.deltaTime; - transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(target.position - transform.position), rotationSpeed * Time.deltaTime); - } - - // switches to scared state when hurt badly - if (health <= 40 && currentRunBoredom <= runBoredomCounter) - { - scared = true; - } - - // dead - if (health <= 0) - { - Destroy(this.gameObject); - } - } - - // wandering calculations - public static Vector3 RandomNavSphere(Vector3 origin, float dist, int layermask) - { - Vector3 randDirection = Random.insideUnitSphere * dist; - randDirection += origin; - NavMeshHit navHit; - NavMesh.SamplePosition(randDirection, out navHit, dist, layermask); - return navHit.position; - } - - void OnCollisionEnter(Collision col) - { - // put enemy hit in collision function to maintain individual health variable in each enemy - if (initialHit == true) - { - // damages first target - health -= 20; - initialHit = false; - chase = true; - wander = false; - scared = false; - } - - if (col.gameObject.tag == "Debris" && woodDebris.settled == true && scared == false) - { - // turns off smart AI and turns on dumb beeline enemies that can get through the rubble - wander = false; - manualMovement = true; - gameObject.GetComponent().enabled = false; - } - // prevents flying debris right after destruction from glitching the AI - else if (col.gameObject.tag == "Debris" && woodDebris.settled == false) - { - gameObject.GetComponent().enabled = false; - } - else - { - // once off debris, turns smart AI back on to find path of least resistance - manualMovement = false; - gameObject.GetComponent().enabled = true; - } - } -} From 6f891425b714cc1fd25930eb6e3a518a2a4827c6 Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Thu, 16 Jun 2016 21:54:56 -0400 Subject: [PATCH 24/28] Delete WoodDestruction.cs --- WoodDestruction.cs | 56 ---------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 WoodDestruction.cs diff --git a/WoodDestruction.cs b/WoodDestruction.cs deleted file mode 100644 index b21aadd..0000000 --- a/WoodDestruction.cs +++ /dev/null @@ -1,56 +0,0 @@ -using UnityEngine; -using System.Collections; - -public class WoodDestruction : MonoBehaviour -{ - public static bool initialHit = false; - public static bool woodDestroy = false; - public static bool hitWoodAbove = false; - public GameObject debrisPrefab; - [SerializeField]private int destructionStage = 0; - - - // Use this for initialization - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } - - void OnCollisionEnter(Collision col) - { - - if (initialHit == true) - { - destructionStage += 1; - Debug.Log(destructionStage); - initialHit = false; - } - - if (destructionStage == 3 && hitWoodAbove == false) - { - // setting up position of debris such that it doesnt spawn in the air, rather on the ground - transform.position = new Vector3(transform.position.x, -0.5f, transform.position.z); - Instantiate(debrisPrefab, transform.position, transform.rotation); - - // switching woodDestroy true which effects BulletHole script, destroying bulletholes on the wall at the same time the wall breaks - woodDestroy = true; - Destroy(this.gameObject); - } - if (destructionStage == 3 && hitWoodAbove == true) - { - Instantiate(debrisPrefab, transform.position, transform.rotation); - woodDestroy = true; - Destroy(this.gameObject); - } - else - { - woodDestroy = false; - } - } -} From 80f4dd521a61d9f6fc3576777c39c970249e1137 Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Thu, 16 Jun 2016 21:56:02 -0400 Subject: [PATCH 25/28] Add files via upload --- Scripts/BarScript.cs | 37 +++++ Scripts/BarScript.cs.meta | 12 ++ Scripts/Crosshair.cs | 9 ++ Scripts/Crosshair.cs.meta | 12 ++ Scripts/DestroyCubes.cs | 34 +++++ Scripts/DestroyCubes.cs.meta | 12 ++ Scripts/EnemyHealthScript.cs | 27 ++++ Scripts/EnemyHealthScript.cs.meta | 12 ++ Scripts/GlowOn.cs | 41 ++++++ Scripts/GlowOn.cs.meta | 12 ++ Scripts/RigidbodyFPSWalker.cs | 148 +++++++++++++++++++ Scripts/RigidbodyFPSWalker.cs.meta | 12 ++ Scripts/SimpleSmoothMouseLook.cs | 80 +++++++++++ Scripts/SimpleSmoothMouseLook.cs.meta | 12 ++ Scripts/Teleporter.cs | 15 ++ Scripts/Teleporter.cs.meta | 12 ++ Scripts/WepMarker.cs | 51 +++++++ Scripts/WepMarker.cs.meta | 12 ++ Scripts/WepMelee.cs | 26 ++++ Scripts/WepMelee.cs.meta | 12 ++ Scripts/WepScript.cs | 34 +++++ Scripts/WepScript.cs.meta | 12 ++ Scripts/WepShotgun.cs | 84 +++++++++++ Scripts/WepShotgun.cs.meta | 12 ++ VScripts/BulletHole.cs | 28 ++++ VScripts/BulletHole.cs.meta | 12 ++ VScripts/Bulletz.cs | 99 +++++++++++++ VScripts/Bulletz.cs.meta | 12 ++ VScripts/CeilingDestruction.cs | 15 ++ VScripts/CeilingDestruction.cs.meta | 12 ++ VScripts/EnemyAI.cs | 199 ++++++++++++++++++++++++++ VScripts/EnemyAI.cs.meta | 12 ++ VScripts/Headshot.cs | 19 +++ VScripts/Headshot.cs.meta | 12 ++ VScripts/Player.cs | 14 ++ VScripts/Player.cs.meta | 12 ++ VScripts/PlayerHealth.cs | 24 ++++ VScripts/PlayerHealth.cs.meta | 12 ++ VScripts/StackedWood.cs | 45 ++++++ VScripts/StackedWood.cs.meta | 12 ++ VScripts/WoodDestruction.cs | 57 ++++++++ VScripts/WoodDestruction.cs.meta | 12 ++ VScripts/woodDebris.cs | 41 ++++++ VScripts/woodDebris.cs.meta | 12 ++ 44 files changed, 1391 insertions(+) create mode 100644 Scripts/BarScript.cs create mode 100644 Scripts/BarScript.cs.meta create mode 100644 Scripts/Crosshair.cs create mode 100644 Scripts/Crosshair.cs.meta create mode 100644 Scripts/DestroyCubes.cs create mode 100644 Scripts/DestroyCubes.cs.meta create mode 100644 Scripts/EnemyHealthScript.cs create mode 100644 Scripts/EnemyHealthScript.cs.meta create mode 100644 Scripts/GlowOn.cs create mode 100644 Scripts/GlowOn.cs.meta create mode 100644 Scripts/RigidbodyFPSWalker.cs create mode 100644 Scripts/RigidbodyFPSWalker.cs.meta create mode 100644 Scripts/SimpleSmoothMouseLook.cs create mode 100644 Scripts/SimpleSmoothMouseLook.cs.meta create mode 100644 Scripts/Teleporter.cs create mode 100644 Scripts/Teleporter.cs.meta create mode 100644 Scripts/WepMarker.cs create mode 100644 Scripts/WepMarker.cs.meta create mode 100644 Scripts/WepMelee.cs create mode 100644 Scripts/WepMelee.cs.meta create mode 100644 Scripts/WepScript.cs create mode 100644 Scripts/WepScript.cs.meta create mode 100644 Scripts/WepShotgun.cs create mode 100644 Scripts/WepShotgun.cs.meta create mode 100644 VScripts/BulletHole.cs create mode 100644 VScripts/BulletHole.cs.meta create mode 100644 VScripts/Bulletz.cs create mode 100644 VScripts/Bulletz.cs.meta create mode 100644 VScripts/CeilingDestruction.cs create mode 100644 VScripts/CeilingDestruction.cs.meta create mode 100644 VScripts/EnemyAI.cs create mode 100644 VScripts/EnemyAI.cs.meta create mode 100644 VScripts/Headshot.cs create mode 100644 VScripts/Headshot.cs.meta create mode 100644 VScripts/Player.cs create mode 100644 VScripts/Player.cs.meta create mode 100644 VScripts/PlayerHealth.cs create mode 100644 VScripts/PlayerHealth.cs.meta create mode 100644 VScripts/StackedWood.cs create mode 100644 VScripts/StackedWood.cs.meta create mode 100644 VScripts/WoodDestruction.cs create mode 100644 VScripts/WoodDestruction.cs.meta create mode 100644 VScripts/woodDebris.cs create mode 100644 VScripts/woodDebris.cs.meta diff --git a/Scripts/BarScript.cs b/Scripts/BarScript.cs new file mode 100644 index 0000000..133d097 --- /dev/null +++ b/Scripts/BarScript.cs @@ -0,0 +1,37 @@ +using UnityEngine; +using System.Collections; +using UnityEngine.UI; + +public class BarScript : MonoBehaviour { + + public WepScript wpScript; + public WepShotgun wpShotgun; + public WepMelee wpMelee; + public WepMarker wpMarker; + + [SerializeField] + private float fillAmount = 1; + + [SerializeField] + private Image content; + + + + // Use this for initialization + void Start () { + + } + + // Update is called once per frame + void Update () { + HandleBar (); + } + + private void HandleBar(){ + if (wpScript.currentWeapon == 2){ + content.fillAmount = (wpShotgun.currRounds / (float)wpShotgun.magazineSize); + } else if (wpScript.currentWeapon == 3){ + content.fillAmount = (wpMarker.currRounds / (float)wpMarker.totalAmmo); + } + } +} diff --git a/Scripts/BarScript.cs.meta b/Scripts/BarScript.cs.meta new file mode 100644 index 0000000..f55a174 --- /dev/null +++ b/Scripts/BarScript.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 10b87888d16a9ef4aa713ceeed1748c5 +timeCreated: 1462749984 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Crosshair.cs b/Scripts/Crosshair.cs new file mode 100644 index 0000000..2365279 --- /dev/null +++ b/Scripts/Crosshair.cs @@ -0,0 +1,9 @@ +using UnityEngine; +using System.Collections; + +public class Crosshair : MonoBehaviour { + + void OnGUI(){ + GUI.Box(new Rect((Screen.width/2) - 5,(Screen.height/2) - 5, 10, 10), ""); + } +} diff --git a/Scripts/Crosshair.cs.meta b/Scripts/Crosshair.cs.meta new file mode 100644 index 0000000..9c85f7d --- /dev/null +++ b/Scripts/Crosshair.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 17949abae4f5d73499147744d6c688dd +timeCreated: 1461028644 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/DestroyCubes.cs b/Scripts/DestroyCubes.cs new file mode 100644 index 0000000..4b54ef5 --- /dev/null +++ b/Scripts/DestroyCubes.cs @@ -0,0 +1,34 @@ +using UnityEngine; +using System.Collections; + +public class DestroyCubes : MonoBehaviour +{ + public GameObject enemySphere; + void Start(){ + + } + + void OnCollisionEnter (Collision col) + { + if (col.gameObject.tag == "Enemy") { + EnemyHealthScript ehs = col.gameObject.GetComponent (); + ehs.health -= 1; + GameObject bhole = Instantiate (enemySphere, this.gameObject.transform.position, this.gameObject.transform.rotation) as GameObject; + bhole.transform.parent = col.gameObject.transform; + + Destroy (this.gameObject); + + } else if (col.gameObject.tag == "Terrain" || col.gameObject.tag == "Untagged") { + + Destroy (this.gameObject); + + } + else if (col.gameObject.tag == "Wall") { + + Destroy (this.gameObject); + + } + + + } +} \ No newline at end of file diff --git a/Scripts/DestroyCubes.cs.meta b/Scripts/DestroyCubes.cs.meta new file mode 100644 index 0000000..b8c8da5 --- /dev/null +++ b/Scripts/DestroyCubes.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 749c26872246172408697bc758933ca4 +timeCreated: 1460687321 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/EnemyHealthScript.cs b/Scripts/EnemyHealthScript.cs new file mode 100644 index 0000000..56df103 --- /dev/null +++ b/Scripts/EnemyHealthScript.cs @@ -0,0 +1,27 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + +public class EnemyHealthScript : MonoBehaviour { + public int health; + + // Use this for initialization + void Start () { + } + + // Update is called once per frame + void Update () { + if (health < 1) { + foreach (Transform child in this.transform) { + Destroy (child.gameObject); + } + Destroy (this.gameObject); + } + + + + } + + + +} diff --git a/Scripts/EnemyHealthScript.cs.meta b/Scripts/EnemyHealthScript.cs.meta new file mode 100644 index 0000000..39f7640 --- /dev/null +++ b/Scripts/EnemyHealthScript.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f6902b04818fa5f43bac193a3dd2fb33 +timeCreated: 1462916283 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/GlowOn.cs b/Scripts/GlowOn.cs new file mode 100644 index 0000000..9081ac3 --- /dev/null +++ b/Scripts/GlowOn.cs @@ -0,0 +1,41 @@ +using UnityEngine; +using System.Collections; + +public class GlowOn : MonoBehaviour { + public int lightOn = -1; + public Material matWhite; + public Material matBlack; + public float targetTimeDuration = 2.0f; + public float timeCounter = 0.0f; + + // Use this for initialization + void Start () { + + } + + void Update() { + + if (lightOn == -1) { + GetComponent ().material = matBlack; + } else if (lightOn == 1) { + GetComponent ().material = matWhite; + } + if (timeCounter > targetTimeDuration) { + lightOn = -1; + timeCounter = 0; + + } + timeCounter += Time.deltaTime; + } + + void OnCollisionEnter (Collision col){ + if (col.gameObject.tag == "Projectile") { + lightOn *= -1; + timeCounter = 0; + } else if (col.gameObject.tag == "Player") { + lightOn = 1; + timeCounter = 0; + + } + } +} diff --git a/Scripts/GlowOn.cs.meta b/Scripts/GlowOn.cs.meta new file mode 100644 index 0000000..b3dfafc --- /dev/null +++ b/Scripts/GlowOn.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 699264f69f3b97646913b598619fd251 +timeCreated: 1462490918 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/RigidbodyFPSWalker.cs b/Scripts/RigidbodyFPSWalker.cs new file mode 100644 index 0000000..f87a947 --- /dev/null +++ b/Scripts/RigidbodyFPSWalker.cs @@ -0,0 +1,148 @@ +using UnityEngine; +using System.Collections; + +[RequireComponent (typeof (Rigidbody))] +[RequireComponent (typeof (CapsuleCollider))] + +public class RigidbodyFPSWalker : MonoBehaviour{ + + public float speed = 10.0f; + public float gravity = 10.0f; + public float maxVelocityChange = 10.0f; + public bool canJump = true; + public float jumpHeight = 2.0f; + public float thrust = 4; + public float limit = 1.0f; + public float chaseLimit; + public Rigidbody jetpackUser; + public bool isJumping = false; + public float regenFactor = 4f; + public float deprecFactor = 2f; + private bool grounded = false; + private bool isFlying = false; + private bool inAir = false; + private bool gotFuel = true; + private float chaseThrust; + + public float air_accelerate = 5f; + public float ground_accelerate = 10f; + public float max_velocity_air = 20f; + public float max_velocity_ground = 5f; + public float friction = 0.5f; + + + void Awake () { + GetComponent().freezeRotation = true; + GetComponent().useGravity = false; + } + + void Start(){ + chaseLimit = limit; + chaseThrust = thrust; + } + + void FixedUpdate () { + EnemyAI.targetPosition = transform.position; + if (isJumping || inAir) { + inAir = true; + grounded = false; + } else { + inAir = false; + grounded = true; + } + JetpackFuel (); + Jetpack (); + + + if (grounded || inAir || isJumping) { + // Calculate how fast we should be moving + Vector3 targetVelocity = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); + targetVelocity = transform.TransformDirection(targetVelocity); + targetVelocity *= speed; + + // Apply a force that attempts to reach our target velocity + Vector3 velocity = GetComponent().velocity; + Vector3 velocityChange = (targetVelocity - velocity); + velocityChange.x = Mathf.Clamp(velocityChange.x, -maxVelocityChange, maxVelocityChange); + velocityChange.z = Mathf.Clamp(velocityChange.z, -maxVelocityChange, maxVelocityChange); + velocityChange.y = 0; + GetComponent().AddForce(velocityChange, ForceMode.VelocityChange); + + + if (canJump && Input.GetButtonDown ("Jump") && grounded) { + GetComponent ().velocity = new Vector3 (velocity.x, CalculateJumpVerticalSpeed (), velocity.z); + isJumping = true; + } + else if (inAir && Input.GetButton("Jump")) { + isJumping = true; + } + else { + isJumping = false; + } + + } + + + // We apply gravity manually for more tuning control + GetComponent().AddForce(new Vector3 (0, -gravity * GetComponent().mass, 0)); + grounded = false; + } + + + void OnCollisionStay (Collision col) { + if (col.gameObject.tag == "Terrain" || col.gameObject.tag == "Wood") { + grounded = true; + inAir = false; + } + } + + void JetpackFuel() { + bool fullTank = false; + + if (chaseLimit < 0) { + gotFuel = false; + fullTank = false; + chaseLimit = 0; + } else if (chaseLimit == limit) { + fullTank = true; + gotFuel = true; + } else { + gotFuel = true; + fullTank = false; + } + + if (isFlying) { + chaseLimit -= Time.deltaTime / (deprecFactor / 2f); + } else if (!fullTank && (grounded || Input.GetButtonDown("Jump"))) { + + if (limit - chaseLimit <= 0.01f) { + chaseLimit = limit; + } else { + chaseLimit += Time.deltaTime / regenFactor; + } + + } + + } + + void Jetpack() { + Vector3 velocity = GetComponent().velocity; + float jumpSpeed = 1f; + if (Input.GetButton ("Fire2") && gotFuel && chaseLimit > 0) { + jumpSpeed = thrust * chaseLimit; + jetpackUser.velocity = new Vector3 (velocity.x, jumpSpeed, velocity.z); + inAir = true; + isFlying = true; + } else { + + isFlying = false; + } + + } + + float CalculateJumpVerticalSpeed () { + // From the jump height and gravity we deduce the upwards speed + // for the character to reach at the apex. + return Mathf.Sqrt(2 * jumpHeight * gravity); + } +} \ No newline at end of file diff --git a/Scripts/RigidbodyFPSWalker.cs.meta b/Scripts/RigidbodyFPSWalker.cs.meta new file mode 100644 index 0000000..72850d1 --- /dev/null +++ b/Scripts/RigidbodyFPSWalker.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 91ae6f52095ccd3458f638a286f5f982 +timeCreated: 1460666867 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/SimpleSmoothMouseLook.cs b/Scripts/SimpleSmoothMouseLook.cs new file mode 100644 index 0000000..7c0deb0 --- /dev/null +++ b/Scripts/SimpleSmoothMouseLook.cs @@ -0,0 +1,80 @@ +using UnityEngine; + +// Very simple smooth mouselook modifier for the MainCamera in Unity +// by Francis R. Griffiths-Keam - www.runningdimensions.com + +[AddComponentMenu("Camera/Simple Smooth Mouse Look ")] +public class SimpleSmoothMouseLook : MonoBehaviour +{ + Vector2 _mouseAbsolute; + Vector2 _smoothMouse; + + public Vector2 clampInDegrees = new Vector2(360, 180); + public bool lockCursor; + public Vector2 sensitivity = new Vector2(2, 2); + public Vector2 smoothing = new Vector2(3, 3); + public Vector2 targetDirection; + public Vector2 targetCharacterDirection; + + // Assign this if there's a parent object controlling motion, such as a Character Controller. + // Yaw rotation will affect this object instead of the camera if set. + public GameObject characterBody; + + void Start() + { + // Set target direction to the camera's initial orientation. + targetDirection = transform.localRotation.eulerAngles; + + // Set target direction for the character body to its inital state. + if (characterBody) targetCharacterDirection = characterBody.transform.localRotation.eulerAngles; + } + + void Update() + { + // Ensure the cursor is always locked when set + Screen.lockCursor = lockCursor; + + // Allow the script to clamp based on a desired target value. + var targetOrientation = Quaternion.Euler(targetDirection); + var targetCharacterOrientation = Quaternion.Euler(targetCharacterDirection); + + // Get raw mouse input for a cleaner reading on more sensitive mice. + var mouseDelta = new Vector2(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y")); + + // Scale input against the sensitivity setting and multiply that against the smoothing value. + mouseDelta = Vector2.Scale(mouseDelta, new Vector2(sensitivity.x * smoothing.x, sensitivity.y * smoothing.y)); + + // Interpolate mouse movement over time to apply smoothing delta. + _smoothMouse.x = Mathf.Lerp(_smoothMouse.x, mouseDelta.x, 1f / smoothing.x); + _smoothMouse.y = Mathf.Lerp(_smoothMouse.y, mouseDelta.y, 1f / smoothing.y); + + // Find the absolute mouse movement value from point zero. + _mouseAbsolute += _smoothMouse; + + // Clamp and apply the local x value first, so as not to be affected by world transforms. + if (clampInDegrees.x < 360) + _mouseAbsolute.x = Mathf.Clamp(_mouseAbsolute.x, -clampInDegrees.x * 0.5f, clampInDegrees.x * 0.5f); + + var xRotation = Quaternion.AngleAxis(-_mouseAbsolute.y, targetOrientation * Vector3.right); + transform.localRotation = xRotation; + + // Then clamp and apply the global y value. + if (clampInDegrees.y < 360) + _mouseAbsolute.y = Mathf.Clamp(_mouseAbsolute.y, -clampInDegrees.y * 0.5f, clampInDegrees.y * 0.5f); + + transform.localRotation *= targetOrientation; + + // If there's a character body that acts as a parent to the camera + if (characterBody) + { + var yRotation = Quaternion.AngleAxis(_mouseAbsolute.x, characterBody.transform.up); + characterBody.transform.localRotation = yRotation; + characterBody.transform.localRotation *= targetCharacterOrientation; + } + else + { + var yRotation = Quaternion.AngleAxis(_mouseAbsolute.x, transform.InverseTransformDirection(Vector3.up)); + transform.localRotation *= yRotation; + } + } +} diff --git a/Scripts/SimpleSmoothMouseLook.cs.meta b/Scripts/SimpleSmoothMouseLook.cs.meta new file mode 100644 index 0000000..8a01e1f --- /dev/null +++ b/Scripts/SimpleSmoothMouseLook.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4abee239d759e954cad91dca3f68c34d +timeCreated: 1460667588 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Teleporter.cs b/Scripts/Teleporter.cs new file mode 100644 index 0000000..a725181 --- /dev/null +++ b/Scripts/Teleporter.cs @@ -0,0 +1,15 @@ +using UnityEngine; +using System.Collections; + +public class Teleporter : MonoBehaviour { + public Transform target; + public float x; + public float y; + public float z; + + void OnCollisionEnter (Collision col) { + if (col.gameObject.tag == "Player") { + col.gameObject.transform.position = target.position + new Vector3(x, y, z); + } + } +} diff --git a/Scripts/Teleporter.cs.meta b/Scripts/Teleporter.cs.meta new file mode 100644 index 0000000..edb40fb --- /dev/null +++ b/Scripts/Teleporter.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6b126f0fc7ce5fa489fc7269b8674815 +timeCreated: 1465939474 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/WepMarker.cs b/Scripts/WepMarker.cs new file mode 100644 index 0000000..68a792b --- /dev/null +++ b/Scripts/WepMarker.cs @@ -0,0 +1,51 @@ +using UnityEngine; +using System.Collections; + +public class WepMarker : MonoBehaviour { + + public GameObject enemy; + public Rigidbody projectile; + public float speed = 40f; + public float shootDelay = 0.5f; + public int currRounds = 90; + public int totalAmmo = 90; + public float timeAlive = 2f; + public float gunSpread = 20f; + public float tilt = 1f; + public float reloadTime = 1f; + public CrosshairControl ccobject; + private float counter = 0.0f; + private bool reloading = false; + private int currentWeapon = 1; + + + // Update is called once per frame + public void FixedUpdate () + { + + if (!reloading && Input.GetButton ("Fire1") && counter > shootDelay && currRounds > 0) { + + Bullet (); + //ccobject.PlayAnim (); + currRounds -= 1; + counter = 0; + } + Debug.Log (currRounds); + counter += Time.deltaTime; + } + + + + void Bullet () + { + + Vector3 toZero = transform.TransformPoint (0, 0, 1f); + + //var diagonalSpeed = Mathf.Pow(((speed * speed)/ 2), (0.5f)); + + Rigidbody instantiatedProjectile = Instantiate (projectile, toZero, transform.rotation)as Rigidbody; + instantiatedProjectile.velocity = transform.TransformDirection (new Vector3 (0, tilt, speed)); + + Destroy (instantiatedProjectile.gameObject, timeAlive); + } +} diff --git a/Scripts/WepMarker.cs.meta b/Scripts/WepMarker.cs.meta new file mode 100644 index 0000000..ba69579 --- /dev/null +++ b/Scripts/WepMarker.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: fd1c6eb5305fb0c4a81c30d3d95f2dcb +timeCreated: 1465865309 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/WepMelee.cs b/Scripts/WepMelee.cs new file mode 100644 index 0000000..dcb0930 --- /dev/null +++ b/Scripts/WepMelee.cs @@ -0,0 +1,26 @@ +using UnityEngine; +using System.Collections; + +public class WepMelee : MonoBehaviour { + //public GameObject enemy; + public GameObject cylinder; + + void Start(){ + + } + + // Update is called once per frame + public void Update () { + if (Input.GetButton ("Fire1")) { + Attack (); + } + } + + + void Attack(){ + GameObject cyl = Instantiate (cylinder, transform.position, transform.rotation) as GameObject; + cyl.transform.parent = transform; + cyl.GetComponent ().Stab (); + + } +} diff --git a/Scripts/WepMelee.cs.meta b/Scripts/WepMelee.cs.meta new file mode 100644 index 0000000..362e70d --- /dev/null +++ b/Scripts/WepMelee.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f8042e0b9277da342bacffe72d95d5b2 +timeCreated: 1465866043 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/WepScript.cs b/Scripts/WepScript.cs new file mode 100644 index 0000000..70cbf7e --- /dev/null +++ b/Scripts/WepScript.cs @@ -0,0 +1,34 @@ +using UnityEngine; +using System.Collections; + +public class WepScript : MonoBehaviour +{ + public GameObject enemy; + public Rigidbody projectile; + public WepShotgun shotgun; + public WepMarker marker; + public WepMelee melee; + public int currentWeapon = 2; + + + // Update is called once per frame + void Update () + { + if (Input.GetKeyDown (KeyCode.Alpha1)) { + currentWeapon = 1; + } else if (Input.GetKeyDown (KeyCode.Alpha2)) { + currentWeapon = 2; + } else if (Input.GetKeyDown (KeyCode.Alpha3)) { + currentWeapon = 3; + } + + if (currentWeapon == 1) { + melee.Update (); + } else if (currentWeapon == 2) { + shotgun.FixedUpdate (); + } else if (currentWeapon == 3) { + marker.FixedUpdate (); + } + } + +} \ No newline at end of file diff --git a/Scripts/WepScript.cs.meta b/Scripts/WepScript.cs.meta new file mode 100644 index 0000000..4d8d309 --- /dev/null +++ b/Scripts/WepScript.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 27f52469ad18753488a34ea992e96b20 +timeCreated: 1460669825 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/WepShotgun.cs b/Scripts/WepShotgun.cs new file mode 100644 index 0000000..4e8199d --- /dev/null +++ b/Scripts/WepShotgun.cs @@ -0,0 +1,84 @@ +using UnityEngine; +using System.Collections; + +public class WepShotgun : MonoBehaviour { + + public GameObject enemy; + public Rigidbody projectile; + public float speed = 40f; + public float shootDelay = 0.5f; + public int magazineSize = 3; + public int currRounds = 3; + public int totalAmmo = 90; + public float timeAlive = 2f; + public float gunSpread = 20f; + public float tilt = 1f; + public float reloadTime = 1f; + private float counter = 0.0f; + private bool reloading = false; + private int currentWeapon = 1; + public CrosshairControl ccobject; + + // Update is called once per frame + public void FixedUpdate () + { + + if (!reloading && Input.GetButton ("Fire1") && counter > shootDelay && currRounds > 0) { + ShottyBullet (); + //ccobject.PlayAnim (); + currRounds -= 1; + counter = 0; + } else if (Input.GetButtonDown ("Reload")) + { + reloading = true; + Invoke("Reload", reloadTime); + } + Debug.Log (currRounds); + counter += Time.deltaTime; + } + + void Reload () + { + int difference = magazineSize - currRounds; + if (totalAmmo - difference >= 0) { + currRounds += difference; + totalAmmo -= difference; + } else if (totalAmmo - difference < 0) { + currRounds = totalAmmo; + totalAmmo = 0; + } + Debug.Log ("Total: " + totalAmmo); + reloading = false; + } + + + void ShottyBullet () + { + Debug.Log (transform.position + " " + transform.rotation); + + Vector3 toZero = transform.TransformPoint (0, -0.3f, 1f); + Vector3 toRight = transform.TransformPoint (0.1f, -0.3f, 1f); + Vector3 toLeft = transform.TransformPoint (-0.1f, -0.3f, 1f); + + float zRightBullet = speed * Mathf.Cos(gunSpread * (Mathf.PI/180)); + float xRightBullet = speed * Mathf.Sin(gunSpread * (Mathf.PI/180)); + + + //var diagonalSpeed = Mathf.Pow(((speed * speed)/ 2), (0.5f)); + + Rigidbody instantiatedProjectile = Instantiate (projectile, toZero, transform.rotation)as Rigidbody; + instantiatedProjectile.velocity = transform.TransformDirection (new Vector3 (0, tilt, speed)); + + Rigidbody instantiatedProjectileRight = Instantiate (projectile, toRight, transform.rotation)as Rigidbody; + instantiatedProjectileRight.velocity = transform.TransformDirection (new Vector3 (xRightBullet, tilt, zRightBullet)); + + Rigidbody instantiatedProjectileLeft = Instantiate (projectile, toLeft, transform.rotation)as Rigidbody; + instantiatedProjectileLeft.velocity = transform.TransformDirection (new Vector3 (-xRightBullet, tilt, zRightBullet)); + + Destroy (instantiatedProjectile.gameObject, timeAlive); + Destroy (instantiatedProjectileRight.gameObject, timeAlive); + Destroy (instantiatedProjectileLeft.gameObject, timeAlive); + + + } +} diff --git a/Scripts/WepShotgun.cs.meta b/Scripts/WepShotgun.cs.meta new file mode 100644 index 0000000..6daf8a1 --- /dev/null +++ b/Scripts/WepShotgun.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 496edd1e190b9314a89a1d4cc9319f8d +timeCreated: 1465865289 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VScripts/BulletHole.cs b/VScripts/BulletHole.cs new file mode 100644 index 0000000..8c36574 --- /dev/null +++ b/VScripts/BulletHole.cs @@ -0,0 +1,28 @@ +using UnityEngine; +using System.Collections; + +public class BulletHole : MonoBehaviour { + public static int numOfHoles = 0; + private float counter = 0; + private float timeToDestroy = 5; + + // Use this for initialization + void Start () + { + + } + + // Update is called once per frame + void Update () + { + counter += Time.deltaTime; + if (counter >= timeToDestroy) + { + Destroy(this.gameObject); + } + if (WoodDestruction.woodDestroy == true) + { + Destroy(this.gameObject); + } + } +} diff --git a/VScripts/BulletHole.cs.meta b/VScripts/BulletHole.cs.meta new file mode 100644 index 0000000..16d16c3 --- /dev/null +++ b/VScripts/BulletHole.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c8e6962465f9882499ee4d76ea37b4a0 +timeCreated: 1461328556 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VScripts/Bulletz.cs b/VScripts/Bulletz.cs new file mode 100644 index 0000000..61b530e --- /dev/null +++ b/VScripts/Bulletz.cs @@ -0,0 +1,99 @@ +using UnityEngine; +using System.Collections; + +public class Bulletz : MonoBehaviour +{ + + public Rigidbody rb; + public float secondsToDestroy = 5; + public float speed = 2f; + public GameObject bullethole; + private float counter = 0; + + + + // Use this for initialization + void Start() + { + rb = gameObject.GetComponent (); + } + + // Update is called once per frame + void FixedUpdate() + { + counter += Time.deltaTime; + transform.Translate(0, 0, speed); + RaycastHit hit; + Ray ray = new Ray(transform.position, transform.forward); + if (Physics.Raycast(ray, out hit, 3f)) + { + if (hit.collider.tag == "Enemy") + { + rb.isKinematic = true; + // sets trigger in EnemyAI.cs + if (speed == 2) + { + EnemyAI.initialHit = true; + } + } + else if (hit.collider.tag == "Wood" || hit.collider.tag == "WoodBelow") + { + if (speed == 2) + { + // sets trigger in WoodDestruction to ensure bullet does not increase destruction stage of two walls at the same time + + WoodDestruction.initialHit = true; + WoodDestruction.hitWoodAbove = false; + } + if (speed >= 0) + { + GameObject bhole = Instantiate(bullethole, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject; + bhole.transform.parent = hit.collider.gameObject.transform; + speed -= 0.25f; + } + } + else if (hit.collider.tag == "WoodAbove") + { + + if (speed == 2) + { + // sets trigger in WoodDestruction to ensure bullet does not increase destruction stage of two walls at the same time + WoodDestruction.initialHit = true; + WoodDestruction.hitWoodAbove = true; + + } + if (speed >= 0) + { + GameObject bhole = Instantiate(bullethole, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject; + speed -= 0.25f; + } + } + + else if (hit.collider.tag == "Debris") + { + if (woodDebris.settled == true) + { + Destroy(this.gameObject); + GameObject bhole = Instantiate(bullethole, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject; + } + } + else + { + GameObject bhole = Instantiate(bullethole, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject; + Destroy(this.gameObject); + // trigger to set woodDestroy false so that bulletholes can be made again + WoodDestruction.woodDestroy = false; + } + } + // ensures that too many bullets do not clog up memory + if (counter > secondsToDestroy) + { + Destroy(this.gameObject); + } + // ensure no bullet bounceback behaviour + if (speed < 0) + { + Destroy(this.gameObject); + } + } +} diff --git a/VScripts/Bulletz.cs.meta b/VScripts/Bulletz.cs.meta new file mode 100644 index 0000000..737b194 --- /dev/null +++ b/VScripts/Bulletz.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 99301cd233fa5e441b0a8387fedb847e +timeCreated: 1460684160 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VScripts/CeilingDestruction.cs b/VScripts/CeilingDestruction.cs new file mode 100644 index 0000000..b05f38d --- /dev/null +++ b/VScripts/CeilingDestruction.cs @@ -0,0 +1,15 @@ +using UnityEngine; +using System.Collections; + +public class CeilingDestruction : MonoBehaviour { + + // Use this for initialization + void Start () { + + } + + // Update is called once per frame + void Update () { + + } +} diff --git a/VScripts/CeilingDestruction.cs.meta b/VScripts/CeilingDestruction.cs.meta new file mode 100644 index 0000000..8914844 --- /dev/null +++ b/VScripts/CeilingDestruction.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6098069fb1347e94c9c9fd8b6a519854 +timeCreated: 1465913806 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VScripts/EnemyAI.cs b/VScripts/EnemyAI.cs new file mode 100644 index 0000000..c2db1b6 --- /dev/null +++ b/VScripts/EnemyAI.cs @@ -0,0 +1,199 @@ +using UnityEngine; +using System.Collections; + + +public class EnemyAI : MonoBehaviour +{ + NavMeshAgent agent; + public Transform target; + public static Vector3 targetPosition; + // AI movespeed on beeline mode, regular movespeed = 3.5 (nav mesh agent speed) + public float moveSpeed = 1.5f; + public static bool initialHit = false; + public static bool enemyHit = false; + [SerializeField]private float wanderDist = 100; + //--- AI states ---// + [SerializeField]private bool wander = true; // default state + [SerializeField]private bool chase = false; // underlying state, if all other states are false will chase, as the nav mesh agent takes over + [SerializeField]private bool scared = false; // hurt state + [SerializeField]private bool manualMovement = false; // dumb, beeline state + //-----------------// + public float health = 100; + [SerializeField]private float stamina = 100; + private bool sight = false; + private float rotationSpeed = 1.5f; + private float hitCooldown = 0; + private float hitCountdown = 1.5f; + private float runBoredomCounter = 7; + private float currentRunBoredom = 0; + private float sightTimer = 0; + private float sightMinimum = 2; + + // Use this for initialization + void Start() + { + // setting up handle to refer to nav mesh agent, or smart AI component + agent = GetComponent(); + } + + // Update is called once per frame + void Update() + { + hitCooldown += Time.deltaTime; + agent.SetDestination(targetPosition); + + // raycast to detect for player to hit + RaycastHit hit; + Ray ray = new Ray(transform.position, transform.forward); + Ray ray2 = new Ray(transform.position / 1.5f, transform.forward); + Ray ray3 = new Ray(transform.position / 2.5f, transform.forward); + if (Physics.Raycast(ray, out hit, 1f)) + { + if (hit.collider.tag == "Player") + { + if (hitCooldown > hitCountdown) + { + PlayerHealth.health -= 20; + hitCooldown = 0; + } + } + } + + // new raycast to simulate line of sight + if (Physics.Raycast(ray, out hit, 30) || Physics.Raycast(ray2, out hit, 30) || Physics.Raycast(ray3, out hit, 30)) + { + Debug.Log(sightTimer); + Debug.DrawLine(transform.position, hit.point, Color.green); + if (hit.collider.tag == "Player") + { + sight = true; + } + + } + + if (sight == true) + { + chase = true; + wander = false; + } + else + { + chase = false; + wander = true; + } + + if (stamina <= 0) + { + chase = false; + wander = true; + } + + // default state is wander, only changes if raycast detects player + if (wander == true) + { + Vector3 newPos = RandomNavSphere(transform.position, wanderDist, -1)/ 6; + agent.SetDestination(newPos); + agent.speed = 3; + if (stamina <= 100) + { + stamina += Time.deltaTime * 6; + } + } + + // second state, chase, disabling wander and taking on regular AI patterns + if (chase == true) { + stamina -= Time.deltaTime * 5; + if (stamina <= 10) { + chase = false; + wander = true; + } + } else { + stamina += Time.deltaTime * 2; + } + + if (wander == false && scared == false) + { + chase = true; + } + + // third state, scared, runs away from player + if (scared == true) + { + Vector3 moveDirection = transform.position - target.transform.position; + agent.SetDestination (moveDirection); + currentRunBoredom += Time.deltaTime; + agent.speed = 4; + chase = false; + + if (currentRunBoredom >= runBoredomCounter) + { + scared = false; + wander = true; + } + } + + // fourth state, moves straight to player position, ignoring obstacles + if (manualMovement == true && target != null) + { + // turns off smart ai and begins a process to slowly crawl over debris, switches off once off debris + transform.position += (target.position - transform.position).normalized * moveSpeed * Time.deltaTime; + transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(target.position - transform.position), rotationSpeed * Time.deltaTime); + } + + // switches to scared state when hurt badly + if (health <= 40 && currentRunBoredom <= runBoredomCounter) + { + scared = true; + } + + // dead + if (health <= 0) + { + Destroy(this.gameObject); + } + + } + + // wandering calculations + public static Vector3 RandomNavSphere(Vector3 origin, float dist, int layermask) + { + Vector3 randDirection = Random.insideUnitSphere * dist; + randDirection += origin; + NavMeshHit navHit; + NavMesh.SamplePosition(randDirection, out navHit, dist, layermask); + return navHit.position; + } + + void OnCollisionEnter(Collision col) + { + // put enemy hit in collision function to maintain individual health variable in each enemy + if (initialHit == true) + { + // damages first target + health -= 20; + initialHit = false; + chase = true; + wander = false; + scared = false; + } + + if (col.gameObject.tag == "Debris" && woodDebris.settled == true && scared == false) + { + // turns off smart AI and turns on dumb beeline enemies that can get through the rubble + wander = false; + manualMovement = true; + gameObject.GetComponent().enabled = false; + } + // prevents flying debris right after destruction from glitching the AI + else if (col.gameObject.tag == "Debris" && woodDebris.settled == false) + { + gameObject.GetComponent().enabled = false; + } + else + { + // once off debris, turns smart AI back on to find path of least resistance + manualMovement = false; + gameObject.GetComponent().enabled = true; + } + } +} diff --git a/VScripts/EnemyAI.cs.meta b/VScripts/EnemyAI.cs.meta new file mode 100644 index 0000000..4aca233 --- /dev/null +++ b/VScripts/EnemyAI.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: bb5dc377f7c35aa419c82e078925e4b0 +timeCreated: 1460726501 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VScripts/Headshot.cs b/VScripts/Headshot.cs new file mode 100644 index 0000000..8e5bf8a --- /dev/null +++ b/VScripts/Headshot.cs @@ -0,0 +1,19 @@ +using UnityEngine; +using System.Collections; + +public class Headshot : MonoBehaviour { + + // Use this for initialization + void Start () { + + } + + // Update is called once per frame + void Update () { + + } + void OnCollisionEnter(Collision col) + { + + } +} diff --git a/VScripts/Headshot.cs.meta b/VScripts/Headshot.cs.meta new file mode 100644 index 0000000..d872357 --- /dev/null +++ b/VScripts/Headshot.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f7e7d2c615a77d84f8cea07061743899 +timeCreated: 1463576789 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VScripts/Player.cs b/VScripts/Player.cs new file mode 100644 index 0000000..267c3f3 --- /dev/null +++ b/VScripts/Player.cs @@ -0,0 +1,14 @@ +using UnityEngine; +using System.Collections; + +public class Player : MonoBehaviour { + public static Vector3 pos; + // Use this for initialization + void Start () { + + } + + // Update is called once per frame + void Update () { + } +} diff --git a/VScripts/Player.cs.meta b/VScripts/Player.cs.meta new file mode 100644 index 0000000..045f177 --- /dev/null +++ b/VScripts/Player.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3b915f5dbdc4bdb409a9af4924353f93 +timeCreated: 1464303463 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VScripts/PlayerHealth.cs b/VScripts/PlayerHealth.cs new file mode 100644 index 0000000..a8a9708 --- /dev/null +++ b/VScripts/PlayerHealth.cs @@ -0,0 +1,24 @@ +using UnityEngine; +using System.Collections; + +public class PlayerHealth : MonoBehaviour +{ + public static int health = 100; + + // Use this for initialization + void Start() + { + SpawnController.isPlayerDead = false; + + } + + // Update is called once per frame + void Update() + { + if (health <= 0) + { + SpawnController.isPlayerDead = true; + Destroy(this.gameObject); + } + } +} \ No newline at end of file diff --git a/VScripts/PlayerHealth.cs.meta b/VScripts/PlayerHealth.cs.meta new file mode 100644 index 0000000..3ce10cc --- /dev/null +++ b/VScripts/PlayerHealth.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 10b8ac6e7d980de45bf4ce51c3ae7dff +timeCreated: 1462924704 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VScripts/StackedWood.cs b/VScripts/StackedWood.cs new file mode 100644 index 0000000..1bd12dd --- /dev/null +++ b/VScripts/StackedWood.cs @@ -0,0 +1,45 @@ +using UnityEngine; +using System.Collections; + +public class StackedWood : MonoBehaviour { + public static bool stackedHit = false; + public GameObject debrisPrefab; + public Rigidbody rb; + private float timer = 0; + private float counter = 0.53f; + + // Use this for initialization + void Start () { + rb = gameObject.GetComponent(); + rb.isKinematic = true; + + } + + // Update is called once per frame + void Update () + { + RaycastHit hit; + Ray ray = new Ray(transform.position, -transform.up); + if (Physics.Raycast(ray, out hit, 2.5f)) + { + Debug.DrawLine(transform.position, hit.point, Color.green); + if (rb.velocity.magnitude > 1f || rb.angularVelocity.magnitude > 1f) { + rb.AddForce(Physics.gravity * rb.mass * 2.75f); + rb.isKinematic = false; + Destroy(this.gameObject); + Instantiate(debrisPrefab, transform.position, transform.rotation); + } + else if (hit.collider.tag != "WoodBelow" && hit.collider.tag != "Player") + { + rb.AddForce(Physics.gravity * rb.mass * 2.75f); + rb.isKinematic = false; + timer += Time.deltaTime; + + if (timer > counter) { + Destroy(this.gameObject); + Instantiate(debrisPrefab, transform.position, transform.rotation); + } + } + } + } +} diff --git a/VScripts/StackedWood.cs.meta b/VScripts/StackedWood.cs.meta new file mode 100644 index 0000000..1a087ba --- /dev/null +++ b/VScripts/StackedWood.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0fccc1784c4107a43b8f240a099ca384 +timeCreated: 1465824731 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VScripts/WoodDestruction.cs b/VScripts/WoodDestruction.cs new file mode 100644 index 0000000..d2f5af4 --- /dev/null +++ b/VScripts/WoodDestruction.cs @@ -0,0 +1,57 @@ +using UnityEngine; +using System.Collections; + +public class WoodDestruction : MonoBehaviour +{ + public static bool initialHit = false; + public static bool woodDestroy = false; + public static bool hitWoodAbove = false; + public GameObject debrisPrefab; + [SerializeField]private int destructionStage = 0; + + + // Use this for initialization + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } + + void OnCollisionEnter(Collision col) + { + + if (initialHit == true) + { + destructionStage += 1; + Debug.Log(destructionStage); + initialHit = false; + } + + if (destructionStage == 3 && hitWoodAbove == false) + { + // setting up position of debris such that it doesnt spawn in the air, rather on the ground + transform.position = new Vector3(transform.position.x, transform.position.y - 0.9f, transform.position.z); + Transform parentDebris = Instantiate (debrisPrefab, transform.position, transform.rotation) as Transform; + + + // switching woodDestroy true which effects BulletHole script, destroying bulletholes on the wall at the same time the wall breaks + woodDestroy = true; + Destroy(this.gameObject); + } + if (destructionStage == 3 && hitWoodAbove == true) + { + Instantiate(debrisPrefab, transform.position, transform.rotation); + woodDestroy = true; + Destroy(this.gameObject); + } + else + { + woodDestroy = false; + } + } +} diff --git a/VScripts/WoodDestruction.cs.meta b/VScripts/WoodDestruction.cs.meta new file mode 100644 index 0000000..8a06832 --- /dev/null +++ b/VScripts/WoodDestruction.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f0c149e171dff6747b9c52e0db93491b +timeCreated: 1461239829 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VScripts/woodDebris.cs b/VScripts/woodDebris.cs new file mode 100644 index 0000000..6477da5 --- /dev/null +++ b/VScripts/woodDebris.cs @@ -0,0 +1,41 @@ +using UnityEngine; +using System.Collections; + +public class woodDebris : MonoBehaviour +{ + public static bool settled = false; + private float settleLimit = 0.65f; + private float settleCounter = 0; + private bool inMotion = false; + // Use this for initialization + void Start() + { + + } + + // Update is called once per frame + void Update() + { + settleCounter += Time.deltaTime; + foreach (Transform child in transform) { + if (child.GetComponent ().velocity.magnitude > 0) { + inMotion = true; + } + } + + while ((settleCounter > settleLimit) && inMotion == false) + { + settled = true; + settleCounter = 0; + } + + if (settled) { + + foreach (Transform child in this.transform) { + Destroy (child.GetComponent()); + } + + } + inMotion = false; + } +} diff --git a/VScripts/woodDebris.cs.meta b/VScripts/woodDebris.cs.meta new file mode 100644 index 0000000..bf9a3c2 --- /dev/null +++ b/VScripts/woodDebris.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 558f9953930333a4295e0d1e938d1f51 +timeCreated: 1461632175 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From d1df48d413787df145c1e1d3b52c8f9b3b5b0377 Mon Sep 17 00:00:00 2001 From: Vincent Mak Date: Thu, 16 Jun 2016 22:10:04 -0400 Subject: [PATCH 26/28] Update README.md --- README.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5f15d6d..f3ffd85 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,22 @@ # ICS4U Personal Coding Project ## Objective -State the objective of the project +The objective of this project is to learn how to use C# to a high degree of understanding and to implement these learned concepts into a Unity project. ## Technical Requirements +Mouse, keyboard, internet connection in order to download the project, monitor and speaker for both audio and visual elements of the game. + ### Knowledge +An understanding of the C# language and the Unity engine, particularly the NavMeshAgent, GUI functions and the other useful built in unity functions. + ### Hardware +A PC or mac + ### Required Software +Executable project file, IDE capable of opening up C# documents. Microsoft's Visual Studio is recommended. ## Install and Set Up -Outline the steps required to install and run your project +Download everything from the dropbox link provided + -## Usage -Outline anything the user needs to know to use your application From e8cb30d22b553a10502247aba695965bffe5a2ca Mon Sep 17 00:00:00 2001 From: Vincent Mak Date: Thu, 16 Jun 2016 22:11:23 -0400 Subject: [PATCH 27/28] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f3ffd85..057bc8e 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ A PC or mac Executable project file, IDE capable of opening up C# documents. Microsoft's Visual Studio is recommended. ## Install and Set Up -Download everything from the dropbox link provided +Download everything from the dropbox link provided and run test.exe From e15a0ce7dda333267cdc49f37750c927324e43df Mon Sep 17 00:00:00 2001 From: dionysius indraatmadja Date: Thu, 16 Jun 2016 22:40:26 -0400 Subject: [PATCH 28/28] Add files via upload --- Vincent Dion PCP.gantter | 1 + 1 file changed, 1 insertion(+) create mode 100644 Vincent Dion PCP.gantter diff --git a/Vincent Dion PCP.gantter b/Vincent Dion PCP.gantter new file mode 100644 index 0000000..f4aad16 --- /dev/null +++ b/Vincent Dion PCP.gantter @@ -0,0 +1 @@ +12project.xmlUser2016-04-13T21:59:352016-06-16T21:25:4912016-03-15T08:00:002016-06-01T17:00:001012$USD0108:00:0017:00:004802400200300720010111001000000012016-06-16T21:23:31110001984-01-01T00:00:00100001Standard1-1102108:00:0012:00:0013:00:0017:00:003108:00:0012:00:0013:00:0017:00:004108:00:0012:00:0013:00:0017:00:005108:00:0012:00:0013:00:0017:00:006108:00:0012:00:0013:00:0017:00:0070224-Hours1-11100:00:0000:00:002100:00:0000:00:003100:00:0000:00:004100:00:0000:00:005100:00:0000:00:006100:00:0000:00:007100:00:0000:00:003Night Shift1-1102123:00:0000:00:003100:00:0003:00:0004:00:0008:00:0023:00:0000:00:004100:00:0003:00:0004:00:0008:00:0023:00:0000:00:005100:00:0003:00:0004:00:0008:00:0023:00:0000:00:006100:00:0003:00:0004:00:0008:00:0023:00:0000:00:007100:00:0003:00:0004:00:0008:00:0000Vincent Dion PCP002016-04-14T01:59:350005002016-03-15T08:00:002016-06-01T17:00:00PT456H0M0S39PT0H0M0S0000101110002016-03-15T08:00:002016-06-01T17:00:002016-03-15T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-03-15T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT456H0M0S0PT0H0M0S0PT0H0M0S000-100000001000null2016-04-13T22:49:3931Personal Coding Project002016-04-14T02:06:231115002016-03-15T08:00:002016-06-01T17:00:00PT456H0M0S7PT0H0M0S010000010002016-03-15T08:00:002016-06-01T17:00:002016-03-15T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-03-15T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT456H0M0S0PT0H0M0S0PT0H0M0S006-12016-06-01T17:00:00000000010ffff0000null42Initial Project Statement002016-04-14T02:06:552215002016-03-15T08:00:002016-03-18T17:00:00PT32H0M0S7PT0H0M0S000000100002016-03-15T08:00:002016-03-18T17:00:002016-05-30T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-03-15T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT32H0M0S0PT0H0M0S0PT0H0M0S000-1000000010ccffff10null13Unity Setup002016-04-14T02:01:542.12.125002016-03-15T08:00:002016-03-15T08:00:00PT0H0M0S7PT0H0M0S010001000002016-03-15T08:00:002016-03-15T08:00:002016-05-30T08:00:002016-05-30T08:00:0000000030000PT0H0M0S2016-03-15T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT0H0M0S0PT0H0M0S0PT0H0M0S004-12016-03-15T08:00:0000000001000null24Game Brainstorm002016-04-14T02:02:542.22.225002016-03-16T08:00:002016-03-18T17:00:00PT24H0M0S7PT0H0M0S010000000002016-03-16T08:00:002016-03-18T17:00:002016-05-30T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-03-16T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT24H0M0S0PT0H0M0S0PT0H0M0S004-12016-03-16T08:00:0000000001100710ccffff00null65Research and Learning002016-04-14T02:08:203315002016-03-22T08:00:002016-04-22T17:00:00PT192H0M0S7PT0H0M0S000000100002016-03-22T08:00:002016-04-22T17:00:002016-04-29T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-03-22T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT192H0M0S0PT0H0M0S0PT0H0M0S000-1000000010ff000010null76Unity Beginner Scripting Tutorial002016-04-14T02:08:413.13.125002016-03-22T08:00:002016-03-23T17:00:00PT16H0M0S7PT0H0M0S010000000002016-03-22T08:00:002016-03-23T17:00:002016-05-02T08:00:002016-05-03T17:00:0000000030000PT0H0M0S2016-03-22T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT16H0M0S0PT0H0M0S0PT0H0M0S006-12016-03-23T17:00:00000000010ff000000null87C# Basics Microsoft Documentation002016-04-14T02:09:533.23.225002016-03-22T08:00:002016-03-23T17:00:00PT16H0M0S7PT0H0M0S010000000002016-03-22T08:00:002016-03-23T17:00:002016-04-29T08:00:002016-05-02T17:00:0000000030000PT0H0M0S2016-03-22T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT16H0M0S0PT0H0M0S0PT0H0M0S004-12016-03-22T08:00:00000000010ff000000null188Unity Modelling Basics Tutorials002016-04-14T02:13:073.33.325002016-03-23T08:00:002016-03-25T17:00:00PT24H0M0S7PT0H0M0S010000000002016-03-23T08:00:002016-03-25T17:00:002016-05-20T08:00:002016-05-24T17:00:0000000030000PT0H0M0S2016-03-23T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT24H0M0S0PT0H0M0S0PT0H0M0S004-12016-03-23T08:00:00000000010ff000000null239Unity Terrain Editing Tutorials002016-04-14T02:20:553.43.425002016-03-23T08:00:002016-03-24T17:00:00PT16H0M0S7PT0H0M0S010000000002016-03-23T08:00:002016-03-24T17:00:002016-05-31T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-03-23T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT16H0M0S0PT0H0M0S0PT0H0M0S006-12016-03-24T17:00:00000000010ff000000null2110Multiplayer Networking Basics Tutorials002016-04-14T02:16:593.53.525002016-03-24T08:00:002016-03-31T17:00:00PT48H0M0S7PT0H0M0S010000000002016-03-24T08:00:002016-03-31T17:00:002016-05-17T08:00:002016-05-24T17:00:0000000030000PT0H0M0S2016-03-24T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT48H0M0S0PT0H0M0S0PT0H0M0S004-12016-03-23T08:00:000000000710078100710ff000000null2011Blender 3D Modelling Tutorial002016-04-14T02:16:483.63.625002016-03-28T08:00:002016-03-31T17:00:00PT32H0M0S7PT0H0M0S010000000002016-03-28T08:00:002016-03-31T17:00:002016-05-27T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-03-28T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT32H0M0S0PT0H0M0S0PT0H0M0S006-12016-03-28T17:00:00000000018100710ff000000null2612Experimenting With the Unity Engine002016-04-14T02:25:003.73.725002016-03-24T08:00:002016-03-28T17:00:00PT24H0M0S7PT0H0M0S010000000002016-03-24T08:00:002016-03-28T17:00:002016-05-30T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-03-24T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT24H0M0S0PT0H0M0S0PT0H0M0S004-12016-03-24T08:00:000000000710078100710ff000000null2213Unity Advanced Scripting Tutorials002016-04-14T02:18:223.83.825002016-03-24T08:00:002016-04-18T17:00:00PT144H0M0S7PT0H0M0S010000000002016-03-24T08:00:002016-04-18T17:00:002016-05-04T08:00:002016-05-27T17:00:0000000030000PT0H0M0S2016-03-24T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT144H0M0S0PT0H0M0S0PT0H0M0S004-12016-03-24T08:00:000000000710078100710ff000000null3014C# Advanced Features002016-04-14T02:30:493.93.925002016-03-24T08:00:002016-04-19T17:00:00PT152H0M0S7PT0H0M0S010000000002016-03-24T08:00:002016-04-19T17:00:002016-05-03T08:00:002016-05-27T17:00:0000000030000PT0H0M0S2016-03-24T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT152H0M0S0PT0H0M0S0PT0H0M0S006-12016-04-19T17:00:0000000008100710ff000000null2415Inventory System Tutorial002016-04-14T02:21:373.103.1025002016-04-20T08:00:002016-04-22T17:00:00PT24H0M0S7PT0H0M0S010000000002016-04-20T08:00:002016-04-22T17:00:002016-05-30T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-04-20T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT24H0M0S0PT0H0M0S0PT0H0M0S006-12016-03-28T17:00:00000000022100730100710ff000000null2516Graphical User Interface Tutorials002016-04-14T02:21:383.113.1125002016-04-20T08:00:002016-04-21T17:00:00PT16H0M0S7PT0H0M0S010000000002016-04-20T08:00:002016-04-21T17:00:002016-05-31T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-04-20T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT16H0M0S0PT0H0M0S0PT0H0M0S006-12016-03-28T17:00:00000000022100730100710ff000000null2717First Person Shooter Element Tutorials002016-04-14T02:28:093.123.1225002016-04-01T08:00:002016-04-08T17:00:00PT48H0M0S7PT0H0M0S010000000002016-04-01T08:00:002016-04-08T17:00:002016-05-25T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-04-01T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT48H0M0S0PT0H0M0S0PT0H0M0S006-12016-04-06T17:00:0000000007100718100721100710ff000000null2818Start Menu Tutorial002016-04-14T02:29:333.133.1325002016-04-20T08:00:002016-04-22T17:00:00PT24H0M0S7PT0H0M0S010000000002016-04-20T08:00:002016-04-22T17:00:002016-05-30T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-04-20T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT24H0M0S0PT0H0M0S0PT0H0M0S006-12016-03-30T17:00:00000000022100730100710ff000000null919Development002016-04-14T02:09:534415002016-04-11T08:00:002016-05-25T17:00:00PT264H0M0S7PT0H0M0S000000100002016-04-11T08:00:002016-05-25T17:00:002016-04-18T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-04-11T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT264H0M0S0PT0H0M0S0PT0H0M0S000-100000001000null3320Import Assets and Controllers002016-04-14T02:32:534.14.125002016-04-11T08:00:002016-04-12T17:00:00PT16H0M0S7PT0H0M0S010000000002016-04-11T08:00:002016-04-12T17:00:002016-04-18T08:00:002016-04-19T17:00:0000000030000PT0H0M0S2016-04-11T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT16H0M0S0PT0H0M0S0PT0H0M0S006-12016-04-12T17:00:0000000001000ffff00null1021Create Different Functionalities002016-04-14T02:10:074.24.225002016-04-13T08:00:002016-05-10T17:00:00PT160H0M0S7PT0H0M0S010000000002016-04-13T08:00:002016-05-10T17:00:002016-04-20T08:00:002016-05-17T17:00:0000000030000PT0H0M0S2016-04-13T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT160H0M0S0PT0H0M0S0PT0H0M0S004-12016-04-12T08:00:0000000003310071000ffff00null3422Level Design002016-04-14T02:33:094.34.325002016-05-11T08:00:002016-05-19T17:00:00PT56H0M0S7PT0H0M0S010000000002016-05-11T08:00:002016-05-19T17:00:002016-05-18T08:00:002016-05-26T17:00:0000000030000PT0H0M0S2016-05-11T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT56H0M0S0PT0H0M0S0PT0H0M0S004-12016-05-10T08:00:0000000001010071000ffff00null3223Merge Code002016-04-14T02:32:334.44.425002016-05-20T08:00:002016-05-25T17:00:00PT32H0M0S7PT0H0M0S010000000002016-05-20T08:00:002016-05-25T17:00:002016-05-27T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-05-20T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT32H0M0S0PT0H0M0S0PT0H0M0S000-100000003410071000ffff00null1124Testing002016-04-14T02:10:115515002016-05-25T08:00:002016-05-27T17:00:00PT24H0M0S7PT0H0M0S000000100002016-05-25T08:00:002016-05-27T17:00:002016-05-30T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-05-25T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT24H0M0S0PT0H0M0S0PT0H0M0S000-100000001000null1225Finding Bugs and Errors002016-04-14T02:10:135.15.125002016-05-25T08:00:002016-05-27T17:00:00PT24H0M0S7PT0H0M0S010000000002016-05-25T08:00:002016-05-27T17:00:002016-05-30T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-05-25T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT24H0M0S0PT0H0M0S0PT0H0M0S004-12016-05-25T08:00:00000000010ffff9900null3526Fixing Bugs and Errors002016-04-14T02:43:495.25.225002016-05-25T08:00:002016-05-27T17:00:00PT24H0M0S7PT0H0M0S010000000002016-05-25T08:00:002016-05-27T17:00:002016-05-30T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-05-25T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT24H0M0S0PT0H0M0S0PT0H0M0S004-12016-05-25T08:00:00000000010ffff9900null1327Documentation002016-04-14T02:10:146615002016-05-27T08:00:002016-05-30T17:00:00PT16H0M0S39PT0H0M0S000010100002016-05-27T08:00:002016-05-30T17:00:002016-05-31T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-05-27T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT16H0M0S0PT0H0M0S0PT0H0M0S000-100000001000null1428Github Readme File002016-04-14T02:11:036.16.125002016-05-27T08:00:002016-05-30T17:00:00PT16H0M0S7PT0H0M0S010000000002016-05-27T08:00:002016-05-30T17:00:002016-05-31T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-05-27T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT16H0M0S0PT0H0M0S0PT0H0M0S004-12016-05-27T08:00:0000000001066669900null3729Code Walkthrough Video002016-04-14T02:44:146.26.225002016-05-27T08:00:002016-05-30T17:00:00PT16H0M0S7PT0H0M0S010000000002016-05-27T08:00:002016-05-30T17:00:002016-05-31T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-05-27T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT16H0M0S0PT0H0M0S0PT0H0M0S006-12016-05-30T17:00:0000000001066669900null3830Product Walkthrough Video002016-04-14T02:44:236.36.325002016-05-27T08:00:002016-05-30T17:00:00PT16H0M0S39PT0H0M0S010010000002016-05-27T08:00:002016-05-30T17:00:002016-05-31T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-05-27T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT16H0M0S0PT0H0M0S0PT0H0M0S006-12016-05-30T17:00:0000000001066669900null1531Project Close002016-04-14T02:11:087715002016-06-01T08:00:002016-06-01T17:00:00PT8H0M0S7PT0H0M0S000000110002016-06-01T08:00:002016-06-01T17:00:002016-06-01T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-06-01T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT8H0M0S0PT0H0M0S0PT0H0M0S000-100000001000null1632Reflection & Self-Assessment002016-04-14T02:11:267.17.125002016-06-01T08:00:002016-06-01T17:00:00PT8H0M0S7PT0H0M0S010000010002016-06-01T08:00:002016-06-01T17:00:002016-06-01T08:00:002016-06-01T17:00:0000000030000PT0H0M0S2016-06-01T08:00:00PT0H0M0S00PT0H0M0SPT0H0M0SPT0H0M0SPT8H0M0S0PT0H0M0S0PT0H0M0S004-12016-06-01T08:00:00000000010ff660000null \ No newline at end of file