rabidus-test/Assets/PlayerInputHandler.cs

26 lines
612 B
C#
Raw Permalink Normal View History

2023-10-18 11:59:26 +03:00
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
2023-10-18 11:59:26 +03:00
using UnityEngine;
public class PlayerInputHandler : MonoBehaviour
{
[SerializeField] private PlayerInputReference _playerInput;
[SerializeField] private List<PlayerInputReference> _inputs = new List<PlayerInputReference>();
2023-10-18 11:59:26 +03:00
public bool Boost => _inputs.Any(i => i.Boost());
public float Horizontal => _inputs.Select(i=>i.Horizontal()).Sum();
2023-10-18 11:59:26 +03:00
private void Awake()
{
Init();
}
private void Init()
{
foreach (var input in _inputs)
input.Init();
2023-10-18 11:59:26 +03:00
}
}