public StockPricePollingWorker(string id, int pollRateMilliseconds, TriggerController controller, IQuoteProvider quoteProvider) : base(id, pollRateMilliseconds) { if (controller == null) throw new ArgumentNullException("controller"); if (quoteProvider == null) throw new ArgumentNullException("quoteProvider"); _controller = controller; _quoteProvider = quoteProvider; }
protected override IList<IWorker> GetWorkerList() { var notificationReceiver = RabbitMessengerFactory.GetReceiver("TriggerNotificationQueueReceiver"); var sharedBuffer = new BlockingCollection<TriggerUpdateNotification>(); var repostiory = new PostgresTriggerRepository(_triggerRepoConnectionStrings); var quoteProvider = new SocketQuoteProvider(_quoteCacheHost, _quoteCachePort); var controller = new TriggerController(new DtsApiTriggerAuthority(_dtsApiRoot)); var workerList = new List<IWorker> { new TriggerNotificationQueueMonitor("QueueMonitor", notificationReceiver, sharedBuffer), new RepositoryReaderWorker("RepositoryReader", sharedBuffer, repostiory, controller), new StockPricePollingWorker("PollingWorker", _quoteCachePollRateMs, controller, quoteProvider) }; return workerList; }
private void Update() { // Check if ACTION key is held for more than 0.5 seconds if (Input.GetKeyUp(GetActionKeyCode())) { interactionKeyHeldTime = 0f; heldInteractionKey = false; } else if (!heldInteractionKey && Input.GetKey(GetActionKeyCode())) { interactionKeyHeldTime += Time.deltaTime; if (interactionKeyHeldTime >= 0.25f) { heldInteractionKey = true; } } // If ACTION key is pressed while hovering a food in inventory, eat it Inventory3DManager inventory = Inventory3DManager.Get(); if (inventory && inventory.IsActive() && // Make sure inventory is currently open inventory.m_FocusedItem && !inventory.m_FocusedItem.m_OnCraftingTable && // Make sure the highlighted item isn't on crafting table !inventory.m_CarriedItem && // Make sure we aren't drag & dropping any items at the moment TriggerController.Get().GetBestTrigger() && TriggerController.Get().GetBestTrigger().gameObject == inventory.m_FocusedItem.gameObject && // Make sure the highlighted item is the item that the cursor is on !HUDItem.Get().m_Active&& // Make sure RMB menu isn't open for any item right now !InputsManager.Get().m_TextInputActive&& // Make sure chat isn't active (inventory.m_FocusedItem.m_Info.m_Eatable || inventory.m_FocusedItem.m_Info.m_Drinkable) && // Make sure the highlighted item is eatable or drinkable Input.GetKeyDown(GetActionKeyCode())) // Make sure hotkey is pressed { if (!inventory.m_FocusedItem.ReplIsOwner()) { inventory.m_FocusedItem.ReplRequestOwnership(); } inventory.m_FocusedItem.ReplSetDirty(); if (inventory.m_FocusedItem.m_Info.m_Eatable) { inventory.m_FocusedItem.Eat(); } else { inventory.m_FocusedItem.Drink(); } } }
// Use this for initialization void Start() { if (LevelsManager.Instance != null) { LevelsManager.Instance.Canvas.gameObject.SetActive(false); } _currentScene = SceneManager.GetActiveScene().name; _coinsCount = 0; _maxCoins = 150; _totalCoinsCollected = 0; _totalCoins = TotalCoins.transform.childCount; _tutorial = InputTutorial.GetComponent <TriggerController>(); if (_tutorial.AddCoins_LVL1 && _currentScene == "Level1") { _totalCoins = TotalCoins.transform.childCount + TotalCoinsNoTutorial.transform.childCount; } SetCountText(); _remainingLives = 3; _livesLost = 0; _additionalLife = false; Gameover = false; ShieldActive = false; _timer = 0; _stopGame = false; _camShake = GetComponent <CameraShake>(); _slowdownSpeed = 0.7f; if (_currentScene != "BonusLevel") { _currentLevel = Int32.Parse(_currentScene.Substring(_currentScene.Length - 1)); } else { _currentLevel = 8; } StartCoroutine(StartTimer()); StartCoroutine(FadeTextIn(0.7f)); Time.timeScale = 1f; }
protected override void UpdateLayer() { int num = this.m_DefaultLayer; if (this == TriggerController.Get().GetBestTrigger() && this.CanBeOutlined()) { num = this.m_OutlineLayer; } else if (this.m_InInventory || this.m_OnCraftingTable || Inventory3DManager.Get().m_CarriedItem == this) { num = this.m_InventoryLayer; } if (base.gameObject.layer != num) { base.SetLayer(base.transform, num); } }
/// <param name="instanceId">The unique name of the worker instance.</param> /// <param name="updateBuffer">The buffer from which to read TriggerUpdateNotification messages.</param> /// <param name="repository">The DTS trigger repository.</param> /// <param name="controller">The TriggerController instance where triggers will be updated.</param> public RepositoryReaderWorker(string instanceId, BlockingCollection<TriggerUpdateNotification> updateBuffer, ITriggerRepository repository, TriggerController controller) { if (instanceId == null) throw new ArgumentNullException("instanceId"); if (updateBuffer == null) throw new ArgumentNullException("updateBuffer"); if (repository == null) throw new ArgumentNullException("repository"); if (controller == null) throw new ArgumentNullException("controller"); InstanceId = instanceId; _updateBuffer = updateBuffer; _repository = repository; _controller = controller; _lastUpdated = new Dictionary<string, DateTime>(); }
// Start is called before the first frame update void Start() { GameObject TriggerController = GameObject.Find("TriggerController"); TriggerControllerScript = TriggerController.GetComponent <TriggerController>(); GameObject BodySourceView = GameObject.Find("KinectAvatar"); BodySourceViewScript = BodySourceView.GetComponent <BodySourceView>(); GameObject TransitionLoader = GameObject.Find("TransitionLoader"); transitionScript = TransitionLoader.GetComponent <TransitionLoader>(); GameObject cubeSpinningAnim = GameObject.Find("Cube"); //cubeScript = cubeSpinningAnim.GetComponent<CubeSpinningAnimation>(); animationControl = cameraManagement.GetComponent <PlayableDirector>(); }
private void OnAction(InputActionData action) { if (action.m_TriggerAction != TriggerAction.TYPE.None) { if (TriggerController.Get() != null) { TriggerController.Get().OnTriggerAction(action.m_TriggerAction); } } else { foreach (IInputsReceiver inputsReceiver in this.m_Receivers) { if (inputsReceiver.CanReceiveAction()) { inputsReceiver.OnInputAction(action.m_Action); } } } }
private void UpdateMaterial() { if (!this.m_Fulfilled) { Material material; if (TriggerController.Get().GetBestTrigger() == this) { material = this.m_Parent.GetHighlightedMaterial(); } else { material = this.m_Parent.GetActiveMaterial(); } if (this.m_RendererMaterialNameHash != Animator.StringToHash(material.name)) { this.m_Renderer.material = material; this.m_RendererMaterialNameHash = Animator.StringToHash(material.name); } } }
protected override void OnEnable() { base.OnEnable(); this.m_FXCounter = 0; this.m_Player.BlockMoves(); this.m_State = VomitingController.State.Vomiting; this.m_BodyRotationBonesParams[base.gameObject.transform.FindDeepChild("mixamorig:Spine")] = 0f; this.m_BodyRotationBonesParams[base.gameObject.transform.FindDeepChild("mixamorig:Spine1")] = 0f; this.m_BodyRotationBonesParams[base.gameObject.transform.FindDeepChild("mixamorig:Spine2")] = 0f; this.m_Animator.SetBool(this.m_BVomiting, true); EventsManager.OnEvent(Enums.Event.Vomit, 1); TriggerController.Get().m_TriggerToExecute = null; TriggerController.Get().ResetTrigger(); if (HUDItem.Get().m_Active) { HUDItem.Get().Deactivate(); } this.m_Animator.SetBool(TriggerController.s_BGrabItem, false); this.m_Animator.SetBool(TriggerController.s_BGrabItemBow, false); this.m_Animator.SetBool(TriggerController.s_BGrabItemBambooBow, false); }
public virtual void UpdateLayer() { if (this.m_ForcedLayer != 0) { if (base.gameObject.layer != this.m_ForcedLayer) { this.SetLayer(base.transform, this.m_ForcedLayer); } return; } int num = this.m_DefaultLayer; if (this == TriggerController.Get().GetBestTrigger() && this.CanBeOutlined()) { num = this.m_OutlineLayer; } if (base.gameObject.layer != num) { this.SetLayer(base.transform, num); } }
private bool CanStartFishing() { if (MainLevel.Instance.IsPause()) { return(false); } if (this.m_Player.GetRotationBlocked()) { return(false); } if (Inventory3DManager.Get().gameObject.activeSelf) { return(false); } if (TriggerController.Get().GetBestTrigger()) { return(false); } FishingController.State integer = (FishingController.State) this.m_Animator.GetInteger(this.m_StateHash); return(integer == FishingController.State.Idle || integer == FishingController.State.Walk || integer == FishingController.State.Run); }
private void Populate() { for (int i = 0; i < 8; i++) { GameObject triggerObj = new GameObject("Cable Trigger " + (i + 1)); triggerObj.transform.SetParent(this.transform); triggerObj.transform.localScale = Vector3.one; triggerObj.tag = "CableTrigger"; triggerObj.layer = LayerMask.NameToLayer("UI"); TriggerController controller = triggerObj.AddComponent <TriggerController>(); controller.triggerID = i; Image triggerImage = triggerObj.AddComponent <Image>(); triggerImage.sprite = triggerSprite; BoxCollider2D triggerCollider = triggerObj.AddComponent <BoxCollider2D>(); triggerCollider.size = colliderSize; triggerCollider.isTrigger = true; } }
private void UpdateHoldProgress() { Trigger trigger = this.GetTrigger(); if (trigger == null || !trigger.CanExecuteActions() || this.IsExpanded()) { this.m_HoldProgress.fillAmount = 0f; if (this.m_LastHoldProgress != 0f) { TriggerController.Get().OnTriggerHoldEnd(TriggerAction.TYPE.None); } this.m_LastHoldProgress = 0f; return; } List <TriggerAction.TYPE> list = new List <TriggerAction.TYPE>(); trigger.GetActions(list); float fillAmount = 0f; for (int i = 0; i < list.Count; i++) { float actionHoldProgress = InputsManager.Get().GetActionHoldProgress(list[i]); if (actionHoldProgress > 0f) { if (this.m_LastHoldProgress == 0f) { TriggerController.Get().OnTriggerHoldStart(list[i]); } this.m_LastHoldProgress = actionHoldProgress; fillAmount = actionHoldProgress; break; } if (this.m_LastHoldProgress != 0f) { TriggerController.Get().OnTriggerHoldEnd(list[i]); this.m_LastHoldProgress = actionHoldProgress; } } this.m_HoldProgress.fillAmount = fillAmount; }
public override void OnReplicationPrepare() { base.OnReplicationPrepare(); Trigger bestTrigger = TriggerController.Get().GetBestTrigger(); GameObject gameObject = (bestTrigger != null) ? bestTrigger.gameObject : null; GameObject replObject = ReplicatedPlayerTrigger.GetReplObject(gameObject); if (this.m_BestTriggerReplObj != replObject) { this.m_BestTriggerReplObj = replObject; this.UpdateChildIdx(gameObject, this.m_BestTriggerChildIdx); } Trigger executedTrigger = this.GetExecutedTrigger(); GameObject gameObject2 = (executedTrigger != null) ? executedTrigger.gameObject : null; GameObject replObject2 = ReplicatedPlayerTrigger.GetReplObject(gameObject2); if (this.m_ExecutedTriggerReplObj != replObject2) { this.m_ExecutedTriggerReplObj = replObject2; this.UpdateChildIdx(gameObject2, this.m_BestTriggerChildIdx); } }
void UpdateTriggers(TriggerController con) { Debug.Log("Updating triggers"); Transform triggerParent = con.transform.GetChild(0); int size = triggerParent.childCount; TriggerChapter[] childrens = triggerParent.GetComponentsInChildren <TriggerChapter>(); con.sectionList = childrens; bool res; for (int i = 0; i < size; i++) { res = childrens[i].SetupTriggers(true); if (res) { EditorUtility.SetDirty(childrens[i]); } } EditorUtility.SetDirty(con); EditorSceneManager.MarkSceneDirty(con.gameObject.scene); }
public override void OnInspectorGUI() { if (GUILayout.Button("生成交互区域")) { foreach (var item in targets) { DoorController itriggerDelegate = item as DoorController; GameObject gameObject = itriggerDelegate.gameObject; Debug.Assert(gameObject != null); Bounds bounds = gameObject.GetColliderBounds(new List <string>() { "Interact" }); bounds.center = new Vector3(bounds.center.x - gameObject.transform.position.x, bounds.center.y - gameObject.transform.position.y, bounds.center.z - gameObject.transform.position.z); // 创建交互区域 add by TangJian 2018/01/02 21:26:35 { float scale = 1f; GameObject interactObject = gameObject.GetChild("Interact", true); interactObject.transform.localScale = new Vector3(1, 1, 1) * scale; interactObject.transform.localPosition = Vector3.zero; interactObject.transform.localEulerAngles = Vector3.zero; interactObject.layer = LayerMask.NameToLayer("Interaction"); BoxCollider boxCollider = interactObject.AddComponentUnique <BoxCollider>(); boxCollider.isTrigger = true; boxCollider.size = bounds.size; boxCollider.center = bounds.center; TriggerController triggerController = interactObject.AddComponentUnique <TriggerController>(); } } } }
public override void OnInspectorGUI() { TriggerController controller = target as TriggerController; DrawDefaultInspector(); if (GUILayout.Button("Update Triggers")) { UpdateTriggers(controller); } GUILayout.Space(20); Constants.CHAPTER cChapter = (Constants.CHAPTER)controller.currentChapter.value; cChapter = (Constants.CHAPTER)EditorGUILayout.EnumPopup("Current Chapter", (Constants.CHAPTER)cChapter); controller.currentChapter.value = (int)cChapter; Constants.SCENE_INDEXES cArea = (Constants.SCENE_INDEXES)controller.currentScene.value; cArea = (Constants.SCENE_INDEXES)EditorGUILayout.EnumPopup("Current Area", (Constants.SCENE_INDEXES)cArea); controller.currentScene.value = (int)cArea; controller.currentPlayerArea.value = controller.currentScene.value; Constants.ROOMNUMBER cRoom = (Constants.ROOMNUMBER)controller.currentRoomNumber.value; cRoom = (Constants.ROOMNUMBER)EditorGUILayout.EnumPopup("Room Number", (Constants.ROOMNUMBER)cRoom); controller.currentRoomNumber.value = (int)cRoom; GUILayout.Space(20); if (GUILayout.Button("Reactivate", GUILayout.Height(50))) { ReactivateTriggers(controller); } if (GUILayout.Button("Verify trigger IDs")) { VerifyTriggers(controller); } }
public IEnumerator GreenWallShouldCloseWhenGreenLeavesTriggerAndGateCloseOnTriggerIsEnabled() { _gameHandler.SpawnNewPlayer(Player.Green); TriggerController tc = GameObject.Find("GreenTrigger").GetComponent <TriggerController>(); tc.closeOnExit = true; PlayerController pc = _gameHandler.GetPlayerController(Player.Green); GateController GreenGate = GameObject.Find("GreenGate").GetComponent <GateController>(); Vector3 GreenGateStartPosition = GreenGate.transform.position; //Setting the easeMethod and animation time to be faster GreenGate.easeMethod = LeanTweenType.linear; GreenGate.animationTime = 0.3f; Vector2 greenTriggerPos = new Vector2(10, 6); pc.MoveToPos(greenTriggerPos.x, greenTriggerPos.y); while (pc.GetPosition() != greenTriggerPos) { yield return(null); } yield return(new WaitForSeconds(waitTime)); //Making sure the wall actually moved Assert.That(GreenGate.transform.position != GreenGateStartPosition); pc.MovePlayer(Direction.Left); yield return(new WaitForSeconds(waitTime)); //testing if it have moved back Assert.That(GreenGate.transform.position == GreenGateStartPosition); }
void VerifyTriggers(TriggerController con) { Debug.Log("Verify triggers"); Dictionary <string, string> foundIDs = new Dictionary <string, string>(); Transform triggerParent = con.transform.GetChild(0); bool changed = false; int size = triggerParent.childCount; for (int i = 0; i < size; i++) { Transform child = triggerParent.GetChild(i); Debug.Log("Checking child " + child.name); UUID[] uuids = child.GetComponentsInChildren <UUID>(true); for (int j = 0; j < uuids.Length; j++) { if (foundIDs.ContainsKey(uuids[j].uuid)) { Debug.LogWarning(string.Format("Duplicate key: {0}", uuids[j].uuid)); uuids[j].uuid = System.Guid.NewGuid().ToString(); changed = true; } else { foundIDs.Add(uuids[j].uuid, child.name); } } } if (changed) { EditorUtility.SetDirty(con); EditorSceneManager.MarkSceneDirty(con.gameObject.scene); } Debug.Log("Verify triggers - DONE"); }
// Use this for initialization void Start() { telemetry = gameObject.GetComponent <Telemetry>(); triggerController = gameObject.GetComponent <TriggerController>(); xrrig = GameObject.FindWithTag("xrrig"); string Todaysdate = DateTime.Now.ToString("dd-MMM-yyyy-hh-mm"); if (!Directory.Exists("C:\\Users\\Adam\\Desktop\\OculusOutput\\" + Todaysdate)) { Directory.CreateDirectory("C:\\Users\\Adam\\Desktop\\OculusOutput\\" + Todaysdate); } subjectPath = "C:\\Users\\Adam\\Desktop\\OculusOutput\\" + Todaysdate; Debug.Log(subjectPath); if (trialNumber == -1) // intro { introText.SetActive(true); preTrialText.SetActive(false); } else if (trialNumber < nHeadTrials) { preTrialText.SetActive(true); preTrialText.GetComponent <TextMesh>().text = noHeadstr + "\nTrial " + (trialNumber + 1).ToString() + "/" + nTrials.ToString(); } else if (trialNumber >= nHeadTrials && trialNumber < 60) { preTrialText.SetActive(true); preTrialText.GetComponent <TextMesh>().text = yesHeadstr + "\nTrial " + (trialNumber + 1).ToString() + "/" + nTrials.ToString(); } else { preTrialText.SetActive(true); preTrialText.GetComponent <TextMesh>().text = mousestr + "\nTrial " + (trialNumber + 1).ToString() + "/" + nTrials.ToString(); } }
protected virtual bool CanBlock() { return(!FightController.s_BlockFight && !this.m_WasBlockBroken && !SwimController.Get().IsActive() && !Inventory3DManager.Get().gameObject.activeSelf&& !WatchController.Get().IsActive() && !MapController.Get().IsActive() && !TriggerController.Get().IsGrabInProgress() && !Player.Get().m_Aim&& !CraftingController.Get().IsActive() && !Player.Get().m_Animator.GetBool(TriggerController.Get().m_BDrinkWater) && this.m_LastBlockTime <= Time.time - (PlayerConditionModule.Get().IsLowStamina() ? 1f : 0.5f) && !ScenarioManager.Get().IsDream() && !ScenarioManager.Get().IsBoolVariableTrue("PlayerMechGameEnding")); }
void Start () { activated = false; controller = transform.parent.GetComponent<TriggerController>(); material = gameObject.GetComponent<MeshRenderer>().material; originalColor = material.color; }
public void onSnakeEnter(TriggerController tc) { hitCounts++; update(); }
protected virtual bool CanBlock() { return(!PlayerConditionModule.Get().IsStaminaCriticalLevel() && !SwimController.Get().IsActive() && !Inventory3DManager.Get().gameObject.activeSelf&& !WatchController.Get().IsActive() && !MapController.Get().IsActive() && !TriggerController.Get().IsGrabInProgress() && !Player.Get().m_Aim); }
// Use this for initialization void Start() { gameController = gameObject.GetComponent <gameController>(); telemetry = gameObject.GetComponent <Telemetry>(); triggerController = gameObject.GetComponent <TriggerController>(); }
private bool CanVomit() { return((Debug.isDebugBuild && Input.GetKey(KeyCode.RightControl) && Input.GetKeyDown(KeyCode.V)) || (Time.time >= this.m_NextVomitingTime && !TriggerController.Get().m_TriggerInAction&& !SleepController.Get().IsActive())); }
public override Vector3 GetIconPos() { return(TriggerController.Get().GetBestTriggerHitPos()); }
public void onSnakeExit(TriggerController tc) { hitCounts--; update(); }
protected override bool ShouldShow() { return(!TriggerController.Get().IsGrabInProgress() && this.m_Active); }
private void UpdateBestTrigger() { if (HUDReadableItem.Get() != null && HUDReadableItem.Get().enabled) { this.ResetTrigger(); return; } if (this.m_CameraMain == null) { this.ResetTrigger(); this.m_CameraMain = Camera.main; return; } if (CutscenesManager.Get().IsCutscenePlaying()) { this.ResetTrigger(); return; } if (MakeFireController.Get().IsActive() && (MakeFireController.Get().ShouldBlockTriggers() || !Inventory3DManager.Get().gameObject.activeSelf)) { this.ResetTrigger(); return; } if (CraftingController.Get().IsActive() && CraftingController.Get().m_InProgress) { this.ResetTrigger(); return; } if (this.m_Player.m_ActiveFightController && (this.m_Player.m_ActiveFightController.IsBlock() || this.m_Player.m_ActiveFightController.IsAttack())) { this.ResetTrigger(); return; } if (VomitingController.Get().IsActive()) { this.ResetTrigger(); return; } if (HUDItem.Get().m_Active&& HUDItem.Get().m_Item) { this.SetBestTrigger(HUDItem.Get().m_Item, HUDItem.Get().m_Item.transform.position); return; } if (Inventory3DManager.Get().gameObject.activeSelf) { if (!Inventory3DManager.Get().m_FocusedItem) { this.ResetTrigger(); return; } if (BodyInspectionController.Get().IsActive() && Inventory3DManager.Get().m_FocusedItem.IsStorage()) { this.ResetTrigger(); return; } this.SetBestTrigger(Inventory3DManager.Get().m_FocusedItem, Inventory3DManager.Get().m_FocusedItem.transform.position); return; } else { if (BodyInspectionController.Get().IsActive()) { this.ResetTrigger(); return; } if (Player.Get().m_Aim) { this.ResetTrigger(); return; } if (HUDWheel.Get().m_Active) { this.ResetTrigger(); return; } if (this.m_Animator.GetBool(Player.Get().m_CleanUpHash)) { this.ResetTrigger(); return; } if (this.m_Animator.GetBool(TriggerController.Get().m_BDrinkWater)) { this.ResetTrigger(); return; } if (WeaponSpearController.Get().IsActive() && WeaponSpearController.Get().m_ItemBody) { this.SetBestTrigger(WeaponSpearController.Get().m_ItemBody, WeaponSpearController.Get().m_ItemBody.transform.position); return; } TriggerController.s_AllPotentialTriggers.Clear(); TriggerController.s_OffCrosshairTriggers.Clear(); TriggerController.s_ColldersEnabledMap.Clear(); Vector3 crossHairOrigin = this.GetCrossHairOrigin(); Vector3 position = Player.Get().transform.position; float num = 0.8f; float num2 = -1f; float num3 = -1f; float num4 = float.MinValue; Vector3 vector = Vector3.zero; Vector3 vector2 = Vector3.zero; TriggersManager triggersManager = TriggersManager.Get(); bool flag = false; Trigger trigger = null; Vector3 hit_pos = Vector3.zero; Trigger trigger2 = null; Vector3 hit_pos2 = Vector3.zero; float num5 = float.MinValue; HashSet <Trigger> .Enumerator enumerator = triggersManager.GetActiveTriggers().GetEnumerator(); Item currentItem = Player.Get().GetCurrentItem(); while (enumerator.MoveNext()) { Trigger trigger3 = enumerator.Current; if (trigger3 != null && trigger3.enabled && !trigger3.m_IsCut && trigger3.m_Initialized && trigger3.CanTrigger() && (!currentItem || currentItem.GetInfoID() != ItemID.Fire || trigger3.IsFIrecamp() || trigger3.IsCharcoalFurnace() || trigger3.IsForge())) { Collider collider = null; trigger3.gameObject.GetComponents <Collider>(TriggerController.s_ColliderCache); if (TriggerController.s_ColliderCache.Count > 0) { collider = TriggerController.s_ColliderCache[0]; } if (collider != null) { if (trigger3.CheckInsideCollider() && collider.bounds.Contains(this.m_CameraMain.transform.position) && trigger3.IsAdditionalTrigger() && (!trigger3.CheckDot() || num4 > num3)) { hit_pos2 = collider.bounds.center; trigger2 = trigger3; num3 = num4; } float num6 = (trigger3.m_TriggerCheckRange > 0f) ? trigger3.m_TriggerCheckRange : this.m_Player.GetParams().GetTriggerCheckRange(); if (trigger3.CheckRange()) { vector2 = ((collider != null) ? collider.ClosestPointOnBounds(position) : trigger3.gameObject.transform.position); if (Vector3.Distance(position, vector2) > num6) { continue; } } vector2 = ((collider != null) ? collider.bounds.center : trigger3.gameObject.transform.position); vector = vector2 - crossHairOrigin; vector.Normalize(); if (trigger3.CheckDot()) { num4 = Vector3.Dot(this.m_CameraMain.transform.forward, vector); if (num4 < num || (trigger3.m_TriggerMaxDot > 0f && num4 < trigger3.m_TriggerMaxDot)) { continue; } } TriggerController.s_AllPotentialTriggers.Add(trigger3); if (!trigger3.OnlyInCrosshair()) { TriggerController.s_OffCrosshairTriggers.Add(trigger3); } TriggerController.s_ColldersEnabledMap[collider] = collider.enabled; collider.enabled = true; if (num6 > num5) { num5 = num6; } } } } Vector3 crossHairDir = this.GetCrossHairDir(); int num7 = (num5 > 0f) ? Physics.RaycastNonAlloc(crossHairOrigin, crossHairDir, TriggerController.s_RaycastHitCache, num5) : 0; if (num7 > 0) { TriggerController.s_CrosshairOrigin = crossHairOrigin; Array.Sort <RaycastHit>(TriggerController.s_RaycastHitCache, 0, num7, TriggerController.s_DistComparer); for (int i = 0; i < TriggerController.s_AllPotentialTriggers.Count; i++) { Trigger trigger4 = TriggerController.s_AllPotentialTriggers[i]; Collider collider2 = null; trigger4.gameObject.GetComponents <Collider>(TriggerController.s_ColliderCache); if (TriggerController.s_ColliderCache.Count > 0) { collider2 = TriggerController.s_ColliderCache[0]; } if (collider2 != null) { for (int j = 0; j < num7; j++) { RaycastHit raycastHit = TriggerController.s_RaycastHitCache[j]; if (raycastHit.collider != null && !(raycastHit.collider.gameObject == base.gameObject) && !(raycastHit.collider == FistFightController.Get().m_RightHandCollider) && !(raycastHit.collider == FistFightController.Get().m_LeftHandCollider) && !(raycastHit.collider.gameObject == this.m_Proxy.m_Controller.gameObject)) { GhostSlot ghostSlot = null; raycastHit.collider.gameObject.GetComponents <GhostSlot>(TriggerController.s_GhostSlotCache); if (TriggerController.s_GhostSlotCache.Count > 0) { ghostSlot = TriggerController.s_GhostSlotCache[0]; } if (!flag || ghostSlot != null || trigger4.IsAdditionalTrigger()) { if (collider2 == raycastHit.collider || trigger4.IsAdditionalCollider(raycastHit.collider)) { if (trigger4.IsAdditionalTrigger()) { if (!trigger4.CheckDot() || num4 > num3 || (trigger4.m_TriggerMaxDot > 0f && num4 >= trigger4.m_TriggerMaxDot)) { hit_pos2 = raycastHit.point; trigger2 = trigger4; num3 = num4; break; } break; } else { if (trigger4.CheckDot() && num4 < num2 && (trigger4.m_TriggerMaxDot <= 0f || num4 < trigger4.m_TriggerMaxDot)) { break; } hit_pos = raycastHit.point; trigger = trigger4; if (!trigger || !trigger.IsLiquidSource()) { num2 = num4; break; } break; } } else { ITriggerThrough triggerThrough = null; raycastHit.collider.gameObject.GetComponents <ITriggerThrough>(TriggerController.s_TriggerThroughCache); if (TriggerController.s_TriggerThroughCache.Count > 0) { triggerThrough = TriggerController.s_TriggerThroughCache[0]; } if (triggerThrough == null && !raycastHit.collider.gameObject.GetComponent <TriggerThrough>() && (!trigger || !trigger.IsLiquidSource() || !(trigger.gameObject == raycastHit.collider.gameObject))) { if (ghostSlot != null) { flag = true; } else { Item currentItem2 = this.m_Player.GetCurrentItem(Hand.Right); if (currentItem2 == null || !(currentItem2.gameObject == raycastHit.collider.gameObject)) { currentItem2 = this.m_Player.GetCurrentItem(Hand.Left); if ((currentItem2 == null || !(currentItem2.gameObject == raycastHit.collider.gameObject)) && !(raycastHit.collider.gameObject == this.m_Proxy.m_Controller.gameObject)) { Trigger trigger5 = null; raycastHit.collider.gameObject.GetComponents <Trigger>(TriggerController.s_OtherTriggerCache); if (TriggerController.s_OtherTriggerCache.Count > 0) { trigger5 = TriggerController.s_OtherTriggerCache[0]; } if (trigger5 == null || !trigger5.TriggerThrough()) { break; } } } } } } } } } } } } if (trigger == null || trigger.IsLiquidSource()) { TriggerController.s_CrosshairDir = crossHairDir; TriggerController.s_CrosshairOrigin = crossHairOrigin; TriggerController.s_OffCrosshairTriggers.Sort(TriggerController.s_DotComparer); bool flag2 = false; int num8 = 0; while (num8 < TriggerController.s_OffCrosshairTriggers.Count && !flag2) { Trigger trigger6 = TriggerController.s_OffCrosshairTriggers[num8]; Collider collider3 = null; trigger6.gameObject.GetComponents <Collider>(TriggerController.s_ColliderCache); if (TriggerController.s_ColliderCache.Count > 0) { collider3 = TriggerController.s_ColliderCache[0]; } if (collider3 != null) { float maxDistance = (trigger6.m_TriggerCheckRange > 0f) ? trigger6.m_TriggerCheckRange : this.m_Player.GetParams().GetTriggerCheckRange(); vector2 = ((collider3 != null) ? collider3.bounds.center : trigger6.gameObject.transform.position); vector = vector2 - crossHairOrigin; vector.Normalize(); num7 = Physics.RaycastNonAlloc(crossHairOrigin, vector, TriggerController.s_RaycastHitCache, maxDistance); if ((float)num7 > 0f) { TriggerController.s_CrosshairOrigin = crossHairOrigin; Array.Sort <RaycastHit>(TriggerController.s_RaycastHitCache, 0, num7, TriggerController.s_DistComparer); for (int k = 0; k < num7; k++) { RaycastHit raycastHit2 = TriggerController.s_RaycastHitCache[k]; if (!(raycastHit2.collider.gameObject == base.gameObject)) { GhostSlot ghostSlot2 = null; raycastHit2.collider.gameObject.GetComponents <GhostSlot>(TriggerController.s_GhostSlotCache); if (TriggerController.s_GhostSlotCache.Count > 0) { ghostSlot2 = TriggerController.s_GhostSlotCache[0]; } if (!flag || ghostSlot2 != null || trigger6.IsAdditionalTrigger()) { if (collider3 == raycastHit2.collider) { if (!trigger6.CheckDot() || num4 > num2 || (trigger6.m_TriggerMaxDot > 0f && num4 >= trigger6.m_TriggerMaxDot)) { hit_pos = raycastHit2.point; trigger = trigger6; num2 = num4; flag2 = true; break; } break; } else { ITriggerThrough triggerThrough2 = null; raycastHit2.collider.gameObject.GetComponents <ITriggerThrough>(TriggerController.s_TriggerThroughCache); if (TriggerController.s_TriggerThroughCache.Count > 0) { triggerThrough2 = TriggerController.s_TriggerThroughCache[0]; } if (triggerThrough2 == null && raycastHit2.collider.gameObject.layer != this.m_BalanceSpawnerLayer && (trigger == null || !trigger.IsLiquidSource() || !(trigger.gameObject == raycastHit2.collider.gameObject))) { if (ghostSlot2 != null) { flag = true; } else { Item currentItem3 = this.m_Player.GetCurrentItem(Hand.Right); if (currentItem3 == null || !(currentItem3.gameObject == raycastHit2.collider.gameObject)) { currentItem3 = this.m_Player.GetCurrentItem(Hand.Left); if (currentItem3 == null || !(currentItem3.gameObject == raycastHit2.collider.gameObject)) { Trigger trigger7 = null; raycastHit2.collider.gameObject.GetComponents <Trigger>(TriggerController.s_OtherTriggerCache); if (TriggerController.s_OtherTriggerCache.Count > 0) { trigger7 = TriggerController.s_OtherTriggerCache[0]; } if (trigger7 == null || !trigger7.TriggerThrough()) { if (trigger7 != null && TriggerController.s_OffCrosshairTriggers.Contains(trigger7)) { trigger = trigger7; hit_pos = raycastHit2.point; flag2 = true; break; } break; } } } } } } } } } } } num8++; } } Trigger trigger8 = null; if (trigger != this.m_BestTrigger.trigger && this.m_BestTrigger.trigger) { trigger8 = this.m_BestTrigger.trigger; } this.SetBestTrigger(trigger, hit_pos); if (trigger) { trigger.UpdateLayer(); } if (trigger8) { trigger8.UpdateLayer(); } if (this.m_AdditionalTrigger.trigger != trigger2) { if (trigger2 != this.m_AdditionalTrigger.trigger && this.m_AdditionalTrigger.trigger) { trigger8 = this.m_AdditionalTrigger.trigger; } this.m_AdditionalTrigger.trigger = trigger2; this.m_AdditionalTrigger.actions.Clear(); if (this.m_AdditionalTrigger.trigger) { this.m_AdditionalTrigger.trigger.GetActions(this.m_AdditionalTrigger.actions); } this.m_AdditionalTrigger.hit_pos = hit_pos2; if (this.m_AdditionalTrigger.trigger) { this.m_AdditionalTrigger.trigger.UpdateLayer(); } if (trigger8) { trigger8.UpdateLayer(); } } foreach (KeyValuePair <Collider, bool> keyValuePair in TriggerController.s_ColldersEnabledMap) { Collider key = keyValuePair.Key; Dictionary <Collider, bool> .Enumerator enumerator2; keyValuePair = enumerator2.Current; key.enabled = keyValuePair.Value; } return; } }
private bool CanStartDialog() { return(!ConsciousnessController.Get().IsActive() && !HarvestingAnimalController.Get().IsActive() && !HarvestingSmallAnimalController.Get().IsActive() && !TriggerController.Get().IsGrabInProgress()); }
protected override bool ShouldShow() { return(!TriggerController.Get().IsGrabInProgress() && ((this.IsExpanded() && this.m_TriggerType == HUDTrigger.TriggerType.Normal) || (this.GetTrigger() && this.GetTrigger().CanTrigger() && (!Inventory3DManager.Get().IsActive() || !Inventory3DManager.Get().m_CarriedItem) && (this.m_TriggerType == HUDTrigger.TriggerType.Normal || !Inventory3DManager.Get().gameObject.activeSelf)))); }
private void UpdateState() { if (PlayerConditionModule.Get().GetStamina() == 0f) { this.m_Animator.SetBool(this.m_Arrow ? this.m_LowStaminaHash : this.m_NoArrowLowStaminaHash, true); this.SetState(this.m_Arrow ? BowController.State.LowStamina : BowController.State.NoArrowLowStamina); } switch (this.m_State) { case BowController.State.Idle: if (!Inventory3DManager.Get().gameObject.activeSelf) { this.UpdateArrowFromInventory(); if (this.m_Arrow == null) { this.SetState(BowController.State.NoArrowIdle); } } break; case BowController.State.AimLoop: if (this.m_MaxAim && PlayerConditionModule.Get().IsStaminaCriticalLevel()) { this.StartShake(); this.m_MaxAim = false; } if (PlayerConditionModule.Get().IsStaminaCriticalLevel()) { Player.Get().m_AdditionalShakePower += (1f - Player.Get().m_AdditionalShakePower) * Time.deltaTime * 0.5f; } if (TriggerController.Get().IsGrabInProgress() || this.m_Player.IsRunning()) { this.SetState(BowController.State.Idle); } else if (Time.time - this.m_EnterStateTime > 2f) { float num = PlayerConditionModule.Get().GetStaminaDecrease(StaminaDecreaseReason.Bow) * Skill.Get <ArcherySkill>().GetStaminaConsumptionMul(); this.m_Player.DecreaseStamina(num * Time.deltaTime * (this.m_MaxAim ? 2f : 1f)); if (PlayerConditionModule.Get().GetStamina() == 0f) { this.SetState(BowController.State.Idle); } } break; case BowController.State.NoArrowIdle: this.UpdateArrowFromInventory(); if (this.m_Arrow != null) { this.SetState(BowController.State.Idle); } break; case BowController.State.LowStamina: case BowController.State.NoArrowLowStamina: if (!PlayerConditionModule.Get().IsLowStamina()) { this.SetState((this.m_Arrow != null) ? BowController.State.Idle : BowController.State.NoArrowIdle); this.m_Animator.SetBool(this.m_LowStaminaHash, false); } break; } this.m_Animator.SetInteger(this.m_IBowState, (int)this.m_State); }