Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using MalbersAnimations;
- using MalbersAnimations.Controller;
- using MalbersAnimations.HAP;
- using MalbersAnimations.Utilities;
- using UniRx;
- using UnityEngine;
- [RequireComponent(typeof(WagonController))]
- public class AnimalWagonAligner : MonoBehaviour
- {
- private WagonController _wagon;
- [SerializeField] private MWayPoint _forwardPoint = default;
- private Zone _zone;
- private void Awake()
- {
- _wagon = GetComponent<WagonController>();
- _zone = GetComponentInChildren<Zone>();
- _zone.OnZoneActivation.AsObservable().Subscribe(Mount);
- }
- private void Mount(MAnimal animal)
- {
- Debug.Log("Mount");
- Debug.Log($"animal : {animal}");
- var userInput = animal.GetComponentInParent<MalbersInput>();
- Debug.Log($"userInput : {userInput}");
- if (userInput) userInput.enabled = false;
- animal.CurrentSpeedIndex = 1; // Walk
- var ai = animal.GetComponent<MAnimalAIControl>();
- ai.enabled = true;
- ai.SetTarget(_forwardPoint.transform, true);
- }
- public void Disamount()
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement