refactor inputs into a playerController

add the possibility of changing destination of the camera transition
before it reaches its destination.
This commit is contained in:
jparent 2015-08-14 14:09:44 -04:00
parent 415d634162
commit df305682c8
14 changed files with 423 additions and 111 deletions

View File

@ -27,7 +27,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 143704} m_GameObject: {fileID: 143704}
m_LocalRotation: {x: .608761489, y: 0, z: 0, w: .793353319} 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_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
@ -89,11 +89,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ae1349c2c40a05449b456e20d48361aa, type: 3} m_Script: {fileID: 11500000, guid: ae1349c2c40a05449b456e20d48361aa, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
squads: y: 25
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
player: 0
transitionDuration: .100000001 transitionDuration: .100000001
--- !u!124 &12432070 --- !u!124 &12432070
Behaviour: Behaviour:

View File

@ -27,7 +27,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 127778} m_GameObject: {fileID: 127778}
m_LocalRotation: {x: .608761489, y: 0, z: 0, w: .793353319} 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_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
@ -89,11 +89,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ae1349c2c40a05449b456e20d48361aa, type: 3} m_Script: {fileID: 11500000, guid: ae1349c2c40a05449b456e20d48361aa, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
squads: y: 25
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
player: 1
transitionDuration: .100000001 transitionDuration: .100000001
--- !u!124 &12404998 --- !u!124 &12404998
Behaviour: Behaviour:

View File

@ -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

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 28fb290d540b4df45a389710264d0a8e
timeCreated: 1439575523
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2e61328c26d7dda4d8eb6ee2099bc806
timeCreated: 1439575527
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -165,10 +165,12 @@ Prefab:
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 8d6d640df84c10549b99d9ccf6b349d9, type: 2} m_ParentPrefab: {fileID: 100100000, guid: 8d6d640df84c10549b99d9ccf6b349d9, type: 2}
m_IsPrefabParent: 0 m_IsPrefabParent: 0
--- !u!1 &79076740 --- !u!114 &79076741
GameObject: MonoBehaviour:
m_PrefabParentObject: {fileID: 196328, guid: 8d6d640df84c10549b99d9ccf6b349d9, type: 2} m_PrefabParentObject: {fileID: 11458372, guid: 8d6d640df84c10549b99d9ccf6b349d9,
type: 2}
m_PrefabInternal: {fileID: 79076739} m_PrefabInternal: {fileID: 79076739}
m_Script: {fileID: 11500000, guid: 9346fd84c59bd7d42a27381aeed17dbf, type: 3}
--- !u!1001 &377386686 --- !u!1001 &377386686
Prefab: Prefab:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -182,7 +184,7 @@ Prefab:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 406792, guid: 0264002d3ec9fe844a6e5bd1d48ad2c6, type: 2} - target: {fileID: 406792, guid: 0264002d3ec9fe844a6e5bd1d48ad2c6, type: 2}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: 24.5100002 value: 25
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 406792, guid: 0264002d3ec9fe844a6e5bd1d48ad2c6, type: 2} - target: {fileID: 406792, guid: 0264002d3ec9fe844a6e5bd1d48ad2c6, type: 2}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
@ -208,25 +210,79 @@ Prefab:
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 7 value: 7
objectReference: {fileID: 0} 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_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 0264002d3ec9fe844a6e5bd1d48ad2c6, type: 2} m_ParentPrefab: {fileID: 100100000, guid: 0264002d3ec9fe844a6e5bd1d48ad2c6, type: 2}
m_IsPrefabParent: 0 m_IsPrefabParent: 0
--- !u!1 &694353572 --- !u!114 &588021787
GameObject: MonoBehaviour:
m_PrefabParentObject: {fileID: 196328, guid: 8d6d640df84c10549b99d9ccf6b349d9, type: 2} 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_PrefabInternal: {fileID: 1176908819}
m_Script: {fileID: 11500000, guid: 9346fd84c59bd7d42a27381aeed17dbf, type: 3}
--- !u!1 &844786940 --- !u!1 &844786940
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -300,10 +356,12 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 9 m_RootOrder: 9
--- !u!1 &1054614093 --- !u!114 &1054614094
GameObject: MonoBehaviour:
m_PrefabParentObject: {fileID: 159974, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} m_PrefabParentObject: {fileID: 11449880, guid: 55aad163f90cc4e40b686a69ba29569d,
type: 2}
m_PrefabInternal: {fileID: 1592215893} m_PrefabInternal: {fileID: 1592215893}
m_Script: {fileID: 11500000, guid: c1cd93867b8a1d7459a4fb92cac63854, type: 3}
--- !u!1001 &1104634410 --- !u!1001 &1104634410
Prefab: Prefab:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -382,10 +440,12 @@ Prefab:
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} m_ParentPrefab: {fileID: 100100000, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2}
m_IsPrefabParent: 0 m_IsPrefabParent: 0
--- !u!1 &1104634411 --- !u!114 &1104634412
GameObject: MonoBehaviour:
m_PrefabParentObject: {fileID: 159974, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} m_PrefabParentObject: {fileID: 11449880, guid: 55aad163f90cc4e40b686a69ba29569d,
type: 2}
m_PrefabInternal: {fileID: 1104634410} m_PrefabInternal: {fileID: 1104634410}
m_Script: {fileID: 11500000, guid: c1cd93867b8a1d7459a4fb92cac63854, type: 3}
--- !u!1001 &1176908819 --- !u!1001 &1176908819
Prefab: Prefab:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -477,15 +537,15 @@ Prefab:
m_Modifications: m_Modifications:
- target: {fileID: 433270, guid: fc4d7bcae8bff4b4b8fc370f9033112f, type: 2} - target: {fileID: 433270, guid: fc4d7bcae8bff4b4b8fc370f9033112f, type: 2}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: -19.1000004 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 433270, guid: fc4d7bcae8bff4b4b8fc370f9033112f, type: 2} - target: {fileID: 433270, guid: fc4d7bcae8bff4b4b8fc370f9033112f, type: 2}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: 24.5100002 value: 25
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 433270, guid: fc4d7bcae8bff4b4b8fc370f9033112f, type: 2} - target: {fileID: 433270, guid: fc4d7bcae8bff4b4b8fc370f9033112f, type: 2}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: 3.72999954 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 433270, guid: fc4d7bcae8bff4b4b8fc370f9033112f, type: 2} - target: {fileID: 433270, guid: fc4d7bcae8bff4b4b8fc370f9033112f, type: 2}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
@ -507,21 +567,73 @@ Prefab:
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 6 value: 6
objectReference: {fileID: 0} 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_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: fc4d7bcae8bff4b4b8fc370f9033112f, type: 2} m_ParentPrefab: {fileID: 100100000, guid: fc4d7bcae8bff4b4b8fc370f9033112f, type: 2}
m_IsPrefabParent: 0 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 --- !u!1001 &1592215893
Prefab: Prefab:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -660,14 +772,18 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 8 m_RootOrder: 8
--- !u!1 &1891186858 --- !u!114 &1891186859
GameObject: MonoBehaviour:
m_PrefabParentObject: {fileID: 159974, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2} m_PrefabParentObject: {fileID: 11449880, guid: 55aad163f90cc4e40b686a69ba29569d,
type: 2}
m_PrefabInternal: {fileID: 2086876520} m_PrefabInternal: {fileID: 2086876520}
--- !u!1 &2069028068 m_Script: {fileID: 11500000, guid: c1cd93867b8a1d7459a4fb92cac63854, type: 3}
GameObject: --- !u!114 &2069028069
m_PrefabParentObject: {fileID: 196328, guid: 8d6d640df84c10549b99d9ccf6b349d9, type: 2} MonoBehaviour:
m_PrefabParentObject: {fileID: 11458372, guid: 8d6d640df84c10549b99d9ccf6b349d9,
type: 2}
m_PrefabInternal: {fileID: 2108203658} m_PrefabInternal: {fileID: 2108203658}
m_Script: {fileID: 11500000, guid: 9346fd84c59bd7d42a27381aeed17dbf, type: 3}
--- !u!1001 &2086876520 --- !u!1001 &2086876520
Prefab: Prefab:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

