Skip to content
This repository has been archived by the owner on May 26, 2018. It is now read-only.

Commit

Permalink
Merge pull request #123 from aagavin/feature/arrow
Browse files Browse the repository at this point in the history
Feature/arrow
  • Loading branch information
sabishiangel authored Dec 17, 2016
2 parents a5ced88 + 4393472 commit 6b19317
Show file tree
Hide file tree
Showing 4 changed files with 221 additions and 17 deletions.
2 changes: 1 addition & 1 deletion game/Assets/Prefabs/FPSController.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1440884344294724}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -232.04, y: 214.5, z: 158.77}
m_LocalPosition: {x: -358.552, y: 209.901, z: 127.47}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4482944865414442}
Expand Down
2 changes: 1 addition & 1 deletion game/Assets/Prefabs/WinObject.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ GameObject:
- component: {fileID: 114427019808579230}
m_Layer: 0
m_Name: WinObject
m_TagString: Untagged
m_TagString: KeyObject
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
Expand Down
164 changes: 164 additions & 0 deletions game/Assets/_Scenes/Level3.unity
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,18 @@ Transform:
GameObject:
m_PrefabParentObject: {fileID: 100000, guid: 3c56c64a2ab75cc47958f360b6f02938, type: 3}
m_PrefabInternal: {fileID: 1743380789}
--- !u!65 &97752446
BoxCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 97752445}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 2.000001, y: 0.25695705, z: 0.60000056}
m_Center: {x: -0.00000071525574, y: -0.87163925, z: 0.29980013}
--- !u!64 &97752448
MeshCollider:
m_ObjectHideFlags: 0
Expand All @@ -470,6 +482,18 @@ MeshCollider:
GameObject:
m_PrefabParentObject: {fileID: 100000, guid: 3c56c64a2ab75cc47958f360b6f02938, type: 3}
m_PrefabInternal: {fileID: 537373850}
--- !u!65 &102895862
BoxCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 102895861}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 2.000001, y: 0.26308727, z: 0.60000056}
m_Center: {x: -0.000009059906, y: -0.868557, z: 0.2998459}
--- !u!64 &102895864
MeshCollider:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -804,6 +828,18 @@ MeshCollider:
GameObject:
m_PrefabParentObject: {fileID: 100000, guid: 6dd60b4eb00d3eb48afad34090c7fa1b, type: 3}
m_PrefabInternal: {fileID: 618051424}
--- !u!65 &217657452
BoxCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 217657451}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.25272503, y: 2.0000017, z: 0.6000006}
m_Center: {x: 0.8737117, y: 0.00030201674, z: 0.29969332}
--- !u!64 &217657454
MeshCollider:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1119,6 +1155,18 @@ MeshCollider:
GameObject:
m_PrefabParentObject: {fileID: 100000, guid: a123cd3a2106b9746ba9c256157edb81, type: 3}
m_PrefabInternal: {fileID: 1466251894}
--- !u!65 &369218171
BoxCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 369218170}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.23750229, y: 2.0000007, z: 0.60000056}
m_Center: {x: -0.881423, y: 0.00018596649, z: 0.2999054}
--- !u!64 &369218173
MeshCollider:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1210,6 +1258,7 @@ Transform:
- {fileID: 990157570}
- {fileID: 86076953}
- {fileID: 977368577}
- {fileID: 1570322267}
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down Expand Up @@ -2623,6 +2672,18 @@ MeshCollider:
GameObject:
m_PrefabParentObject: {fileID: 100000, guid: a123cd3a2106b9746ba9c256157edb81, type: 3}
m_PrefabInternal: {fileID: 131530050}
--- !u!65 &791121108
BoxCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 791121107}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.24717534, y: 2.0000017, z: 0.6000006}
m_Center: {x: -0.8765069, y: -0.0000032186508, z: 0.29967806}
--- !u!64 &791121110
MeshCollider:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -4844,6 +4905,18 @@ Transform:
GameObject:
m_PrefabParentObject: {fileID: 100000, guid: a123cd3a2106b9746ba9c256157edb81, type: 3}
m_PrefabInternal: {fileID: 877652678}
--- !u!65 &1563185382
BoxCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1563185381}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.21704945, y: 2.0000017, z: 0.60000074}
m_Center: {x: -0.89151114, y: -0.00013458701, z: 0.29986393}
--- !u!64 &1563185384
MeshCollider:
m_ObjectHideFlags: 0
Expand All @@ -4858,6 +4931,61 @@ MeshCollider:
m_InflateMesh: 0
m_SkinWidth: 0.01
m_Mesh: {fileID: 4300000, guid: a123cd3a2106b9746ba9c256157edb81, type: 3}
--- !u!1001 &1570322266
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 369883338}
m_Modifications:
- target: {fileID: 4800401081769942, guid: 517c701cdcbbb17418f41124d274147b, type: 2}
propertyPath: m_LocalPosition.x
value: -6.84
objectReference: {fileID: 0}
- target: {fileID: 4800401081769942, guid: 517c701cdcbbb17418f41124d274147b, type: 2}
propertyPath: m_LocalPosition.y
value: -4.41
objectReference: {fileID: 0}
- target: {fileID: 4800401081769942, guid: 517c701cdcbbb17418f41124d274147b, type: 2}
propertyPath: m_LocalPosition.z
value: 3.24
objectReference: {fileID: 0}
- target: {fileID: 4800401081769942, guid: 517c701cdcbbb17418f41124d274147b, type: 2}
propertyPath: m_LocalRotation.x
value: 0.9426408
objectReference: {fileID: 0}
- target: {fileID: 4800401081769942, guid: 517c701cdcbbb17418f41124d274147b, type: 2}
propertyPath: m_LocalRotation.y
value: 0.05648659
objectReference: {fileID: 0}
- target: {fileID: 4800401081769942, guid: 517c701cdcbbb17418f41124d274147b, type: 2}
propertyPath: m_LocalRotation.z
value: -0.25257978
objectReference: {fileID: 0}
- target: {fileID: 4800401081769942, guid: 517c701cdcbbb17418f41124d274147b, type: 2}
propertyPath: m_LocalRotation.w
value: 0.21081066
objectReference: {fileID: 0}
- target: {fileID: 4800401081769942, guid: 517c701cdcbbb17418f41124d274147b, type: 2}
propertyPath: m_RootOrder
value: 52
objectReference: {fileID: 0}
- target: {fileID: 4800401081769942, guid: 517c701cdcbbb17418f41124d274147b, type: 2}
propertyPath: m_LocalEulerAnglesHint.y
value: 30
objectReference: {fileID: 0}
- target: {fileID: 4800401081769942, guid: 517c701cdcbbb17418f41124d274147b, type: 2}
propertyPath: m_LocalEulerAnglesHint.x
value: 154.788
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 517c701cdcbbb17418f41124d274147b, type: 2}
m_IsPrefabParent: 0
--- !u!4 &1570322267 stripped
Transform:
m_PrefabParentObject: {fileID: 4800401081769942, guid: 517c701cdcbbb17418f41124d274147b,
type: 2}
m_PrefabInternal: {fileID: 1570322266}
--- !u!1 &1586769410 stripped
GameObject:
m_PrefabParentObject: {fileID: 100000, guid: 72640556a995a3b4493c8781b08d0f1c, type: 3}
Expand Down Expand Up @@ -4997,6 +5125,18 @@ Transform:
GameObject:
m_PrefabParentObject: {fileID: 100000, guid: a123cd3a2106b9746ba9c256157edb81, type: 3}
m_PrefabInternal: {fileID: 1736408302}
--- !u!65 &1669286681
BoxCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1669286680}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.23864104, y: 2.0000007, z: 0.6000006}
m_Center: {x: -0.8806817, y: -0.0000009536743, z: 0.29994583}
--- !u!64 &1669286683
MeshCollider:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -5473,6 +5613,18 @@ MeshCollider:
GameObject:
m_PrefabParentObject: {fileID: 100000, guid: 3c56c64a2ab75cc47958f360b6f02938, type: 3}
m_PrefabInternal: {fileID: 1072281685}
--- !u!65 &1788384132
BoxCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1788384131}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 2.000001, y: 0.22939435, z: 0.60000056}
m_Center: {x: -0.00024414062, y: -0.8854523, z: 0.2997574}
--- !u!64 &1788384134
MeshCollider:
m_ObjectHideFlags: 0
Expand All @@ -5491,6 +5643,18 @@ MeshCollider:
GameObject:
m_PrefabParentObject: {fileID: 100000, guid: 27cebd4453c1596479be72e84d0675b0, type: 3}
m_PrefabInternal: {fileID: 548879369}
--- !u!65 &1853404550
BoxCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1853404549}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.23520231, y: 2.0000007, z: 0.60000056}
m_Center: {x: 0.8823418, y: 0.00017595291, z: 0.3001713}
--- !u!64 &1853404552
MeshCollider:
m_ObjectHideFlags: 0
Expand Down
70 changes: 55 additions & 15 deletions game/Assets/_Scripts/Level_3/ArrowScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,84 @@
using System.Collections.Generic;
using UnityEngine;

