Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

Commit

Permalink
Features & Fixes
Browse files Browse the repository at this point in the history
-control scale added to controlable components to define how much control you want
-look acceleration for controller input
-started using unity's input for control via the "Default Unity Input" asset
  • Loading branch information
Moe-Baker committed May 25, 2018
1 parent 79f65a2 commit 6d676ea
Show file tree
Hide file tree
Showing 23 changed files with 497 additions and 230 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -855,48 +855,6 @@ MeshFilter:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 600188507}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1001 &780193600
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4914259856089784, guid: 4d99e498a9b86c44aa25f55f4e09545d, type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4914259856089784, guid: 4d99e498a9b86c44aa25f55f4e09545d, type: 2}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4914259856089784, guid: 4d99e498a9b86c44aa25f55f4e09545d, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4914259856089784, guid: 4d99e498a9b86c44aa25f55f4e09545d, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4914259856089784, guid: 4d99e498a9b86c44aa25f55f4e09545d, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4914259856089784, guid: 4d99e498a9b86c44aa25f55f4e09545d, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4914259856089784, guid: 4d99e498a9b86c44aa25f55f4e09545d, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4914259856089784, guid: 4d99e498a9b86c44aa25f55f4e09545d, type: 2}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 4d99e498a9b86c44aa25f55f4e09545d, type: 2}
m_IsPrefabParent: 0
--- !u!1 &951043652
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -997,6 +955,48 @@ MeshFilter:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 951043652}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1001 &1389563945
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4914259856089784, guid: 4d99e498a9b86c44aa25f55f4e09545d, type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4914259856089784, guid: 4d99e498a9b86c44aa25f55f4e09545d, type: 2}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4914259856089784, guid: 4d99e498a9b86c44aa25f55f4e09545d, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4914259856089784, guid: 4d99e498a9b86c44aa25f55f4e09545d, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4914259856089784, guid: 4d99e498a9b86c44aa25f55f4e09545d, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4914259856089784, guid: 4d99e498a9b86c44aa25f55f4e09545d, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4914259856089784, guid: 4d99e498a9b86c44aa25f55f4e09545d, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4914259856089784, guid: 4d99e498a9b86c44aa25f55f4e09545d, type: 2}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 4d99e498a9b86c44aa25f55f4e09545d, type: 2}
m_IsPrefabParent: 0
--- !u!1 &1434588463
GameObject:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ Transform:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1373468343257610}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
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: []
Expand Down Expand Up @@ -603,7 +603,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 1e5bbe65c1c4f1245b214c9e85133f16, type: 3}
m_Name:
m_EditorClassIdentifier:
_control: 1
control:
toggle: 1
scale: 1
range: 40
speed: 200
cameraAlignment: 0.8
Expand Down Expand Up @@ -704,7 +706,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ef45407765e860a469677e502677bf0b, type: 3}
m_Name:
m_EditorClassIdentifier:
_control: 1
control:
toggle: 1
scale: 1
initMode: 2
inputModulator: {fileID: 11400000, guid: ab48c1fb00d62a2449ad987628bb2f8d, type: 2}
--- !u!114 &114273415733837618
Expand Down Expand Up @@ -795,7 +799,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: aee8c41a53965514fb38bc770289af44, type: 3}
m_Name:
m_EditorClassIdentifier:
defaultSet: {fileID: 11400000, guid: bf10040ba1024d947b3ce4ea62f6ea28, type: 2}
defaultSet: {fileID: 11400000, guid: aa1e280b129ddad4fbea0658f2faca70, type: 2}
--- !u!114 &114448856149604938
MonoBehaviour:
m_ObjectHideFlags: 1
Expand All @@ -808,8 +812,10 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
updateDirection: 1
acceleration: 5
deAcceleration: 2
processStateTransitions: 1
acceleration: 15
deAcceleration: 15
speedScale: 0.025
--- !u!114 &114465494978858076
MonoBehaviour:
m_ObjectHideFlags: 1
Expand Down Expand Up @@ -841,6 +847,8 @@ MonoBehaviour:
radiusScale: 0.5
range: 0.1
offset: 0.1
maxSlope: 45
slope: 0
--- !u!114 &114492301586249222
MonoBehaviour:
m_ObjectHideFlags: 1
Expand All @@ -853,7 +861,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_control: 1
minInput: 0.75
minimumInput: 0.75
input: 1
--- !u!114 &114519772722735782
MonoBehaviour:
Expand Down Expand Up @@ -990,7 +998,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c45f517be2dda2e4f9a26c783e2e78c4, type: 3}
m_Name:
m_EditorClassIdentifier:
speed: 360
speed: 160
range: 40
--- !u!114 &114746096415833728
MonoBehaviour:
m_ObjectHideFlags: 1
Expand All @@ -1002,7 +1011,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 1544560d62695fa45867ea00723d061d, type: 3}
m_Name:
m_EditorClassIdentifier:
_control: 1
control:
toggle: 1
scale: 1
sensitivity:
vertical: 4
horizontal: 4
Expand All @@ -1028,7 +1039,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 82f57974fdf97b4499b3f3de6d637966, type: 3}
m_Name:
m_EditorClassIdentifier:
_control: 1
control:
toggle: 1
scale: 1
--- !u!114 &114851912328710026
MonoBehaviour:
m_ObjectHideFlags: 1
Expand Down
73 changes: 61 additions & 12 deletions Assets/Moe Baker/Advanced First Person Controller/FPController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,8 @@ public abstract partial class FPControllerBase : MonoBehaviour


[SerializeField]
protected bool _control = true;
public virtual bool Control
{
get
{
return _control;
}
set
{
_control = value;
}
}
protected ControlConstraint control;
public ControlConstraint Control { get { return control; } }


[SerializeField]
Expand Down Expand Up @@ -223,6 +213,65 @@ public abstract partial class Module : ModuleBase
}
}

[Serializable]
public class ControlConstraint
{
[SerializeField]
protected bool toggle = true;
public bool _Toggle
{
get
{
return toggle && (HasContext ? Context.toggle : true);
}
set
{
toggle = value;
}
}
public virtual bool AbsoluteToggle
{
get
{
if (_Scale == 0f) return false;

return _Toggle;
}
}

[SerializeField]
[Range(0f, 1f)]
protected float scale = 1f;
public float _Scale
{
get
{
return scale * (HasContext ? Context.scale : 1f);
}
set
{
scale = Mathf.Clamp01(value);
}
}
public virtual float AbsoluteScale
{
get
{
if (_Toggle == false) return 0f;

return _Scale;
}
}

public ControlConstraint Context { get; protected set; }
public virtual bool HasContext { get { return Context != null; } }

public virtual void SetContext(ControlConstraint context)
{
this.Context = context;
}
}

public enum InitMode
{
None, Awake, Start
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
platforms:
- name: PC
module: {fileID: 11400000, guid: 5f07633801d579a49ad540e9411701be, type: 2}
module: {fileID: 11400000, guid: f0215d58daeb6c245978ef9765070d84, type: 2}
supportedPlatforms: 07000000020000000000000001000000100000000d000000
- name: Mobile
module: {fileID: 0}
Expand Down
Loading

0 comments on commit 6d676ea

Please sign in to comment.