public void SwitchLoco(LocoType newLocoType, bool tellOtherHand = true) { _currentType = newLocoType; _teleporter.enabled = newLocoType == LocoType.ARCTELEPORTER; _smooth.enabled = newLocoType == LocoType.SMOOTH; if (!tellOtherHand || _interactor == null) { return; } VRInteractor otherHand = _interactor.GetOtherController(); if (otherHand == null) { return; } VRLocomotionSwitcher otherLocoSwitch = otherHand.GetComponent <VRLocomotionSwitcher>(); if (otherLocoSwitch == null) { return; } otherLocoSwitch.SwitchLoco(newLocoType, false); }
void Start() { _teleporter = GetComponent <ArcTeleporter>(); _smooth = GetComponent <VRSmooth>(); _interactor = GetComponent <VRInteractor>(); if (_teleporter == null) { Debug.LogError("Missing ArcTeleporter", gameObject); return; } if (_smooth == null) { Debug.LogError("Missing VRSmooth", gameObject); return; } _currentType = (LocoType)PlayerPrefs.GetInt("LocoType", 0); if (_teleporter.enabled == _smooth.enabled) { _teleporter.enabled = _currentType == LocoType.ARCTELEPORTER; _smooth.enabled = _currentType == LocoType.SMOOTH; } }
public Loco(string name, int serialNumber, LocoType locoType) { Name = name; SerialNumber = serialNumber; LocoType = locoType; }