Movement/VariableMovement/VariableMovementBehaviourAp...

25 lines
789 B
C#

using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace Syntriax.Modules.Movement.VariableMovement
{
public class VariableMovementBehaviourApplier : MonoBehaviour
{
private List<IMovement> movements = new List<IMovement>();
private IVariableMovementController variableMovementController = null;
private void Start()
{
movements = GetComponents<IMovement>().ToList();
variableMovementController = GetComponent<IVariableMovementController>();
}
private void Update()
{
foreach (var movement in movements)
movement.MovementMultiplier = variableMovementController.CurrentVariableMovement.VariableMovementAsset.MovementMultiplier;
}
}
}