Commit 4be6549a authored by Patrick Stengel's avatar Patrick Stengel
Browse files

i promise my last next next next System change

parent a63f8fd5
...@@ -7,21 +7,41 @@ using UnityEngine.Serialization; ...@@ -7,21 +7,41 @@ using UnityEngine.Serialization;
namespace _Game.Scripts.Input { namespace _Game.Scripts.Input {
public class SwitchPlayerManager : MonoBehaviour { public class SwitchPlayerManager : MonoBehaviour {
[SerializeField] private string characterTag;
[SerializeField] private MovementBase movement; [SerializeField] private MovementBase movement;
[SerializeField] private UseMutation mutation; [SerializeField] private UseMutation mutation;
public void OnMovement(InputValue value) { public MovementBase Movement{
if (movement == null) return; get
{
if (movement == null || !movement.gameObject.tag.Equals(characterTag)) {
movement = GameObject.FindWithTag(characterTag).GetComponent<MovementBase>();
}
return movement;
}
}
public UseMutation Mutation {
get {
if (mutation == null || !mutation.gameObject.tag.Equals(characterTag)) {
mutation = GameObject.FindWithTag(characterTag).GetComponent<UseMutation>();
}
movement.OnMovement(value); return mutation;
}
}
public void OnMovement(InputValue value) {
Movement.OnMovement(value);
} }
public void OnAbility1() { public void OnAbility1() {
mutation.OnAbility1(); Mutation.OnAbility1();
} }
public void OnAbility2() { public void OnAbility2() {
mutation.OnAbility2(); Mutation.OnAbility2();
} }
} }
} }
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