Commit e5fe8e08 authored by Soraphis's avatar Soraphis
Browse files

smaller fixes

touch input
cleanups
parent 0dbdf554
fileFormatVersion: 2
guid: 4c8d1db166a43564e94df8a347a022ac
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 6
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 2dbcc8b35f6c1ec40a7bd01978d9076e
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
......@@ -26,7 +26,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 40b924e2dad56384a8df2a1e111bb675, type: 3}
m_Name: Vignette
m_EditorClassIdentifier:
active: 1
active: 0
enabled:
overrideState: 1
value: 1
......@@ -69,7 +69,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 48a79b01ea5641d4aa6daa2e23605641, type: 3}
m_Name: Bloom
m_EditorClassIdentifier:
active: 1
active: 0
enabled:
overrideState: 1
value: 1
......
......@@ -9,7 +9,7 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8c2fa31169218b543acfac6ff6ce0c2b, type: 3}
m_Name: Player
m_Name: KeyCodeInput
m_EditorClassIdentifier:
jump: 32
peek: 304
......
......@@ -4636,7 +4636,8 @@ MonoBehaviour:
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_text: "Programming:\n\tMarkus Schl\xF6sser\n\tJan Meissner\n\tMarcel K\xFChn\n\nLevel
Design:\n\tChristopher Benes\n\nArt:\n\tSvenja Pitzius"
Design:\n\tChristopher Benes\n\nArt:\n\tSvenja Pitzius\n\nORGA:\n\tManuel Bu\xDF,
Oliver Biwer"
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 2f03fe920acbab545b9bf0ab1e298973, type: 2}
m_sharedMaterial: {fileID: 21897336073169014, guid: 2f03fe920acbab545b9bf0ab1e298973,
......@@ -4679,7 +4680,7 @@ MonoBehaviour:
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_enableWordWrapping: 0
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_firstOverflowCharacterIndex: -1
......@@ -4705,12 +4706,12 @@ MonoBehaviour:
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_textInfo:
textComponent: {fileID: 2103006732}
characterCount: 113
characterCount: 146
spriteCount: 0
spaceCount: 20
wordCount: 14
spaceCount: 27
wordCount: 19
linkCount: 0
lineCount: 10
lineCount: 13
pageCount: 1
materialCount: 2
m_havePropertiesChanged: 0
......
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 83cc98bba1964f969be186525c976885, type: 3}
m_Name: MouseInput
m_EditorClassIdentifier:
fileFormatVersion: 2
guid: b889fc3a95f4efc438d35503ac30a564
DefaultImporter:
guid: f874d95b43de92b40b150e1136fac517
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9709528fa3bb4a14a5a35b7955d54a5e, type: 3}
m_Name: TouchInput
m_EditorClassIdentifier:
fileFormatVersion: 2
guid: cf3cd70fe6ad96444a2806dadb1d23d2
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
......@@ -6,4 +6,4 @@ public abstract class InputProvider : ScriptableObject {
public abstract bool JumpPressed { get; }
public abstract bool PeekingPressed { get; }
public abstract bool InteractionPressed { get; }
}
}
\ No newline at end of file
using UnityEngine;
[CreateAssetMenu]
class MouseInputProvider : InputProvider {
private PlayerActor player;
public override Vector2 MoveDirection {
get {
var vp = (Vector2) Camera.main.ScreenToViewportPoint(Input.mousePosition);
vp = (vp - Vector2.one * 0.5f) * 2;
if (player == null) player = GameObject.FindObjectOfType<PlayerActor>();
if (player.Orientation == Orientation.Down || player.Orientation == Orientation.Up)
vp.y = 0;
else {
vp.x = vp.y;
vp.y = 0;
}
if (player.Orientation == Orientation.Down) vp.x *= -1;
if (player.Orientation == Orientation.Right) vp.x *= -1;
if(vp.magnitude < 0.3f) return Vector2.zero;
return vp;
}
}
public override bool JumpPressed {
get { return Input.GetMouseButtonDown(0); }
}
public override bool PeekingPressed => false;
public override bool InteractionPressed {
get {
var vp = (Vector2) Camera.main.ScreenToViewportPoint(Input.mousePosition);
vp = (vp - Vector2.one * 0.5f) * 2;
return Input.GetMouseButtonDown(0) && vp.magnitude < 0.3f;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 83cc98bba1964f969be186525c976885
timeCreated: 1538309755
\ No newline at end of file
......@@ -419,6 +419,11 @@ public class PlayerActor : MonoBehaviour, IResetable {
}
}
public void OnGUI() {
GUI.color = Color.red;
GUI.Label(new Rect(10, 10, 100, 30), inputProvider.MoveDirection.ToString());
}
public void LevelEnd() {
animator.Play("LevelEnd");
enabled = false;
......
using UnityEngine;
[CreateAssetMenu]
class TouchInputProvider : InputProvider {
private PlayerActor player;
public override Vector2 MoveDirection {
get {
if (Input.touchCount < 1) return Vector2.zero;
var vp = (Vector2) Camera.main.ScreenToViewportPoint(Input.GetTouch(0).position);
vp = (vp - Vector2.one * 0.5f) * 2;
if (player == null) player = GameObject.FindObjectOfType<PlayerActor>();
if (player.Orientation == Orientation.Down || player.Orientation == Orientation.Up)
vp.y = 0;
else {
vp.x = vp.y;
vp.y = 0;
}
if (player.Orientation == Orientation.Down) vp.x *= -1;
if (player.Orientation == Orientation.Right) vp.x *= -1;
if(vp.magnitude < 0.3f) return Vector2.zero;
return vp;
}
}
public override bool JumpPressed {
get {
return Input.touchCount > 1;
}
}
public override bool PeekingPressed => false;
public override bool InteractionPressed {
get {
if (Input.touchCount < 1) return false;
var vp = (Vector2) Camera.main.ScreenToViewportPoint(Input.GetTouch(0).position);
vp = (vp - Vector2.one * 0.5f) * 2;
return vp.magnitude < 0.3f;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 9709528fa3bb4a14a5a35b7955d54a5e
timeCreated: 1538303217
\ No newline at end of file
This diff is collapsed.
......@@ -32,40 +32,40 @@ EditorBuildSettings:
- enabled: 1
path: Assets/_Game/Scenes/Levels/Level08.unity
guid: 7efe599e3ba0e3847a1a72ba64d52964
- enabled: 1
- enabled: 0
path: Assets/_Game/Scenes/Levels/Level09.unity
guid: 54a2da4869f066146ac7e96c1d928268
- enabled: 1
- enabled: 0
path: Assets/_Game/Scenes/Levels/Level10.unity
guid: ae1f42e26f8e8284cbd29de81db8c512
- enabled: 1
- enabled: 0
path: Assets/_Game/Scenes/Levels/Level11.unity
guid: d8b67caee1215a74eb82cfb0df143577
- enabled: 1
- enabled: 0
path: Assets/_Game/Scenes/Levels/Level12.unity
guid: 654f9df6a8a66144e887e501198aa8ff
- enabled: 1
- enabled: 0
path: Assets/_Game/Scenes/Levels/Level13.unity
guid: 2713412f4cbbd3e4bb6b5f521d834c70
- enabled: 1
- enabled: 0
path: Assets/_Game/Scenes/Levels/Level14.unity
guid: 363a002c4d08c25409341d2a7fed4de1
- enabled: 1
- enabled: 0
path: Assets/_Game/Scenes/Levels/Level15.unity
guid: 9371fda64737d4442b4097fec4a95911
- enabled: 1
- enabled: 0
path: Assets/_Game/Scenes/Levels/Level16.unity
guid: df3d924b524ca944aa4f8fe3514771dc
- enabled: 1
- enabled: 0
path: Assets/_Game/Scenes/Levels/Level17.unity
guid: b2af79685c49a3748b2bb639938870af
- enabled: 1
- enabled: 0
path: Assets/_Game/Scenes/Levels/Level18.unity
guid: 3c7a56ee5bd943a42b9c70590232895f
- enabled: 1
- enabled: 0
path: Assets/_Game/Scenes/Levels/Level19.unity
guid: e64b69dc749e479428ab0b1579c6547a
- enabled: 1
- enabled: 0
path: Assets/_Game/Scenes/Levels/Level20.unity
guid: 081c189e0d3e45548ab3cf652e10f027
m_configObjects: {}
......@@ -7,7 +7,7 @@ EditorSettings:
m_ExternalVersionControlSupport: Visible Meta Files
m_SerializationMode: 2
m_LineEndingsForNewScripts: 2
m_DefaultBehaviorMode: 0
m_DefaultBehaviorMode: 1
m_SpritePackerMode: 0
m_SpritePackerPaddingPower: 1
m_EtcTextureCompressorBehavior: 1
......
......@@ -37,6 +37,7 @@ GraphicsSettings:
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16002, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment