rabidus-test/Assets/Scripts/FinishController.cs

42 lines
1.1 KiB
C#

using BNG;
using Dreamteck.Splines;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FinishController : MonoBehaviour
{
private ShipMoveSides _moveSides;
private MonumentController _monumentController;
private vTimerCounter _vTimerCounter;
private DisableAfterFinishController _disabler;
[SerializeField] private SteeringWheel _wheel;
private void Awake()
{
_moveSides = FindObjectOfType<PlayerInputHandler>().GetComponent<ShipMoveSides>();
_vTimerCounter = FindObjectOfType<vTimerCounter>();
_monumentController = FindObjectOfType<MonumentController>();
_disabler = FindObjectOfType<DisableAfterFinishController>();
}
public void OnFinish()
{
DisablePlayerMovement();
_disabler.Disabele();
_monumentController.UnlockMonument();
}
private void DisablePlayerMovement()
{
_wheel.DisableWheel();
_vTimerCounter.StopTimer();
_moveSides.ToggleInput(false);
}
public void OnTimeEnd()
{
DisablePlayerMovement();
}
}