/*
* Pedro Bento
* Aaron Fernandes
* Waynell Lovell
* Ashley Tjonhing
*
*
* COMP 305 - Assignment 4 | Final
*/


/// <summary>
/// Arrow script class
/// </summary>
public class ArrowScript : MonoBehaviour {

private Transform key;
private Vector3 key;
private Transform player;

// Use this for initialization
/// <summary>
/// Start this instance.
/// </summary>
void Start () {

key = GameObject.FindGameObjectWithTag("KeyObject").transform;

if (!key)
Debug.Log("ERROR could not find Key!");
StartCoroutine ("Starter");
}

// Update is called once per frame
/// <summary>
/// Update this instance.
/// </summary>
void Update () {
StartCoroutine("Rotator", 0.1f);

Rotation();
}

void Rotation()
{
Vector2 target = key.position;
//Couldn't fix this <(T_T)>^(T_T)^<(T_T)>
Vector3 target = key;

float dx = this.transform.position.x - target.x;
float dy = this.transform.position.y - target.y;
float dx = player.position.x - target.x;
float dy = player.position.y - target.y;
float dz = player.position.z - target.z;

float angle = Mathf.Atan2(dy, dx) * Mathf.Rad2Deg;

Quaternion rot = Quaternion.Euler(new Vector3(0, 0, angle));
Quaternion rot = Quaternion.Euler(0, 0, angle);
Debug.Log(angle);

this.transform.rotation = rot;

}

/// <summary>
/// Starter IEnumerator
/// </summary>
IEnumerator Starter()
{
yield return new WaitForSeconds(1f);
Debug.Log (GameObject.FindGameObjectWithTag ("KeyObject"));
key = GameObject.FindGameObjectWithTag("KeyObject").transform.position;

player = GameObject.FindGameObjectWithTag("Player").transform;
/*
if (!key) {
Debug.Log ("ERROR could not find Key!");
}
*/
}


/// <summary>
/// Rotator this instance.
/// </summary>
IEnumerator Rotator()
{
yield return new WaitForSeconds(0.1f);
{
yield return new WaitForSeconds(5f);
Rotation();
Debug.Log("boo");
}


Expand Down

0 comments on commit 6b19317

Please sign in to comment.