void Update() { if (!isFirstCheckComplete && helper != null) { CheckSlotsForFlyModule(); isFirstCheckComplete = true; } if (!isEnabled) { return; } if (helper == null || motor == null /* || !helper.IsPiloted()*/) { return; } if (!helper.IsPiloted() && SeatruckPosition == TruckPosition.OnSurface && SeatruckState == TruckState.Landed && !rigidbody.isKinematic) { rigidbody.isKinematic = true; } if (Input.GetKeyDown(KeyCode.R)) { StartCoroutine(SeatruckCallBack()); } if (!helper.IsPiloted() && SeatruckState == TruckState.Landed) { return; } altitude = helper.MainCab.transform.position.y; altitudeMeter.transform.localRotation = Quaternion.AngleAxis(360 - mainCab.transform.eulerAngles.x, Vector3.right); if (Physics.Raycast(altitudeMeter.transform.position, altitudeMeter.transform.TransformDirection(Vector3.down), out RaycastHit raycastDown, 100f, -1, QueryTriggerInteraction.Ignore)) { GameObject gameObject = raycastDown.collider.gameObject; if (gameObject != null && gameObject.GetComponent <LiveMixin>() == null) { distanceFromSurface = (altitude - raycastDown.point.y) - 3; } else { distanceFromSurface = altitude; } }
public void ManagedUpdate() { if (timeLastDrilled + 0.5f > Time.time) { drillable.modelRoot.transform.position = transform.position + new Vector3(Mathf.Sin(Time.time * 60f), Mathf.Cos(Time.time * 58f + 0.5f), Mathf.Cos(Time.time * 64f + 2f)) * 0.011f; } if (lootPinataObjects.Count > 0 && helper != null) { List <GameObject> list = new List <GameObject>(); foreach (GameObject gameObject in lootPinataObjects) { if (gameObject == null) { list.Add(gameObject); } else { Vector3 b = helper.MainCab.transform.position + new Vector3(0f, 0.8f, 0f); gameObject.transform.position = Vector3.Lerp(gameObject.transform.position, b, Time.deltaTime * 5f); float num = Vector3.Distance(gameObject.transform.position, b); if (num < 3f) { Pickupable pickupable = gameObject.GetComponentInChildren <Pickupable>(); if (pickupable) { if (!helper.HasRoomForItem(pickupable)) { if (helper.IsPiloted()) { ErrorMessage.AddMessage(Language.main.Get("ContainerCantFit")); } } else { string arg = Language.main.Get(pickupable.GetTechName()); ErrorMessage.AddMessage(Language.main.GetFormat("VehicleAddedToStorage", arg)); uGUI_IconNotifier.main.Play(pickupable.GetTechType(), uGUI_IconNotifier.AnimationType.From, null); pickupable.Initialize(); InventoryItem item = new InventoryItem(pickupable); helper.GetRoomForItem(pickupable).UnsafeAdd(item); pickupable.PlayPickupSound(); } list.Add(gameObject); } } } } if (list.Count > 0) { foreach (GameObject item2 in list) { lootPinataObjects.Remove(item2); } } } }