15
Assets/Scripts/Player.cs Normal file
View File

@ -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 () {
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f4b18e96a6eb52a45aaba62707bfb43a
timeCreated: 1439566327
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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);
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ab440c57173b5b343b5201cc8f701ff2
timeCreated: 1439508999
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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);
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 742e02efdaddce54e8bda108068bbb89
timeCreated: 1439572844
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -3,72 +3,39 @@ using System.Collections;
public class SquadCamera : MonoBehaviour { public class SquadCamera : MonoBehaviour {
public GameObject[] squads; private Vector3 target;
private GameObject target; public float y = 25f; // store the height value since it will never change
public enum Player { Player1, Player2 };
public Player player;
private float y; // store the height value since it will never change
public float transitionDuration = 2.5f; public float transitionDuration = 2.5f;
// Use this for initialization // Use this for initialization
void Start () { void Start () {
this.target = squads[0]; target = Vector3.zero;
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;
} }
// Update is called once per frame // 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() { IEnumerator Transition() {
float t = 0.0f; float t = 0.0f;
Vector3 startingPos = transform.position; Vector3 startingPos = transform.position;
Vector3 destination = new Vector3( target.x, y, target.z );
Vector3 destination = new Vector3(
target.transform.position.x,
y,
target.transform.position.z
);
while (t < 1.0f) { while (t < 1.0f) {