Commit 82aa23e8 authored by mthiele2's avatar mthiele2

Movement-Controller update drölf

parent bb958eb5
This diff is collapsed.
......@@ -4,6 +4,7 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using _Game.Scripts.Scriptable_Object;
using _Game.Scripts.Player.PlayerAttacks.Earth;
[RequireComponent(typeof(Rigidbody2D), typeof(CapsuleCollider2D))]
public class MovementController : MonoBehaviour
......@@ -170,15 +171,22 @@ public class MovementController : MonoBehaviour
public void UpdateMovementParameters()
{
MovementState state = r_State.GetCurrentMovementState();
m_JumpForce = state.jumpForce;
m_MovementSmoothing = state.smoothing;
m_AirControl = state.airControl;
m_CanSwim = state.canSwim;
m_Speed = state.moveSpeed;
m_MaxJumpCount = state.maxJumpCount;
m_Rigidbody2D.mass = state.mass;
m_Rigidbody2D.gravityScale = state.gravity;
if (GetComponentInParent<PlayerEarthAttack>().isStomping)
{
Invoke("UpdateMovementParameters", 0.01f);
}
else
{
MovementState state = r_State.GetCurrentMovementState();
m_JumpForce = state.jumpForce;
m_MovementSmoothing = state.smoothing;
m_AirControl = state.airControl;
m_CanSwim = state.canSwim;
m_Speed = state.moveSpeed;
m_MaxJumpCount = state.maxJumpCount;
m_Rigidbody2D.mass = state.mass;
m_Rigidbody2D.gravityScale = state.gravity;
}
}
public void SetSwimming(bool value)
......
......@@ -10,9 +10,6 @@ namespace _Game.Scripts.Player.PlayerAttacks.Earth
public float massIncrease;
public bool isStomping;
MovementController controller;
private RaycastHit2D[] RaycastHits2D = new RaycastHit2D[8];
private LayerMask whatIsDestroyable;
private ContactFilter2D contactFilter2D;
private bool _ready;
private bool _activated;
......@@ -20,7 +17,6 @@ namespace _Game.Scripts.Player.PlayerAttacks.Earth
void Start()
{
controller = GetComponentInParent<MovementController>();
contactFilter2D.SetLayerMask(whatIsDestroyable);
_nextFire = 0;
_ready = true;
......
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