Gradual jump and started orb events

This commit is contained in:
Gerard Gascón 2023-02-27 16:15:11 +01:00
parent e874c23647
commit b4e11ac33f
11 changed files with 1035 additions and 99 deletions

View file

@ -234,6 +234,90 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &75232997
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 75232999}
- component: {fileID: 75232998}
m_Layer: 0
m_Name: GameManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &75232998
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 75232997}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0f92eb99eeecf254ab1db681d9f7d3e5, type: 3}
m_Name:
m_EditorClassIdentifier:
orbEffects:
list:
- Key: 0
Value:
m_PersistentCalls:
m_Calls: []
- Key: 1
Value:
m_PersistentCalls:
m_Calls: []
- Key: 2
Value:
m_PersistentCalls:
m_Calls: []
- Key: 3
Value:
m_PersistentCalls:
m_Calls: []
- Key: 4
Value:
m_PersistentCalls:
m_Calls: []
- Key: 5
Value:
m_PersistentCalls:
m_Calls: []
- Key: 6
Value:
m_PersistentCalls:
m_Calls: []
- Key: 7
Value:
m_PersistentCalls:
m_Calls: []
- Key: 8
Value:
m_PersistentCalls:
m_Calls: []
keyCollision: 0
currentType: 0
--- !u!4 &75232999
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 75232997}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &208838962
GameObject:
m_ObjectHideFlags: 0
@ -1918,6 +2002,107 @@ MonoBehaviour:
- {x: 0.5, y: -0.5, z: 0}
- {x: 0.5, y: 0.5, z: 0}
- {x: -0.5, y: 0.5, z: 0}
--- !u!1 &264481247
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 264481251}
- component: {fileID: 264481250}
- component: {fileID: 264481249}
- component: {fileID: 264481248}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &264481248
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 264481247}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &264481249
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 264481247}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &264481250
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 264481247}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 1
m_Camera: {fileID: 519420031}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 1364324917
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &264481251
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 264481247}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1218928453}
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1 &483756969
GameObject:
m_ObjectHideFlags: 0
@ -2010,10 +2195,10 @@ Camera:
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0.07034909
x: 0
y: 0
width: 0.8593666
height: 0.99963677
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
@ -2105,6 +2290,82 @@ MonoBehaviour:
m_CropFrameX: 0
m_CropFrameY: 0
m_StretchFill: 0
--- !u!1 &658829298
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 658829299}
- component: {fileID: 658829301}
- component: {fileID: 658829300}
m_Layer: 5
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &658829299
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 658829298}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1921539878}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 37.5}
m_SizeDelta: {x: 10, y: 75}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &658829300
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 658829298}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &658829301
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 658829298}
m_CullTransparentMesh: 1
--- !u!1 &832780273
GameObject:
m_ObjectHideFlags: 0
@ -2258,6 +2519,7 @@ MonoBehaviour:
acceleration: 0.05
flipSmooth: 0.05
jumpForce: 30
gradualJumpMultiplier: 0.5
groundMask:
serializedVersion: 2
m_Bits: 8
@ -2265,7 +2527,7 @@ MonoBehaviour:
feetWidth: 0.85
feetPos: {fileID: 2122059437}
coyoteTime: 0.3
jumpBuffer: 0.3
jumpBuffer: 0.2
--- !u!1 &971952096
GameObject:
m_ObjectHideFlags: 0
@ -7203,6 +7465,151 @@ Transform:
m_Father: {fileID: 832780277}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1218928452
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1218928453}
- component: {fileID: 1218928455}
- component: {fileID: 1218928454}
m_Layer: 5
m_Name: Clock
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1218928453
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1218928452}
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_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1921539878}
m_Father: {fileID: 264481251}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -50, y: -50}
m_SizeDelta: {x: 200, y: 200}
m_Pivot: {x: 1, y: 1}
--- !u!114 &1218928454
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1218928452}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: -2413806693520163455, guid: e72f7cea6d4b14f41b3c725b217a3e52, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1218928455
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1218928452}
m_CullTransparentMesh: 1
--- !u!1 &1477198635
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1477198638}
- component: {fileID: 1477198637}
- component: {fileID: 1477198636}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1477198636
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1477198635}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SendPointerHoverToParent: 1
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &1477198637
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1477198635}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 10
--- !u!4 &1477198638
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1477198635}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1502401422
GameObject:
m_ObjectHideFlags: 0
@ -7287,6 +7694,43 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1921539877
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1921539878}
m_Layer: 5
m_Name: Pivot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1921539878
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1921539877}
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_ConstrainProportionsScale: 0
m_Children:
- {fileID: 658829299}
m_Father: {fileID: 1218928453}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &2122059436
GameObject:
m_ObjectHideFlags: 0

