Commit 37e2a6d7 authored by Sebastian's avatar Sebastian

Merge branch 'master' of gitlab.fsi.hochschule-trier.de:GameDevWeek/ws-18_19/unity/suck-it

Merge
parents 65a1baf3 9c888552
fileFormatVersion: 2
guid: 0619119e83cc24974b7776a5c1d3a0c7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 375b65aa2cf684af6978a76db238f875
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 9100000
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 2c1b34a4ee3824de38d780c543b87780
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Player_Fall_Test
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: 21300000, guid: e2976d09b53264ffbbb9210a1ae1dcc0, type: 3}
- time: 0.5
value: {fileID: 21300000, guid: 598fb1767626f42e992bb9c2769d86ea, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
m_SampleRate: 2
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: 21300000, guid: e2976d09b53264ffbbb9210a1ae1dcc0, type: 3}
- {fileID: 21300000, guid: 598fb1767626f42e992bb9c2769d86ea, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 1
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []
fileFormatVersion: 2
guid: b1e6f956e15cf4eeeb1ebc32e9af4879
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Player_Jump_Test
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: 21300000, guid: e2976d09b53264ffbbb9210a1ae1dcc0, type: 3}
- time: 0.5
value: {fileID: 21300000, guid: 598fb1767626f42e992bb9c2769d86ea, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
m_SampleRate: 2
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: 21300000, guid: e2976d09b53264ffbbb9210a1ae1dcc0, type: 3}
- {fileID: 21300000, guid: 598fb1767626f42e992bb9c2769d86ea, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 1
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []
fileFormatVersion: 2
guid: 5c579b168d0eb42c493f5226b501d78c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: ce6fa8e0a1254424ca874d49a1a35d35
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &9144624198248816052
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 9144624198248816055}
- component: {fileID: 9144624198248816054}
- component: {fileID: 9144624198248816053}
m_Layer: 0
m_Name: GameEventListeners
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &9144624198248816055
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9144624198248816052}
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: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &9144624198248816054
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9144624198248816052}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cd35dc826bb88514993730d585216e35, type: 3}
m_Name:
m_EditorClassIdentifier:
gameEvent: {fileID: 11400000, guid: 7e5b80a8353af1846a878c3a997bdb4a, type: 2}
allResponse:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_MethodName: UpdateMovementParameters
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
airResponse:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
earthResponse:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
fireResponse:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
waterResponse:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
defaultResponse:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &9144624198248816053
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9144624198248816052}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cae13dfa42160034cbe0b3a99bd73368, type: 3}
m_Name:
m_EditorClassIdentifier:
gameEvent: {fileID: 11400000, guid: 6ec6544f645a9d1458383b111fcaf8b6, type: 2}
response:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_MethodName: OnChargesChange
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.Events.UnityEvent, UnityEngine.CoreModule, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
fileFormatVersion: 2
guid: 6275ea6a12d5b40b99ac332a7818ebf4
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &130221826
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 130221827}
m_Layer: 10
m_Name: GroundCheck
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &130221827
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 130221826}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.09, y: -0.66, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 52145075018362285}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2139239322
GameObject:
m_ObjectHideFlags: 0
......@@ -48,8 +78,9 @@ GameObject:
- component: {fileID: 352228603}
- component: {fileID: 352228604}
- component: {fileID: 352228605}
- component: {fileID: 5703659376326297473}
- component: {fileID: 8997061578198512906}
- component: {fileID: 352228606}
- component: {fileID: 2596175625849265254}
- component: {fileID: 352228607}
m_Layer: 10
m_Name: Player
m_TagString: Player
......@@ -69,6 +100,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 2139239323}
- {fileID: 130221827}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -109,7 +141,7 @@ SpriteRenderer:
m_SortingLayerID: 1206248169
m_SortingLayer: 3
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: c8a742c1f2ebb43b9afe34a47304c051, type: 3}
m_Sprite: {fileID: 21300000, guid: 72de0c64f2c6a498096698322c976a67, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
......@@ -192,10 +224,10 @@ MonoBehaviour:
m_WhatIsGround:
serializedVersion: 2
m_Bits: 512
m_GroundCheck: {fileID: 52145075018362285}
m_GroundCheck: {fileID: 130221827}
m_GroundCheckDistance: 0.6
m_GroundedRadius: 0.25
m_GroundedOffset: {x: -0.09, y: -0.5}
m_GroundedOffset: {x: 0, y: 0}
m_SecondsWaitToJump: 0.5
m_MaxJumpCount: 1
OnLandEvent:
......@@ -292,6 +324,22 @@ MonoBehaviour:
m_EditorClassIdentifier:
savePointList: []
--- !u!114 &8997061578198512906
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 52145075018362288}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: -0.05, y: -0.3}
m_Size: {x: 1, y: 1.4}
m_Direction: 0
--- !u!114 &352228607
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
......@@ -300,6 +348,35 @@ MonoBehaviour:
m_GameObject: {fileID: 52145075018362288}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c55e49070d8a526499f890e88caa37a2, type: 3}
m_Script: {fileID: 11500000, guid: 04143d4b812b542329f18723f680be69, type: 3}
m_Name:
m_EditorClassIdentifier:
m_AirScale:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 2
outSlope: 2
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_Time: 0.1
m_SizePerCharge: 0.2
r_State: {fileID: 11400000, guid: c5777bcc7b64ce24c9bd65d2c4b7c639, type: 2}
r_Controller: {fileID: 52145075018362291}
r_Collider2D: {fileID: 0}
......@@ -8,6 +8,8 @@ using _Game.Scripts.Scriptable_Object;
public class MovementController : MonoBehaviour
{
[SerializeField] private PlayerState r_State;
private CapsuleCollider2D r_Collider;
private Animator r_Animator;
[Header("Movement")] [SerializeField] private float m_Speed = 10f;
[SerializeField] private float m_JumpForce = 400f; // Amount of force added when the player jumps.
......@@ -40,6 +42,10 @@ public class MovementController : MonoBehaviour
private ContactFilter2D m_ContactFilter2D;
private Vector3 m_CurrentGroundNormal;
private bool m_isMoving = false;
private bool m_isJumping = false;
private Vector2 m_Movement = Vector2.zero;
[Header("Events")] [Space]
//Wird Aktiviert wenn Spieler Landet
......@@ -51,6 +57,8 @@ public class MovementController : MonoBehaviour
private void Awake()
{
m_Rigidbody2D = GetComponent<Rigidbody2D>();
r_Collider = GetComponent<CapsuleCollider2D>();
r_Animator = GetComponent<Animator>();
m_ContactFilter2D.SetLayerMask(m_WhatIsGround);
......@@ -58,24 +66,18 @@ public class MovementController : MonoBehaviour
OnLandEvent = new UnityEvent();
}
private void FixedUpdate()
{
bool wasGrounded = m_Grounded;
m_Grounded = false;
Vector3 col = r_Collider.offset;
m_GroundCheck.position = transform.position + col;
GroundCheckDistance = r_Collider.size.y / 2 * transform.localScale.y + 0.2f;
// The player is grounded if a circlecast to the groundcheck position hits anything designated as ground
// This can be done using layers instead but Sample Assets will not overwrite your project settings.
/*Vector3 pos = m_GroundCheck.position + new Vector3(m_GroundedOffset.x, m_GroundedOffset.y);
Collider2D[] colliders = Physics2D.OverlapCircleAll (pos, m_GroundedRadius, m_WhatIsGround);
for (int i = 0; i < colliders.Length; i++) {
if (colliders[i].gameObject != gameObject) {
m_Grounded = true;
m_TempJumpCount = m_MaxJumpCount;
if (!wasGrounded)
OnLandEvent.Invoke ();
}
}*/
Vector3 pos = m_GroundCheck.position + new Vector3(m_GroundedOffset.x, m_GroundedOffset.y, 0);
var c = Physics2D.CircleCast(pos, m_GroundedRadius, Vector2.down, m_ContactFilter2D, m_RaycastHits2D,
m_GroundCheckDistance);
......@@ -99,14 +101,22 @@ public class MovementController : MonoBehaviour
OnLandEvent.Invoke();
}
}
r_Animator.SetFloat("Speed", m_Movement.magnitude);
r_Animator.SetBool("isJumping", m_Jumped);
r_Animator.SetBool("isAirborn", m_Airborn);
r_Animator.SetBool("isSwimming", m_Swimming);
}
public void Move(Vector2 move, bool jump)
{
m_Movement = move;
//only control the player if grounded or airControl is turned on
if (m_Grounded || (m_AirControl && (m_Airborn && !m_Grounded)) || (m_Swimming && m_CanSwim))
{
// Move the character by finding the target velocity
Vector2 targetVelocity = new Vector2((move.x * m_Speed * Time.deltaTime) * 10f, m_Rigidbody2D.velocity.y);
......@@ -198,6 +208,18 @@ public class MovementController : MonoBehaviour
get => m_GroundCheckDistance;
}
public Vector2 GroundCheckOffset
{
set => m_GroundedOffset = value;
get => m_GroundedOffset;
}
public float GroundCheckRadius
{
set => m_GroundedRadius = value;
get => m_GroundedRadius;
}
public void AddJumpCharge(int amount)
{
m_TempJumpCount += amount;
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using _Game.Scripts.Scriptable_Object;
public class PlayerAnimation : MonoBehaviour
{
public AnimationCurve m_AirScale;
public float m_Time = 10f;
public float m_SizePerCharge = 0.2f;
[SerializeField] private PlayerState r_State;
[SerializeField] private MovementController r_Controller;
[SerializeField] private CapsuleCollider2D r_Collider2D;
private bool m_isAnimating = false;
private bool m_isScaled = false;
private int m_PreviousCharges = 0;
private Vector3 m_OriginSize;
private Vector2 m_OriginOffset;
private float m_OriginCheckDistance;
private MovementController r_Controller;
// Start is called before the first frame update
void Start()
{
r_Controller = GetComponent<MovementController>();
r_Collider2D = GetComponent<CapsuleCollider2D>();
m_OriginSize = transform.localScale;
m_OriginOffset = r_Controller.GroundCheckOffset;
m_OriginCheckDistance = r_Controller.GroundCheckDistance;
}
// Update is called once per frame
void Update()
{
ScalePlayer();
//ScalePlayer();
}
public void OnChargesChange()
{
switch (r_State.GetCurrentElement())
{
case InfusedElement.None:
ScalePlayer();
break;
case InfusedElement.Air:
ScalePlayer();
break;
case InfusedElement.Fire:
break;
case InfusedElement.Earth:
break;
case InfusedElement.Water:
break;