diff --git a/Assets/Prefabs/Camera1.prefab b/Assets/Prefabs/Camera1.prefab index 59d7a06..a410fb4 100644 --- a/Assets/Prefabs/Camera1.prefab +++ b/Assets/Prefabs/Camera1.prefab @@ -27,7 +27,7 @@ Transform: m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 143704} m_LocalRotation: {x: .608761489, y: 0, z: 0, w: .793353319} - m_LocalPosition: {x: 0, y: 24.5100002, z: 0} + m_LocalPosition: {x: 0, y: 25, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} @@ -89,11 +89,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: ae1349c2c40a05449b456e20d48361aa, type: 3} m_Name: m_EditorClassIdentifier: - squads: - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - player: 0 + y: 25 transitionDuration: .100000001 --- !u!124 &12432070 Behaviour: diff --git a/Assets/Prefabs/Camera2.prefab b/Assets/Prefabs/Camera2.prefab index b0b44d9..ee958ec 100644 --- a/Assets/Prefabs/Camera2.prefab +++ b/Assets/Prefabs/Camera2.prefab @@ -27,7 +27,7 @@ Transform: m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 127778} m_LocalRotation: {x: .608761489, y: 0, z: 0, w: .793353319} - m_LocalPosition: {x: 0, y: 24.5100002, z: 0} + m_LocalPosition: {x: 0, y: 25, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} @@ -89,11 +89,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: ae1349c2c40a05449b456e20d48361aa, type: 3} m_Name: m_EditorClassIdentifier: - squads: - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - player: 1 + y: 25 transitionDuration: .100000001 --- !u!124 &12404998 Behaviour: diff --git a/Assets/Prefabs/Player1.prefab b/Assets/Prefabs/Player1.prefab new file mode 100644 index 0000000..f430481 --- /dev/null +++ b/Assets/Prefabs/Player1.prefab @@ -0,0 +1,57 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &126110 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 464164} + - 114: {fileID: 11428944} + m_Layer: 0 + m_Name: Player1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &464164 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 126110} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1000, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!114 &11428944 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 126110} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ab440c57173b5b343b5201cc8f701ff2, type: 3} + m_Name: + m_EditorClassIdentifier: + squadCamera: {fileID: 0} + squads: + - {fileID: 0} + - {fileID: 0} + - {fileID: 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: 126110} + m_IsPrefabParent: 1 diff --git a/Assets/Prefabs/Player1.prefab.meta b/Assets/Prefabs/Player1.prefab.meta new file mode 100644 index 0000000..96fbd35 --- /dev/null +++ b/Assets/Prefabs/Player1.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 28fb290d540b4df45a389710264d0a8e +timeCreated: 1439575523 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Player2.prefab b/Assets/Prefabs/Player2.prefab new file mode 100644 index 0000000..90eae82 --- /dev/null +++ b/Assets/Prefabs/Player2.prefab @@ -0,0 +1,57 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &101062 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 455296} + - 114: {fileID: 11486914} + m_Layer: 0 + m_Name: Player2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &455296 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 101062} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1000, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!114 &11486914 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 101062} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 742e02efdaddce54e8bda108068bbb89, type: 3} + m_Name: + m_EditorClassIdentifier: + squadCamera: {fileID: 0} + squads: + - {fileID: 0} + - {fileID: 0} + - {fileID: 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: 101062} + m_IsPrefabParent: 1 diff --git a/Assets/Prefabs/Player2.prefab.meta b/Assets/Prefabs/Player2.prefab.meta new file mode 100644 index 0000000..d28b08a --- /dev/null +++ b/Assets/Prefabs/Player2.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2e61328c26d7dda4d8eb6ee2099bc806 +timeCreated: 1439575527 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/jp.unity b/Assets/Scenes/jp.unity index 7b47106..8666903 100644 --- a/Assets/Scenes/jp.unity +++ b/Assets/Scenes/jp.unity @@ -165,10 +165,12 @@ Prefab: m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: 8d6d640df84c10549b99d9ccf6b349d9, type: 2} m_IsPrefabParent: 0 ---- !u!1 &79076740 -GameObject: - m_PrefabParentObject: {fileID: 196328, guid: 8d6d640df84c10549b99d9ccf6b349d9, type: 2} +--- !u!114 &79076741 +MonoBehaviour: + m_PrefabParentObject: {fileID: 11458372, guid: 8d6d640df84c10549b99d9ccf6b349d9, + type: 2} m_PrefabInternal: {fileID: 79076739} + m_Script: {fileID: 11500000, guid: 9346fd84c59bd7d42a27381aeed17dbf, type: 3} --- !u!1001 &377386686 Prefab: m_ObjectHideFlags: 0 @@ -182,7 +184,7 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 406792, guid: 0264002d3ec9fe844a6e5bd1d48ad2c6, type: 2} propertyPath: m_LocalPosition.y - value: 24.5100002 + value: 25 objectReference: {fileID: 0} - target: {fileID: 406792, guid: 0264002d3ec9fe844a6e5bd1d48ad2c6, type: 2} propertyPath: m_LocalPosition.z @@ -208,25 +210,79 @@ Prefab: propertyPath: m_RootOrder value: 7 objectReference: {fileID: 0} - - target: {fileID: 11405364, guid: 0264002d3ec9fe844a6e5bd1d48ad2c6, type: 2} - propertyPath: squads.Array.data[0] - value: - objectReference: {fileID: 79076740} - - target: {fileID: 11405364, guid: 0264002d3ec9fe844a6e5bd1d48ad2c6, type: 2} - propertyPath: squads.Array.data[1] - value: - objectReference: {fileID: 694353572} - - target: {fileID: 11405364, guid: 0264002d3ec9fe844a6e5bd1d48ad2c6, type: 2} - propertyPath: squads.Array.data[2] - value: - objectReference: {fileID: 2069028068} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: 0264002d3ec9fe844a6e5bd1d48ad2c6, type: 2} m_IsPrefabParent: 0 ---- !u!1 &694353572 -GameObject: - m_PrefabParentObject: {fileID: 196328, guid: 8d6d640df84c10549b99d9ccf6b349d9, type: 2} +--- !u!114 &588021787 +MonoBehaviour: + m_PrefabParentObject: {fileID: 11404586, guid: fc4d7bcae8bff4b4b8fc370f9033112f, + type: 2} + m_PrefabInternal: {fileID: 1421464866} + m_Script: {fileID: 11500000, guid: ae1349c2c40a05449b456e20d48361aa, type: 3} +--- !u!1001 &658517498 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 455296, guid: 2e61328c26d7dda4d8eb6ee2099bc806, type: 2} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 455296, guid: 2e61328c26d7dda4d8eb6ee2099bc806, type: 2} + propertyPath: m_LocalPosition.y + value: 1000 + objectReference: {fileID: 0} + - target: {fileID: 455296, guid: 2e61328c26d7dda4d8eb6ee2099bc806, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 455296, guid: 2e61328c26d7dda4d8eb6ee2099bc806, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 455296, guid: 2e61328c26d7dda4d8eb6ee2099bc806, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 455296, guid: 2e61328c26d7dda4d8eb6ee2099bc806, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 455296, guid: 2e61328c26d7dda4d8eb6ee2099bc806, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 455296, guid: 2e61328c26d7dda4d8eb6ee2099bc806, type: 2} + propertyPath: m_RootOrder + value: 11 + objectReference: {fileID: 0} + - target: {fileID: 11486914, guid: 2e61328c26d7dda4d8eb6ee2099bc806, type: 2} + propertyPath: squadCamera + value: + objectReference: {fileID: 1558258210} + - target: {fileID: 11486914, guid: 2e61328c26d7dda4d8eb6ee2099bc806, type: 2} + propertyPath: squads.Array.data[0] + value: + objectReference: {fileID: 79076741} + - target: {fileID: 11486914, guid: 2e61328c26d7dda4d8eb6ee2099bc806, type: 2} + propertyPath: squads.Array.data[1] + value: + objectReference: {fileID: 694353573} + - target: {fileID: 11486914, guid: 2e61328c26d7dda4d8eb6ee2099bc806, type: 2} + propertyPath: squads.Array.data[2] + value: + objectReference: {fileID: 2069028069} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 2e61328c26d7dda4d8eb6ee2099bc806, type: 2} + m_IsPrefabParent: 0 +--- !u!114 &694353573 +MonoBehaviour: + m_PrefabParentObject: {fileID: 11458372, guid: 8d6d640df84c10549b99d9ccf6b349d9, + type: 2} m_PrefabInternal: {fileID: 1176908819} + m_Script: {fileID: 11500000, guid: 9346fd84c59bd7d42a27381aeed17dbf, type: 3} --- !u!1 &844786940 GameObject: m_ObjectHideFlags: 0 @@ -300,10 +356,12 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_RootOrder: 9 ---- !u!1 &1054614093 -GameObject: - m_PrefabParentObject: {fileID: 159974, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} +--- !u!114 &1054614094 +MonoBehaviour: + m_PrefabParentObject: {fileID: 11449880, guid: 55aad163f90cc4e40b686a69ba29569d, + type: 2} m_PrefabInternal: {fileID: 1592215893} + m_Script: {fileID: 11500000, guid: c1cd93867b8a1d7459a4fb92cac63854, type: 3} --- !u!1001 &1104634410 Prefab: m_ObjectHideFlags: 0 @@ -382,10 +440,12 @@ Prefab: m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} m_IsPrefabParent: 0 ---- !u!1 &1104634411 -GameObject: - m_PrefabParentObject: {fileID: 159974, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} +--- !u!114 &1104634412 +MonoBehaviour: + m_PrefabParentObject: {fileID: 11449880, guid: 55aad163f90cc4e40b686a69ba29569d, + type: 2} m_PrefabInternal: {fileID: 1104634410} + m_Script: {fileID: 11500000, guid: c1cd93867b8a1d7459a4fb92cac63854, type: 3} --- !u!1001 &1176908819 Prefab: m_ObjectHideFlags: 0 @@ -477,15 +537,15 @@ Prefab: m_Modifications: - target: {fileID: 433270, guid: fc4d7bcae8bff4b4b8fc370f9033112f, type: 2} propertyPath: m_LocalPosition.x - value: -19.1000004 + value: 0 objectReference: {fileID: 0} - target: {fileID: 433270, guid: fc4d7bcae8bff4b4b8fc370f9033112f, type: 2} propertyPath: m_LocalPosition.y - value: 24.5100002 + value: 25 objectReference: {fileID: 0} - target: {fileID: 433270, guid: fc4d7bcae8bff4b4b8fc370f9033112f, type: 2} propertyPath: m_LocalPosition.z - value: 3.72999954 + value: 0 objectReference: {fileID: 0} - target: {fileID: 433270, guid: fc4d7bcae8bff4b4b8fc370f9033112f, type: 2} propertyPath: m_LocalRotation.x @@ -507,21 +567,73 @@ Prefab: propertyPath: m_RootOrder value: 6 objectReference: {fileID: 0} - - target: {fileID: 11404586, guid: fc4d7bcae8bff4b4b8fc370f9033112f, type: 2} - propertyPath: squads.Array.data[0] - value: - objectReference: {fileID: 1104634411} - - target: {fileID: 11404586, guid: fc4d7bcae8bff4b4b8fc370f9033112f, type: 2} - propertyPath: squads.Array.data[1] - value: - objectReference: {fileID: 1891186858} - - target: {fileID: 11404586, guid: fc4d7bcae8bff4b4b8fc370f9033112f, type: 2} - propertyPath: squads.Array.data[2] - value: - objectReference: {fileID: 1054614093} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: fc4d7bcae8bff4b4b8fc370f9033112f, type: 2} m_IsPrefabParent: 0 +--- !u!1001 &1496713475 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 464164, guid: 28fb290d540b4df45a389710264d0a8e, type: 2} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 464164, guid: 28fb290d540b4df45a389710264d0a8e, type: 2} + propertyPath: m_LocalPosition.y + value: 1000 + objectReference: {fileID: 0} + - target: {fileID: 464164, guid: 28fb290d540b4df45a389710264d0a8e, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 464164, guid: 28fb290d540b4df45a389710264d0a8e, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 464164, guid: 28fb290d540b4df45a389710264d0a8e, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 464164, guid: 28fb290d540b4df45a389710264d0a8e, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 464164, guid: 28fb290d540b4df45a389710264d0a8e, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 464164, guid: 28fb290d540b4df45a389710264d0a8e, type: 2} + propertyPath: m_RootOrder + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 11428944, guid: 28fb290d540b4df45a389710264d0a8e, type: 2} + propertyPath: squadCamera + value: + objectReference: {fileID: 588021787} + - target: {fileID: 11428944, guid: 28fb290d540b4df45a389710264d0a8e, type: 2} + propertyPath: squads.Array.data[0] + value: + objectReference: {fileID: 1104634412} + - target: {fileID: 11428944, guid: 28fb290d540b4df45a389710264d0a8e, type: 2} + propertyPath: squads.Array.data[1] + value: + objectReference: {fileID: 1891186859} + - target: {fileID: 11428944, guid: 28fb290d540b4df45a389710264d0a8e, type: 2} + propertyPath: squads.Array.data[2] + value: + objectReference: {fileID: 1054614094} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 28fb290d540b4df45a389710264d0a8e, type: 2} + m_IsPrefabParent: 0 +--- !u!114 &1558258210 +MonoBehaviour: + m_PrefabParentObject: {fileID: 11405364, guid: 0264002d3ec9fe844a6e5bd1d48ad2c6, + type: 2} + m_PrefabInternal: {fileID: 377386686} + m_Script: {fileID: 11500000, guid: ae1349c2c40a05449b456e20d48361aa, type: 3} --- !u!1001 &1592215893 Prefab: m_ObjectHideFlags: 0 @@ -660,14 +772,18 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_RootOrder: 8 ---- !u!1 &1891186858 -GameObject: - m_PrefabParentObject: {fileID: 159974, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} +--- !u!114 &1891186859 +MonoBehaviour: + m_PrefabParentObject: {fileID: 11449880, guid: 55aad163f90cc4e40b686a69ba29569d, + type: 2} m_PrefabInternal: {fileID: 2086876520} ---- !u!1 &2069028068 -GameObject: - m_PrefabParentObject: {fileID: 196328, guid: 8d6d640df84c10549b99d9ccf6b349d9, type: 2} + m_Script: {fileID: 11500000, guid: c1cd93867b8a1d7459a4fb92cac63854, type: 3} +--- !u!114 &2069028069 +MonoBehaviour: + m_PrefabParentObject: {fileID: 11458372, guid: 8d6d640df84c10549b99d9ccf6b349d9, + type: 2} m_PrefabInternal: {fileID: 2108203658} + m_Script: {fileID: 11500000, guid: 9346fd84c59bd7d42a27381aeed17dbf, type: 3} --- !u!1001 &2086876520 Prefab: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Player.cs b/Assets/Scripts/Player.cs new file mode 100644 index 0000000..39f9dce --- /dev/null +++ b/Assets/Scripts/Player.cs @@ -0,0 +1,15 @@ +using UnityEngine; +using System.Collections; + +public class Player : MonoBehaviour { + + // Use this for initialization + void Start () { + + } + + // Update is called once per frame + void Update () { + + } +} diff --git a/Assets/Scripts/Player.cs.meta b/Assets/Scripts/Player.cs.meta new file mode 100644 index 0000000..f96e289 --- /dev/null +++ b/Assets/Scripts/Player.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f4b18e96a6eb52a45aaba62707bfb43a +timeCreated: 1439566327 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Player1Controller.cs b/Assets/Scripts/Player1Controller.cs new file mode 100644 index 0000000..68ad251 --- /dev/null +++ b/Assets/Scripts/Player1Controller.cs @@ -0,0 +1,29 @@ +using UnityEngine; +using System.Collections; + +public class Player1Controller : MonoBehaviour { + + public SquadCamera squadCamera; + public Squad[] squads; + + // Use this for initialization + void Start () { + squadCamera.SetTarget(squads[0].gameObject.transform.position); + } + + // Update is called once per frame + void Update () { + + if (Input.GetAxisRaw("Opt1-1") == 1f) { + squadCamera.SetTarget(squads[0].gameObject.transform.position); + } + else if (Input.GetAxisRaw("Opt2-1") == 1f) { + squadCamera.SetTarget(squads[1].gameObject.transform.position); + } + else if (Input.GetAxisRaw("Opt3-1") == 1f) { + squadCamera.SetTarget(squads[2].gameObject.transform.position); + } + + + } +} diff --git a/Assets/Scripts/Player1Controller.cs.meta b/Assets/Scripts/Player1Controller.cs.meta new file mode 100644 index 0000000..cfd9045 --- /dev/null +++ b/Assets/Scripts/Player1Controller.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ab440c57173b5b343b5201cc8f701ff2 +timeCreated: 1439508999 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Player2Controller.cs b/Assets/Scripts/Player2Controller.cs new file mode 100644 index 0000000..1b3321a --- /dev/null +++ b/Assets/Scripts/Player2Controller.cs @@ -0,0 +1,27 @@ +using UnityEngine; +using System.Collections; + +public class Player2Controller : MonoBehaviour { + + public SquadCamera squadCamera; + public Squad[] squads; + + // Use this for initialization + void Start () { + squadCamera.SetTarget(squads[0].gameObject.transform.position); + } + + // Update is called once per frame + void Update () { + + if (Input.GetAxisRaw("Opt1-2") == 1f) { + squadCamera.SetTarget(squads[0].gameObject.transform.position); + } + else if (Input.GetAxisRaw("Opt2-2") == 1f) { + squadCamera.SetTarget(squads[1].gameObject.transform.position); + } + else if (Input.GetAxisRaw("Opt3-2") == 1f) { + squadCamera.SetTarget(squads[2].gameObject.transform.position); + } + } +} diff --git a/Assets/Scripts/Player2Controller.cs.meta b/Assets/Scripts/Player2Controller.cs.meta new file mode 100644 index 0000000..36b9747 --- /dev/null +++ b/Assets/Scripts/Player2Controller.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 742e02efdaddce54e8bda108068bbb89 +timeCreated: 1439572844 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SquadCamera.cs b/Assets/Scripts/SquadCamera.cs index fafd318..b4c535b 100644 --- a/Assets/Scripts/SquadCamera.cs +++ b/Assets/Scripts/SquadCamera.cs @@ -3,72 +3,39 @@ using System.Collections; public class SquadCamera : MonoBehaviour { - public GameObject[] squads; - private GameObject target; - public enum Player { Player1, Player2 }; - public Player player; - - private float y; // store the height value since it will never change - - + private Vector3 target; + public float y = 25f; // store the height value since it will never change + public float transitionDuration = 2.5f; - // Use this for initialization void Start () { - this.target = squads[0]; - - this.transform.position= new Vector3( - target.gameObject.transform.position.x, - this.transform.position.y, - target.gameObject.transform.position.z); - - this.y = this.transform.position.y; - + target = Vector3.zero; } // Update is called once per frame - void Update () { + void Update () { - Vector3 previousTarget = target.transform.position; - - - if(Input.GetAxisRaw("Opt1-1") == 1f){ - target = squads[0]; - } - else if (Input.GetAxisRaw("Opt2-1") == 1f) { - - target = squads[1]; - } - else if (Input.GetAxisRaw("Opt3-1") == 1f) { - target = squads[2]; - } - - - if (!previousTarget.Equals(target.transform.position)) { - - - StartCoroutine(Transition()); - - } - - - - } + public void SetTarget(Vector3 newTarget) { + Vector3 previousTarget = target; + + if (!previousTarget.Equals(newTarget)) { + + target = newTarget; + StopCoroutine("Transition"); + StartCoroutine("Transition"); + } + } + IEnumerator Transition() { - float t = 0.0f; - - Vector3 startingPos = transform.position; - - Vector3 destination = new Vector3( - target.transform.position.x, - y, - target.transform.position.z - ); + + float t = 0.0f; + Vector3 startingPos = transform.position; + Vector3 destination = new Vector3( target.x, y, target.z ); while (t < 1.0f) { diff --git a/ProjectSettings/InputManager.asset b/ProjectSettings/InputManager.asset index 742b084..6f664de 100644 --- a/ProjectSettings/InputManager.asset +++ b/ProjectSettings/InputManager.asset @@ -154,7 +154,7 @@ InputManager: descriptiveName: descriptiveNegativeName: negativeButton: - positiveButton: 3 + positiveButton: 9 altNegativeButton: altPositiveButton: gravity: 1000