Browse Source

Merge branch 'main' of http://git.joshuareason.com/Jam/GGJ_2022 into main

jeff
Tau-er\Bobbster 2 years ago
parent
commit
20f31eb929
13 changed files with 92 additions and 16 deletions
  1. +8
    -0
      Assets/Art Assets/Physics Materials.meta
  2. +11
    -0
      Assets/Art Assets/Physics Materials/Slippy.physicsMaterial2D
  3. +8
    -0
      Assets/Art Assets/Physics Materials/Slippy.physicsMaterial2D.meta
  4. BIN
      Assets/Scenes/Josh Test Scene.unity
  5. +7
    -2
      Assets/Scripts/Character/CharacterInputController.cs
  6. +24
    -7
      Assets/Scripts/DarknessController.cs
  7. +1
    -1
      Assets/Scripts/Shaders/Image.mat
  8. +8
    -0
      Assets/Variables.meta
  9. +8
    -0
      Assets/Variables/Runtime.meta
  10. BIN
      Assets/Variables/Runtime/isPlayerInput.asset
  11. +8
    -0
      Assets/Variables/Runtime/isPlayerInput.asset.meta
  12. BIN
      ProjectSettings/Physics2DSettings.asset
  13. BIN
      ProjectSettings/QualitySettings.asset

+ 8
- 0
Assets/Art Assets/Physics Materials.meta View File

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

+ 11
- 0
Assets/Art Assets/Physics Materials/Slippy.physicsMaterial2D View File

@ -0,0 +1,11 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!62 &6200000
PhysicsMaterial2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Slippy
friction: 0
bounciness: 0

+ 8
- 0
Assets/Art Assets/Physics Materials/Slippy.physicsMaterial2D.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6c2f9af082941ef45abc8e6a22e1c9ef
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 6200000
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Scenes/Josh Test Scene.unity (Stored with Git LFS) View File

size 152408

+ 7
- 2
Assets/Scripts/Character/CharacterInputController.cs View File

@ -2,6 +2,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem; using UnityEngine.InputSystem;
using Variables;
using NaughtyAttributes; using NaughtyAttributes;
public class CharacterInputController : MonoBehaviour public class CharacterInputController : MonoBehaviour
@ -11,7 +12,10 @@ public class CharacterInputController : MonoBehaviour
private CharacterController2D m_characterController; private CharacterController2D m_characterController;
[SerializeField] [SerializeField]
private Material m_Darkness;
private Reference<bool> m_playerInput;
[SerializeField,BoxGroup("Settings")]
private float m_speed = 2.0f;
[ShowNonSerializedField] [ShowNonSerializedField]
private Vector2 m_movement; private Vector2 m_movement;
@ -33,7 +37,8 @@ public class CharacterInputController : MonoBehaviour
private void Update() private void Update()
{ {
m_characterController.Move(m_movement.x,false ,m_jump);
m_characterController.Move(m_movement.x * m_speed,false ,m_jump);
m_playerInput.Value = m_movement.magnitude != 0 || m_jump;
} }

+ 24
- 7
Assets/Scripts/DarknessController.cs View File

@ -19,19 +19,26 @@ public class DarknessController : MonoBehaviour
[SerializeField, BoxGroup("Settings")] [SerializeField, BoxGroup("Settings")]
private float m_lightSpeed = 1.0f; private float m_lightSpeed = 1.0f;
[SerializeField, BoxGroup("Settings")]
private AnimationCurve m_lightCurve = AnimationCurve.Linear(0,0,1,1);
[ShowNonSerializedField]
private float m_currentDarknessLevel = 1;
[ShowNonSerializedField] [ShowNonSerializedField]
private float m_currentDarknessLevel;
private bool m_isDarknessChanging; private bool m_isDarknessChanging;
private void OnEnable() private void OnEnable()
{ {
m_isInputDown.OnValueChanged += OnInputChange; m_isInputDown.OnValueChanged += OnInputChange;
m_darknessMat.SetFloat("_Apply",1);
} }
private void OnDisable() private void OnDisable()
{ {
m_isInputDown.OnValueChanged -= OnInputChange; m_isInputDown.OnValueChanged -= OnInputChange;
m_darknessMat.SetFloat("_Apply", 1);
} }
@ -39,9 +46,17 @@ public class DarknessController : MonoBehaviour
{ {
StopAllCoroutines(); StopAllCoroutines();
if (value) if (value)
StartCoroutine(ChangeDarkness(0, m_darknessSpeed));
{ if (!m_isDarknessChanging)
{
StartCoroutine(ChangeDarkness(0, m_darknessSpeed));
}
else
{
StartCoroutine(ChangeDarkness(0, 0));
}
}
else else
StartCoroutine(ChangeDarkness(1, m_lightSpeed));
StartCoroutine(ChangeDarkness(1, m_lightSpeed, m_lightCurve));
} }
@ -52,24 +67,26 @@ public class DarknessController : MonoBehaviour
private IEnumerator ChangeDarkness(float end, float time, AnimationCurve curve) private IEnumerator ChangeDarkness(float end, float time, AnimationCurve curve)
{ {
float start = m_currentDarknessLevel; float start = m_currentDarknessLevel;
float elapsedTime = 0; float elapsedTime = 0;
time = Mathf.InverseLerp(start, end, m_currentDarknessLevel);
time = Mathf.InverseLerp(end, start, m_currentDarknessLevel) * time;
m_isDarknessChanging = true; m_isDarknessChanging = true;
while(elapsedTime < time)
while(elapsedTime < time || time != 0)
{ {
m_currentDarknessLevel = Mathf.Lerp(start, end, curve.Evaluate(elapsedTime / time)); m_currentDarknessLevel = Mathf.Lerp(start, end, curve.Evaluate(elapsedTime / time));
m_darknessMat.SetFloat("_Apply", m_currentDarknessLevel); m_darknessMat.SetFloat("_Apply", m_currentDarknessLevel);
yield return new WaitForEndOfFrame(); yield return new WaitForEndOfFrame();
elapsedTime += Time.deltaTime; elapsedTime += Time.deltaTime;
} }
m_isDarknessChanging = false;
m_currentDarknessLevel = end; m_currentDarknessLevel = end;
m_darknessMat.SetFloat("_Apply", m_currentDarknessLevel);
m_isDarknessChanging = false;
} }

+ 1
- 1
Assets/Scripts/Shaders/Image.mat View File

@ -79,7 +79,7 @@ Material:
- _UVSec: 0 - _UVSec: 0
- _ZWrite: 1 - _ZWrite: 1
m_Colors: m_Colors:
- _BackgroundColor: {r: 0.764151, g: 0, b: 0.08963457, a: 1}
- _BackgroundColor: {r: 0.026432894, g: 0.08926159, b: 0.16981131, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _MaskColor: {r: 0.61624897, g: 1, b: 0, a: 1} - _MaskColor: {r: 0.61624897, g: 1, b: 0, a: 1}

+ 8
- 0
Assets/Variables.meta View File

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

+ 8
- 0
Assets/Variables/Runtime.meta View File

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

BIN
Assets/Variables/Runtime/isPlayerInput.asset (Stored with Git LFS) View File

size 467

+ 8
- 0
Assets/Variables/Runtime/isPlayerInput.asset.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ae129d59580dbe94fa385299e3dfb47d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

BIN
ProjectSettings/Physics2DSettings.asset (Stored with Git LFS) View File

size 2029

BIN
ProjectSettings/QualitySettings.asset (Stored with Git LFS) View File

size 1408

Loading…
Cancel
Save