| @@ -0,0 +1,104 @@ | ||
| %YAML 1.1 | ||
| %TAG !u! tag:unity3d.com,2011: | ||
| --- !u!1 &186856 | ||
| GameObject: | ||
| m_ObjectHideFlags: 0 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| serializedVersion: 4 | ||
| m_Component: | ||
| - 4: {fileID: 427344} | ||
| - 33: {fileID: 3397568} | ||
| - 65: {fileID: 6528084} | ||
| - 23: {fileID: 2359148} | ||
| - 54: {fileID: 5477216} | ||
| m_Layer: 0 | ||
| m_Name: testcube | ||
| m_TagString: Untagged | ||
| m_Icon: {fileID: 0} | ||
| m_NavMeshLayer: 0 | ||
| m_StaticEditorFlags: 0 | ||
| m_IsActive: 1 | ||
| --- !u!4 &427344 | ||
| Transform: | ||
| m_ObjectHideFlags: 1 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| m_GameObject: {fileID: 186856} | ||
| m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||
| m_LocalPosition: {x: 0, y: 0.37, z: 0.224} | ||
| m_LocalScale: {x: 0.06751924, y: 0.0675192, z: 0.0675192} | ||
| m_Children: [] | ||
| m_Father: {fileID: 0} | ||
| m_RootOrder: 0 | ||
| --- !u!23 &2359148 | ||
| MeshRenderer: | ||
| m_ObjectHideFlags: 1 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| m_GameObject: {fileID: 186856} | ||
| m_Enabled: 1 | ||
| m_CastShadows: 1 | ||
| m_ReceiveShadows: 1 | ||
| m_Materials: | ||
| - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} | ||
| m_SubsetIndices: | ||
| m_StaticBatchRoot: {fileID: 0} | ||
| m_UseLightProbes: 1 | ||
| m_ReflectionProbeUsage: 1 | ||
| m_ProbeAnchor: {fileID: 0} | ||
| m_ScaleInLightmap: 1 | ||
| m_PreserveUVs: 1 | ||
| m_IgnoreNormalsForChartDetection: 0 | ||
| m_ImportantGI: 0 | ||
| m_MinimumChartSize: 4 | ||
| m_AutoUVMaxDistance: 0.5 | ||
| m_AutoUVMaxAngle: 89 | ||
| m_LightmapParameters: {fileID: 0} | ||
| m_SortingLayerID: 0 | ||
| m_SortingOrder: 0 | ||
| --- !u!33 &3397568 | ||
| MeshFilter: | ||
| m_ObjectHideFlags: 1 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| m_GameObject: {fileID: 186856} | ||
| m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} | ||
| --- !u!54 &5477216 | ||
| Rigidbody: | ||
| m_ObjectHideFlags: 1 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| m_GameObject: {fileID: 186856} | ||
| serializedVersion: 2 | ||
| m_Mass: 1 | ||
| m_Drag: 0 | ||
| m_AngularDrag: 0.05 | ||
| m_UseGravity: 1 | ||
| m_IsKinematic: 0 | ||
| m_Interpolate: 0 | ||
| m_Constraints: 0 | ||
| m_CollisionDetection: 2 | ||
| --- !u!65 &6528084 | ||
| BoxCollider: | ||
| m_ObjectHideFlags: 1 | ||
| m_PrefabParentObject: {fileID: 0} | ||
| m_PrefabInternal: {fileID: 100100000} | ||
| m_GameObject: {fileID: 186856} | ||
| m_Material: {fileID: 0} | ||
| m_IsTrigger: 0 | ||
| m_Enabled: 1 | ||
| serializedVersion: 2 | ||
| m_Size: {x: 1, y: 1, z: 1} | ||
| m_Center: {x: 0, y: 0, z: 0} | ||
| --- !u!1001 &100100000 | ||
| Prefab: | ||
| m_ObjectHideFlags: 1 | ||
| serializedVersion: 2 | ||
| m_Modification: | ||
| m_TransformParent: {fileID: 0} | ||
| m_Modifications: [] | ||
| m_RemovedComponents: [] | ||
| m_ParentPrefab: {fileID: 0} | ||
| m_RootGameObject: {fileID: 186856} | ||
| m_IsPrefabParent: 1 |
| @@ -1,29 +1,19 @@ | ||
| using UnityEngine; | ||
| using System.Collections; | ||
| using System; | ||
|
|
||
| abstract public class GameObjectiveState : MonoBehaviour { | ||
|
|
||
| public abstract bool CheckIfStateIsReached(); | ||
| } | ||
|
|
||
|
|
||
|
|
||
| abstract public class GoalState : GameObjectiveState { } | ||
|
|
||
|
|
||
|
|
||
| abstract public class FailState : GameObjectiveState { } | ||
|
|
||
|
|
||
|
|
| @@ -0,0 +1,33 @@ | ||
| using UnityEngine; | ||
| using System.Collections; | ||
|
|
||
| public class OnTouchBehavior : MonoBehaviour { | ||
|
|
||
| public string targetName; | ||
|
|
||
| // Use this for initialization | ||
| void Start () { | ||
|
|
||
| } | ||
|
|
||
| // Update is called once per frame | ||
| void Update () { | ||
|
|
||
| } | ||
|
|
||
| void OnCollisionEnter(Collision other) | ||
| { | ||
| if (other.gameObject.name == targetName) | ||
| { | ||
| Debug.Log("YESSSSS"); | ||
| } | ||
| } | ||
|
|
||
| void OnTriggerEnter(Collider other) | ||
| { | ||
| if (other.name == targetName) | ||
| { | ||
| Debug.Log("YESSSSS"); | ||
| } | ||
| } | ||
| } |
| @@ -1,23 +1,23 @@ | ||
| using UnityEngine; | ||
| using System.Collections; | ||
|
|
||
| // example fail | ||
| public class TestFail : FailState | ||
| { | ||
|
|
||
| int test = 0; | ||
|
|
||
| public override bool CheckIfStateIsReached() | ||
| { | ||
| if (test == 10) | ||
| { | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| public void Update() | ||
| { | ||
| test++; | ||
| } | ||
| } |
| @@ -1,24 +1,24 @@ | ||
| using UnityEngine; | ||
| using System.Collections; | ||
| using System; | ||
|
|
||
|
|
||
| // example goal | ||
| public class TestGoal : GoalState | ||
| { | ||
| int test = 0; | ||
|
|
||
| public override bool CheckIfStateIsReached() | ||
| { | ||
| if (test == 5) | ||
| { | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| public void Update() | ||
| { | ||
| test++; | ||
| } | ||
| } |
| @@ -0,0 +1,45 @@ | ||
| using UnityEngine; | ||
| using System.Collections; | ||
| using System; | ||
|
|
||
| public class ThrowGoal : GoalState | ||
| { | ||
| public GameObject objectToThrow; | ||
| public GameObject targetObject; | ||
|
|
||
| public float distanceToThrowObject = 10f; | ||
|
|
||
| private Rigidbody targetRB; | ||
| private Rigidbody grabbedRB; | ||
|
|
||
| void Start() | ||
| { | ||
| objectToThrow = GameObject.Find(objectToThrow.name); | ||
| if (targetObject != null) | ||
| { | ||
| targetObject = GameObject.Find(targetObject.name); | ||
| targetRB = targetObject.GetComponent<Rigidbody>(); | ||
| grabbedRB = objectToThrow.GetComponent<Rigidbody>(); | ||
| } | ||
| } | ||
|
|
||
| public override bool CheckIfStateIsReached() | ||
| { | ||
| // We have a target that must we must throw something at | ||
| if (targetObject != null) | ||
| { | ||
| // TODO: target throw not implemented | ||
| // what if mulitple objects to throw? | ||
|
|
||
| } | ||
| else // otherwise throw an object away a certain distance | ||
| { | ||
| float distance = Vector3.Distance(objectToThrow.transform.position, Camera.main.transform.position); | ||
| if (distance >= distanceToThrowObject) | ||
| { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
| } |
| @@ -0,0 +1,29 @@ | ||
| using System; | ||
| using UnityEngine; | ||
|
|
||
| public class TimeFail : FailState { | ||
|
|
||
| public float countdownTime = 30; | ||
|
|
||
| private float counter; | ||
|
|
||
| // TODO true if time has passed | ||
| public override bool CheckIfStateIsReached() | ||
| { | ||
| if (counter >= countdownTime) | ||
| { | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| // Use this for initialization | ||
| void Start () { | ||
| counter = 0; | ||
| } | ||
|
|
||
| void Update() | ||
| { | ||
| counter += Time.deltaTime; | ||
| } | ||
| } |
| @@ -3,7 +3,8 @@ | ||
| --- !u!78 &1 | ||
| TagManager: | ||
| serializedVersion: 2 | ||
| tags: | ||
| - Throwable | ||
| layers: | ||
| - Default | ||
| - TransparentFX | ||