This commit is contained in:
Patrice Vignola 2015-08-23 11:25:22 -04:00
commit 50df0f82c8
4 changed files with 25 additions and 9 deletions

View File

@ -17,9 +17,6 @@ MonoBehaviour:
- name: Jump - name: Jump
XboxButtons: 00000000 XboxButtons: 00000000
KeyboardKeys: KeyboardKeys:
- name: Throw
XboxButtons: 01000000
KeyboardKeys:
- name: Sleep - name: Sleep
XboxButtons: 02000000 XboxButtons: 02000000
KeyboardKeys: KeyboardKeys:
@ -48,6 +45,9 @@ MonoBehaviour:
- name: LookBackward - name: LookBackward
Axis: 07000000 Axis: 07000000
KeyboardKeys: KeyboardKeys:
- name: Throw
Axis: 09000000
KeyboardKeys:
ButtonStates: [] ButtonStates: []
- name: Sleeping - name: Sleeping
ButtonActions: ButtonActions:

View File

@ -153,7 +153,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 567fe96dcacb08f4ab716a98ce99fc88, type: 3} m_Script: {fileID: 11500000, guid: 567fe96dcacb08f4ab716a98ce99fc88, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
minAngleRange: 60 minAngleRange: 10
--- !u!135 &13545904 --- !u!135 &13545904
SphereCollider: SphereCollider:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -214,6 +214,10 @@ Prefab:
propertyPath: Speed propertyPath: Speed
value: 2 value: 2
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 0}
propertyPath: minAngleRange
value: 10
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 0} m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 190616} m_RootGameObject: {fileID: 190616}

View File

@ -5,7 +5,7 @@ using System.Collections.Generic;
public class AutoTarget : MonoBehaviour public class AutoTarget : MonoBehaviour
{ {
private List<Transform> targets; private List<Transform> targets;
public float minAngleRange = 60f; public float minAngleRange = 20f;
// Use this for initialization // Use this for initialization
void Start () void Start ()

View File

@ -88,6 +88,22 @@ public class ChildController : MonoBehaviour
Mathf.Atan2(xLookingValue, zLookingValue) * Mathf.Rad2Deg -90, // -90 to correct forward facing angle... Mathf.Atan2(xLookingValue, zLookingValue) * Mathf.Rad2Deg -90, // -90 to correct forward facing angle...
transform.eulerAngles.z); transform.eulerAngles.z);
} }
}
else {
_child.target = null; // no auto targeting when not actively pressing the joystick in a direction
// if player is not look with the right joystick, then face the direction we're going
// if left joystick is used, else we don't change the facing direction
if (xValue != 0 || zValue!= 0) {
transform.eulerAngles = new Vector3(
transform.eulerAngles.x,
Mathf.Atan2(xValue, zValue) * Mathf.Rad2Deg - 90,
transform.eulerAngles.z);
}
}
if (input.Ranges.ContainsKey("Throw")) {
_child.Throw();
} }
} }
@ -111,10 +127,6 @@ public class ChildController : MonoBehaviour
_child.WakeUp(); _child.WakeUp();
InputManager.Instance.PushActiveContext("Awake", (int)PlayerNumber); InputManager.Instance.PushActiveContext("Awake", (int)PlayerNumber);
} }
if (input.Actions.Contains("Throw")) {
_child.Throw();
}
} }
} }