View file

@ -0,0 +1,184 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace GometGames.Tools
{
/// <summary>
/// Generic Serializable Dictionary for Unity 2020.1 and above.
/// Simply declare your key/value types and you're good to go - zero boilerplate.
/// </summary>
[Serializable]
public class GenericDictionary<TKey, TValue> : IDictionary<TKey, TValue>, ISerializationCallbackReceiver
{
// Internal
[SerializeField]
private List<KeyValuePair> list = new List<KeyValuePair>();
[SerializeField, HideInInspector]
private Dictionary<TKey, int> indexByKey = new Dictionary<TKey, int>();
[SerializeField, HideInInspector]
private Dictionary<TKey, TValue> dict = new Dictionary<TKey, TValue>();
#pragma warning disable 0414
[SerializeField, HideInInspector]
private bool keyCollision;
#pragma warning restore 0414
[Serializable]
private struct KeyValuePair
{
public TKey Key;
public TValue Value;
public KeyValuePair(TKey Key, TValue Value)
{
this.Key = Key;
this.Value = Value;
}
}
// Lists are serialized natively by Unity, no custom implementation needed.
public void OnBeforeSerialize() { }
// Populate dictionary with pairs from list and flag key-collisions.
public void OnAfterDeserialize()
{
dict.Clear();
indexByKey.Clear();
keyCollision = false;
for (int i = 0; i < list.Count; i++)
{
var key = list[i].Key;
if (key != null && !ContainsKey(key))
{
dict.Add(key, list[i].Value);
indexByKey.Add(key, i);
}
else
{
keyCollision = true;
}
}
}
// IDictionary
public TValue this[TKey key]
{
get => dict[key];
set
{
dict[key] = value;
if (indexByKey.ContainsKey(key))
{
var index = indexByKey[key];
list[index] = new KeyValuePair(key, value);
}
else
{
list.Add(new KeyValuePair(key, value));
indexByKey.Add(key, list.Count - 1);
}
}
}
public ICollection<TKey> Keys => dict.Keys;
public ICollection<TValue> Values => dict.Values;
public void Add(TKey key, TValue value)
{
dict.Add(key, value);
list.Add(new KeyValuePair(key, value));
indexByKey.Add(key, list.Count - 1);
}
public bool ContainsKey(TKey key) => dict.ContainsKey(key);
public bool Remove(TKey key)
{
if (dict.Remove(key))
{
var index = indexByKey[key];
list.RemoveAt(index);
UpdateIndexLookup(index);
indexByKey.Remove(key);
return true;
}
else
{
return false;
}
}
private void UpdateIndexLookup(int removedIndex) {
for (int i = removedIndex; i < list.Count; i++) {
var key = list[i].Key;
indexByKey[key]--;
}
}
public bool TryGetValue(TKey key, out TValue value) => dict.TryGetValue(key, out value);
// ICollection
public int Count => dict.Count;
public bool IsReadOnly { get; set; }
public void Add(KeyValuePair<TKey, TValue> pair)
{
Add(pair.Key, pair.Value);
}
public void Clear()
{
dict.Clear();
list.Clear();
indexByKey.Clear();
}
public bool Contains(KeyValuePair<TKey, TValue> pair)
{
TValue value;
if (dict.TryGetValue(pair.Key, out value))
{
return EqualityComparer<TValue>.Default.Equals(value, pair.Value);
}
else
{
return false;
}
}
public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
{
if (array == null)
throw new ArgumentException("The array cannot be null.");
if (arrayIndex < 0)
throw new ArgumentOutOfRangeException("The starting array index cannot be negative.");
if (array.Length - arrayIndex < dict.Count)
throw new ArgumentException("The destination array has fewer elements than the collection.");
foreach (var pair in dict)
{
array[arrayIndex] = pair;
arrayIndex++;
}
}
public bool Remove(KeyValuePair<TKey, TValue> pair)
{
TValue value;
if (dict.TryGetValue(pair.Key, out value))
{
bool valueMatch = EqualityComparer<TValue>.Default.Equals(value, pair.Value);
if (valueMatch)
{
return Remove(pair.Key);
}
}
return false;
}
// IEnumerable
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator() => dict.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => dict.GetEnumerator();
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8dee231b3f6acd04fb6f88737505c0bf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 854339740fd089942ba32bfdc1ff49c7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,40 @@
using System.Collections;
using System.Collections.Generic;
using GometGames.Tools;
using MyBox;
using UnityEngine;
using UnityEngine.Events;
[System.Serializable]
public enum OrbTypes {
Blue,
Red,
InvertedControls,
HighGravity,
LowGravity,
InvertedGravity,
DarkRoom,
HighSpeed,
LowSpeed
};
public class GameManager : MonoBehaviour {
[SerializeField] GenericDictionary<OrbTypes, UnityEvent> orbEffects;
[SerializeField] OrbTypes currentType;
// Start is called before the first frame update
void Start(){
}
// Update is called once per frame
void Update(){
}
void ChangeEventCall(OrbTypes type) {
currentType = type;
orbEffects[currentType].Invoke();
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0f92eb99eeecf254ab1db681d9f7d3e5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -6,17 +6,20 @@ using UnityEngine.Serialization;
public class PlayerController : MonoBehaviour {
[Header("Stats")]
[SerializeField] float speed = 50f;
[SerializeField, Range(0f, .5f)] float acceleration = .1f;
[SerializeField, Range(0f, .5f)] float flipSmooth = .1f;
[SerializeField] float jumpForce = 10f;
[SerializeField, Range(0f, 1f)] float gradualJumpMultiplier = .5f;
Vector2 _input;
float _xVelocity, _flipVelocity;
int _facingDirection = 1;
bool _cancelJump;
Rigidbody2D _rb2d;
[Space]
[Header("Jump Management")]
[SerializeField] LayerMask groundMask;
[SerializeField, Range(0f, 1f)] float feetHeight;
[SerializeField, Range(0f, 2f)] float feetWidth;
@ -40,13 +43,16 @@ public class PlayerController : MonoBehaviour {
_ => _facingDirection
};
transform.localScale =
new Vector3(Mathf.SmoothDamp(transform.localScale.x, _facingDirection, ref _flipVelocity, flipSmooth),
transform.localScale.y, transform.localScale.z);
Vector3 localScale = transform.localScale;
localScale = new Vector3(Mathf.SmoothDamp(localScale.x, _facingDirection, ref _flipVelocity, flipSmooth),
localScale.y, localScale.z);
transform.localScale = localScale;
_isGrounded = Physics2D.OverlapBox(feetPos.position, new Vector2(feetWidth, feetHeight), 0f, groundMask);
if (_isGrounded && _rb2d.velocity.y <= 0f) _coyoteTime = coyoteTime;
if (Input.GetKeyDown(KeyCode.Space)) _jumpBuffer = jumpBuffer;
if (Input.GetKeyUp(KeyCode.Space)) _cancelJump = true;
_jumpBuffer -= Time.deltaTime;
_coyoteTime -= Time.deltaTime;
@ -60,6 +66,11 @@ public class PlayerController : MonoBehaviour {
_rb2d.AddForce(Vector2.up * jumpForce, ForceMode2D.Impulse);
_coyoteTime = _jumpBuffer = 0f;
}
if (_cancelJump) {
if(_rb2d.velocity.y > 0f) _rb2d.velocity = new Vector2(_rb2d.velocity.x, _rb2d.velocity.y * gradualJumpMultiplier);
_cancelJump = false;
}
}
void OnDrawGizmosSelected() {

BIN
Assets/Sprites/Circle.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,248 @@
fileFormatVersion: 2
guid: e72f7cea6d4b14f41b3c725b217a3e52
TextureImporter:
internalIDToNameTable:
- first:
213: -2413806693520163455
second: Circle
externalObjects: {}
serializedVersion: 12
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
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 256
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: 0
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: iPhone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: Circle
rect:
serializedVersion: 2
x: 0
y: 0
width: 256
height: 256
alignment: 0
pivot: {x: 0.5, y: 0.5}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: 33, y: 128}
- {x: -33, y: 128}
- {x: -95, y: 95}
- {x: -128, y: 33}
- {x: -128, y: -33}
- {x: -95, y: -95}
- {x: -33, y: -128}
- {x: 33, y: -128}
- {x: 95, y: -95}
- {x: 128, y: -33}
- {x: 128, y: 33}
- {x: 95, y: 95}
physicsShape:
- - {x: 0, y: 128}
- {x: -39, y: 121}
- {x: -75, y: 103}
- {x: -103, y: 75}
- {x: -121, y: 39}
- {x: -128, y: 0}
- {x: -121, y: -39}
- {x: -103, y: -75}
- {x: -75, y: -103}
- {x: -39, y: -121}
- {x: 0, y: -128}
- {x: 39, y: -121}
- {x: 75, y: -103}
- {x: 103, y: -75}
- {x: 121, y: -39}
- {x: 128, y: 0}
- {x: 121, y: 39}
- {x: 103, y: 75}
- {x: 75, y: 103}
- {x: 39, y: 121}
tessellationDetail: 0
bones: []
spriteID: 18d3544e99f608ed0800000000000000
internalID: -2413806693520163455
vertices: []
indices:
edges: []
weights: []
outline:
- - {x: 33, y: 128}
- {x: -33, y: 128}
- {x: -95, y: 95}
- {x: -128, y: 33}
- {x: -128, y: -33}
- {x: -95, y: -95}
- {x: -33, y: -128}
- {x: 33, y: -128}
- {x: 95, y: -95}
- {x: 128, y: -33}
- {x: 128, y: 33}
- {x: 95, y: 95}
physicsShape:
- - {x: 0, y: 128}
- {x: -39, y: 121}
- {x: -75, y: 103}
- {x: -103, y: 75}
- {x: -121, y: 39}
- {x: -128, y: 0}
- {x: -121, y: -39}
- {x: -103, y: -75}
- {x: -75, y: -103}
- {x: -39, y: -121}
- {x: 0, y: -128}
- {x: 39, y: -121}
- {x: 75, y: -103}
- {x: 103, y: -75}
- {x: 121, y: -39}
- {x: 128, y: 0}
- {x: 121, y: 39}
- {x: 103, y: 75}
- {x: 75, y: 103}
- {x: 39, y: 121}
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable:
Circle: -2413806693520163455
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -41,3 +41,6 @@ TagManager:
- name: Default
uniqueID: 0
locked: 0
- name: UI
uniqueID: 1364324917
locked: 0

View file

@ -19,7 +19,7 @@ MonoBehaviour:
width: 3072
height: 1636.8
m_ShowMode: 4
m_Title: Project
m_Title: Game
m_RootView: {fileID: 3}
m_MinSize: {x: 875, y: 300}
m_MaxSize: {x: 10000, y: 10000}
@ -43,11 +43,11 @@ MonoBehaviour:
y: 0
width: 808
height: 1586.8
m_MinSize: {x: 276, y: 71}
m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 14}
m_MinSize: {x: 275, y: 50}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 13}
m_Panes:
- {fileID: 14}
- {fileID: 13}
m_Selected: 0
m_LastSelected: 0
--- !u!114 &3
@ -99,7 +99,7 @@ MonoBehaviour:
height: 30
m_MinSize: {x: 0, y: 0}
m_MaxSize: {x: 0, y: 0}
m_LastLoadedLayoutName: Wide
m_LastLoadedLayoutName:
--- !u!114 &5
MonoBehaviour:
m_ObjectHideFlags: 52
@ -124,7 +124,7 @@ MonoBehaviour:
m_MinSize: {x: 300, y: 200}
m_MaxSize: {x: 24288, y: 16192}
vertical: 0
controlID: 132
controlID: 97
--- !u!114 &6
MonoBehaviour:
m_ObjectHideFlags: 52
@ -170,7 +170,7 @@ MonoBehaviour:
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 16192, y: 16192}
vertical: 1
controlID: 179
controlID: 86
--- !u!114 &8
MonoBehaviour:
m_ObjectHideFlags: 52
@ -181,7 +181,7 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 1
m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0}
m_Name: SceneView
m_Name: GameView
m_EditorClassIdentifier:
m_Children: []
m_Position:
@ -192,11 +192,11 @@ MonoBehaviour:
height: 1143.2
m_MinSize: {x: 201, y: 221}
m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 17}
m_ActualView: {fileID: 15}
m_Panes:
- {fileID: 17}
- {fileID: 16}
m_Selected: 0
- {fileID: 15}
m_Selected: 1
m_LastSelected: 0
--- !u!114 &9
MonoBehaviour:
@ -222,7 +222,7 @@ MonoBehaviour:
m_MinSize: {x: 200, y: 100}
m_MaxSize: {x: 16192, y: 8096}
vertical: 0
controlID: 139
controlID: 22
--- !u!114 &10
MonoBehaviour:
m_ObjectHideFlags: 52
@ -242,11 +242,11 @@ MonoBehaviour:
y: 0
width: 444.8
height: 443.6001
m_MinSize: {x: 201, y: 221}
m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 18}
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 17}
m_Panes:
- {fileID: 18}
- {fileID: 17}
m_Selected: 0
m_LastSelected: 0
--- !u!114 &11
@ -270,51 +270,13 @@ MonoBehaviour:
height: 443.6001
m_MinSize: {x: 232, y: 271}
m_MaxSize: {x: 10002, y: 10021}
m_ActualView: {fileID: 15}
m_ActualView: {fileID: 14}
m_Panes:
- {fileID: 15}
- {fileID: 13}
- {fileID: 14}
- {fileID: 12}
m_Selected: 0
m_LastSelected: 2
--- !u!114 &12
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f817a38900380be47942905e17e7d39b, type: 3}
m_Name:
m_EditorClassIdentifier:
m_MinSize: {x: 100, y: 100}
m_MaxSize: {x: 4000, y: 4000}
m_TitleContent:
m_Text: Timeline
m_Image: {fileID: -5401195905404635996, guid: 0000000000000000d000000000000000, type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 435.2
y: 1179.2001
width: 1767.6001
height: 460.20007
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
m_SaveData: []
m_Preferences:
editType: 0
timeReferenceMode: 0
m_LockTracker:
m_IsLocked: 0
m_SequenceHierarchy: {fileID: 0}
m_SequencePath:
m_SelectionRoot: 0
m_SubElements: []
--- !u!114 &13
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
@ -342,7 +304,7 @@ MonoBehaviour:
m_OverlayCanvas:
m_LastAppliedPresetName: Default
m_SaveData: []
--- !u!114 &14
--- !u!114 &13
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
@ -383,7 +345,7 @@ MonoBehaviour:
m_LockTracker:
m_IsLocked: 0
m_PreviewWindow: {fileID: 0}
--- !u!114 &15
--- !u!114 &14
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
@ -432,14 +394,14 @@ MonoBehaviour:
m_LastFolders:
- Assets
m_LastFoldersGridSize: -1
m_LastProjectPath: C:\Users\ggasc\GitHub\ListJam 2
m_LastProjectPath: C:\Users\ggasc\GitHub\ListJam2
m_LockTracker:
m_IsLocked: 0
m_FolderTreeState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 9e630000
m_LastClickedID: 25502
m_ExpandedIDs: 000000009e63000000ca9a3b
m_SelectedIDs: e25a0000
m_LastClickedID: 23266
m_ExpandedIDs: 00000000e25a000000ca9a3b
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -467,7 +429,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 000000009e63000000ca9a3b
m_ExpandedIDs: 00000000e25a0000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -523,7 +485,7 @@ MonoBehaviour:
m_GridSize: 64
m_SkipHiddenPackages: 0
m_DirectoriesAreaWidth: 129
--- !u!114 &16
--- !u!114 &15
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
@ -544,9 +506,9 @@ MonoBehaviour:
m_Pos:
serializedVersion: 2
x: 0
y: 73
width: 1377
height: 552
y: 73.6
width: 2263
height: 1122.2
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
@ -557,7 +519,7 @@ MonoBehaviour:
m_ShowGizmos: 0
m_TargetDisplay: 0
m_ClearColor: {r: 0, g: 0, b: 0, a: 0}
m_TargetSize: {x: 1377, y: 531}
m_TargetSize: {x: 2263, y: 1101.2}
m_TextureFilterMode: 0
m_TextureHideFlags: 61
m_RenderIMGUI: 1
@ -572,10 +534,10 @@ MonoBehaviour:
m_VRangeLocked: 0
hZoomLockedByDefault: 0
vZoomLockedByDefault: 0
m_HBaseRangeMin: -550.8
m_HBaseRangeMax: 550.8
m_VBaseRangeMin: -212.40001
m_VBaseRangeMax: 212.40001
m_HBaseRangeMin: -905.2
m_HBaseRangeMax: 905.2
m_VBaseRangeMin: -440.47998
m_VBaseRangeMax: 440.47998
m_HAllowExceedBaseRangeMin: 1
m_HAllowExceedBaseRangeMax: 1
m_VAllowExceedBaseRangeMin: 1
@ -584,7 +546,7 @@ MonoBehaviour:
m_HSlider: 0
m_VSlider: 0
m_IgnoreScrollWheelUntilClicked: 0
m_EnableMouseInput: 0
m_EnableMouseInput: 1
m_EnableSliderZoomHorizontal: 0
m_EnableSliderZoomVertical: 0
m_UniformScale: 1
@ -593,29 +555,29 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 21
width: 1377
height: 531
width: 2263
height: 1101.2
m_Scale: {x: 1, y: 1}
m_Translation: {x: 688.5, y: 265.5}
m_Translation: {x: 1131.5, y: 550.6}
m_MarginLeft: 0
m_MarginRight: 0
m_MarginTop: 0
m_MarginBottom: 0
m_LastShownAreaInsideMargins:
serializedVersion: 2
x: -688.5
y: -265.5
width: 1377
height: 531
x: -1131.5
y: -550.6
width: 2263
height: 1101.2
m_MinimalGUI: 1
m_defaultScale: 1
m_LastWindowPixelSize: {x: 1721.25, y: 690}
m_LastWindowPixelSize: {x: 2828.75, y: 1402.75}
m_ClearInEditMode: 1
m_NoCameraWarning: 1
m_LowResolutionForAspectRatios: 01000000000000000000
m_XRRenderMode: 0
m_RenderTexture: {fileID: 0}
--- !u!114 &17
--- !u!114 &16
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
@ -695,7 +657,7 @@ MonoBehaviour:
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: Scene View/Open Tile Palette
id: Cinemachine
index: 2
layout: 4
- dockPosition: 1
@ -706,9 +668,20 @@ MonoBehaviour:
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: Scene View/Tilemap Focus
id: Scene View/Open Tile Palette
index: 3
layout: 4
- dockPosition: 1
containerId: overlay-toolbar__top
floating: 0
collapsed: 0
displayed: 0
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
id: Scene View/Tilemap Focus
index: 4
layout: 4
- dockPosition: 0
containerId: overlay-container--left
floating: 0
@ -862,9 +835,9 @@ MonoBehaviour:
m_PlayAudio: 0
m_AudioPlay: 0
m_Position:
m_Target: {x: 560.9913, y: 235.04947, z: -14.208169}
m_Target: {x: 13.847921, y: 8.866838, z: -12.01858}
speed: 2
m_Value: {x: 560.9913, y: 235.04947, z: -14.208169}
m_Value: {x: 13.847921, y: 8.866838, z: -12.01858}
m_RenderMode: 0
m_CameraMode:
drawMode: 0
@ -915,9 +888,9 @@ MonoBehaviour:
speed: 2
m_Value: {x: 0, y: 0, z: 0, w: 1}
m_Size:
m_Target: 300.69403
m_Target: 6.49222
speed: 2
m_Value: 300.69403
m_Value: 6.49222
m_Ortho:
m_Target: 1
speed: 2
@ -942,7 +915,7 @@ MonoBehaviour:
m_SceneVisActive: 1
m_LastLockedObject: {fileID: 0}
m_ViewIsLockedToObject: 0
--- !u!114 &18
--- !u!114 &17
MonoBehaviour:
m_ObjectHideFlags: 52
m_CorrespondingSourceObject: {fileID: 0}
@ -975,7 +948,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 2cfbffff
m_ExpandedIDs: b6edffff0afbffff
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name: