diff --git a/Assets/Controls.cs b/Assets/Controls.cs deleted file mode 100644 index 3a6bb2d..0000000 --- a/Assets/Controls.cs +++ /dev/null @@ -1,34 +0,0 @@ - -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class Controls : MonoBehaviour { - - public float Speed = 8f; - // Use this for initialization - void Start () { - - } - - // Update is called once per frame - void Update () { - if(Input.GetKey(KeyCode.W)) - transform.Rotate(transform.right, Time.deltaTime * 64f); - - if(Input.GetKey(KeyCode.S)) - transform.Rotate(-transform.right, Time.deltaTime * 64f); - - if(Input.GetKey(KeyCode.D)) - transform.Rotate(transform.forward, Time.deltaTime * 64f); - - if(Input.GetKey(KeyCode.A)) - transform.Rotate(-transform.forward, Time.deltaTime * 64f); - - transform.position += Time.deltaTime * transform.forward * Speed; - } - - void OnCollisionEnter(){ - Debug.Log ("Explosion"); - } -} diff --git a/Assets/FollowShip.cs b/Assets/FollowShip.cs new file mode 100644 index 0000000..558280f --- /dev/null +++ b/Assets/FollowShip.cs @@ -0,0 +1,18 @@ +using UnityEngine; +using System.Collections; + +public class FollowShip : MonoBehaviour { + + public GameObject TargetShip; + public Vector3 Offset; + + void Update () { + this.transform.position = Lerp (this.transform.position, TargetShip.transform.position + TargetShip.transform.forward * Offset.z + TargetShip.transform.up * Offset.y, Time.deltaTime * 16f); + this.transform.LookAt(TargetShip.transform.position + Vector3.up, Vector3.up); + //this.transform.rotation = Quaternion.Slerp(this.transform.rotation, TargetShip.transform.rotation, Time.deltaTime * 32f); + } + + public Vector3 Lerp(Vector3 A, Vector3 B, float C){ + return new Vector3 (Mathf.Lerp(A.x, B.x, C), Mathf.Lerp(A.y, B.y, C), Mathf.Lerp(A.z, B.z, C) ); + } +} diff --git a/Assets/Controls.cs.meta b/Assets/FollowShip.cs.meta similarity index 77% rename from Assets/Controls.cs.meta rename to Assets/FollowShip.cs.meta index 842f326..8028b61 100644 --- a/Assets/Controls.cs.meta +++ b/Assets/FollowShip.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: aebc15e318f4c7748bb9d3b03976707f -timeCreated: 1509918800 +guid: 71c008b860fb0d84493a7d181f51c970 +timeCreated: 1510289027 licenseType: Free MonoImporter: externalObjects: {} diff --git a/Assets/Game.unity b/Assets/Game.unity index 69bba9c..495fe6a 100644 --- a/Assets/Game.unity +++ b/Assets/Game.unity @@ -141,7 +141,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 3 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!23 &161534276 MeshRenderer: @@ -213,6 +213,7 @@ GameObject: - component: {fileID: 729518489} - component: {fileID: 729518487} - component: {fileID: 729518486} + - component: {fileID: 729518488} m_Layer: 0 m_Name: Main Camera m_TagString: MainCamera @@ -276,11 +277,11 @@ Transform: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 729518478} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 2.09, z: -18.5} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalPosition: {x: 0, y: 2.09, z: -5.4243426} + m_LocalScale: {x: 1, y: 1, z: 0.2932077} m_Children: [] - m_Father: {fileID: 2004386719} - m_RootOrder: 0 + m_Father: {fileID: 0} + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &729518483 MonoBehaviour: @@ -395,6 +396,19 @@ MonoBehaviour: separableBlurShader: {fileID: 4800000, guid: e97c14fbb5ea04c3a902cc533d7fc5d1, type: 3} chromAberrationShader: {fileID: 4800000, guid: 2b4f29398d9484ccfa9fd220449f5eee, type: 3} +--- !u!114 &729518488 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 729518478} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71c008b860fb0d84493a7d181f51c970, type: 3} + m_Name: + m_EditorClassIdentifier: + TargetShip: {fileID: 1582243898} + Offset: {x: 0, y: 1, z: 10} --- !u!114 &729518489 MonoBehaviour: m_ObjectHideFlags: 0 @@ -479,7 +493,7 @@ Prefab: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: - m_TransformParent: {fileID: 2004386719} + m_TransformParent: {fileID: 1410985307} m_Modifications: - target: {fileID: 400000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} propertyPath: m_LocalPosition.x @@ -487,39 +501,39 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 400000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} propertyPath: m_LocalPosition.y - value: -2.18 + value: 0 objectReference: {fileID: 0} - target: {fileID: 400000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} propertyPath: m_LocalPosition.z - value: 14.21 + value: 0 objectReference: {fileID: 0} - target: {fileID: 400000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} propertyPath: m_LocalRotation.x - value: -0.7071068 + value: 0 objectReference: {fileID: 0} - target: {fileID: 400000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} propertyPath: m_LocalRotation.y - value: -0 + value: 0 objectReference: {fileID: 0} - target: {fileID: 400000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} propertyPath: m_LocalRotation.z - value: -0 + value: 0 objectReference: {fileID: 0} - target: {fileID: 400000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} propertyPath: m_LocalRotation.w - value: 0.7071068 + value: 1 objectReference: {fileID: 0} - target: {fileID: 400000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} propertyPath: m_RootOrder - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 400000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} propertyPath: m_LocalScale.y - value: 3.4105535 + value: 1 objectReference: {fileID: 0} - target: {fileID: 400000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} propertyPath: m_LocalScale.z - value: 0.29320782 + value: 0.2932082 objectReference: {fileID: 0} - target: {fileID: 2300000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} propertyPath: m_Materials.Array.data[0] @@ -533,10 +547,60 @@ Prefab: propertyPath: m_ReceiveShadows value: 0 objectReference: {fileID: 0} + - target: {fileID: 100000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} + propertyPath: m_Name + value: Model + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: - {fileID: 9500000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} m_ParentPrefab: {fileID: 100100000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} m_IsPrefabParent: 0 +--- !u!1 &1410985306 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1410985307} + - component: {fileID: 1410985308} + m_Layer: 0 + m_Name: Ship + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1410985307 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1410985306} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1582243899} + m_Father: {fileID: 2004386719} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1410985308 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1410985306} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9b67576e7da945d4abe2e66b1d91a4a9, type: 3} + m_Name: + m_EditorClassIdentifier: + Speed: 0 --- !u!1 &1582243898 stripped GameObject: m_PrefabParentObject: {fileID: 100000, guid: eab6d2f90fc33a248a5e1eee31c76846, type: 3} @@ -603,7 +667,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 2 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!114 &1880731490 MonoBehaviour: @@ -634,7 +698,6 @@ GameObject: serializedVersion: 5 m_Component: - component: {fileID: 2004386719} - - component: {fileID: 2004386720} - component: {fileID: 2004386721} m_Layer: 0 m_Name: Player @@ -649,27 +712,14 @@ Transform: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 2004386718} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 0.2932077} + m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - - {fileID: 729518482} - - {fileID: 1582243899} + - {fileID: 1410985307} m_Father: {fileID: 0} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &2004386720 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 2004386718} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: aebc15e318f4c7748bb9d3b03976707f, type: 3} - m_Name: - m_EditorClassIdentifier: - Speed: 32 + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} --- !u!54 &2004386721 Rigidbody: m_ObjectHideFlags: 0 diff --git a/Assets/Movement.cs b/Assets/Movement.cs new file mode 100644 index 0000000..f1d7f2e --- /dev/null +++ b/Assets/Movement.cs @@ -0,0 +1,39 @@ +using UnityEngine; +using System.Collections; + +public class Movement : MonoBehaviour { + + public float Speed = 16; + public float TurnSpeed = 3f; + // Use this for initialization + void Start () { + + } + + // Update is called once per frame + void Update () { + transform.parent.position += transform.forward * Time.deltaTime * 4 * Speed; + transform.localRotation = Quaternion.Slerp(transform.localRotation, Quaternion.Euler(Vector3.zero), Time.deltaTime * 1.5f); + Debug.Log(transform.rotation.eulerAngles + " | " + transform.localRotation.eulerAngles); + if (Input.GetKey(KeyCode.W)) + { + transform.localRotation = Quaternion.Euler(transform.localRotation.eulerAngles + Vector3.right * Time.deltaTime * 64f * TurnSpeed); + } + + if (Input.GetKey(KeyCode.S)) + { + transform.localRotation = Quaternion.Euler(transform.localRotation.eulerAngles - Vector3.right * Time.deltaTime * 64f * TurnSpeed); + } + + if (Input.GetKey (KeyCode.A)) { + transform.localRotation = Quaternion.Euler(transform.localRotation.eulerAngles + Vector3.forward * Time.deltaTime * 64f * TurnSpeed); + transform.parent.Rotate(- Vector3.up * Time.deltaTime * 64f * TurnSpeed ); + } + + if (Input.GetKey (KeyCode.D)) { + transform.localRotation = Quaternion.Euler(transform.localRotation.eulerAngles - Vector3.forward * Time.deltaTime * 64f * TurnSpeed); + transform.parent.Rotate( Vector3.up * Time.deltaTime * 64f * TurnSpeed ); + + } + } +} diff --git a/Assets/Movement.cs.meta b/Assets/Movement.cs.meta new file mode 100644 index 0000000..1e022ac --- /dev/null +++ b/Assets/Movement.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 9b67576e7da945d4abe2e66b1d91a4a9 +timeCreated: 1510289027 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/project-skylines.userprefs b/project-skylines.userprefs index 96915a4..ad5d77a 100644 --- a/project-skylines.userprefs +++ b/project-skylines.userprefs @@ -2,8 +2,11 @@ - - + + + + +