/// <summary> /// Called when a collider (with isTrigger set to true) enters this collider. /// </summary> /// <param name="collidingObject">Colliding object.</param> public virtual bool OnTriggerEnter(Collider collidingObject) { if (tagsToIgnore.Contains(collidingObject.gameObject.tag) && tagsToIgnore.Count > 0) { return(false); } // Check if events are targetted. if (collisionEnterEvent != null && targettedBroadcast) { collisionEnterEvent.RaiseEvent(collidingObject.gameObject.GetInstanceID()); } else if (collisionEnterEvent != null && !targettedBroadcast) { collisionEnterEvent.RaiseEvent(); } // Only return true if there are no other event cases. if (collisionExitEvent == null && collisionInsideEvent == null) { return(true); } return(false); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Return)) { startDialogue.RaiseEvent(); } }
private void Update() { // If there is no director, dont update anything if (m_currDirector == null) { return; } // If dialogue has not spawned yet, spawn when reached end of first clip if (!m_SpawnDialogueEvent.Value) { if (m_currDirector.time > m_clipEndTime) { m_SpawnDialogueEvent.RaiseEvent(true); } } // If dialogue is spawned, get that node's start and end timings if (m_currDirector.time > m_clipEndTime) { //Debug.Log("Its time to stop!" + m_currDirector.time + " Stop Time: " + m_clipEndTime); m_currDirector.Pause(); } // If timeline reached the end, raise event to spawn end overlay if (m_currDirector.time >= m_currDirector.duration - 0.05f) { Debug.Log("Entered here " + m_currDirector.duration); if (m_SpawnEndOverlayEvent != null) { m_SpawnEndOverlayEvent.RaiseEvent(); } } }
/// <summary> /// Unity Update Function /// </summary> private void Update() { /* If there is no swipe component, do not update movement */ if (m_swipeComponent == null) { return; } // Update State Machine if (m_stateMachine != null) { m_stateMachine.Update(); } // ---------- Player Damaged if (m_Animator.GetCurrentAnimatorStateInfo(0).IsName("Damaged")) { SpawnParticles(); return; } else { m_bSpawn = false; } if (!m_stateMachine.GetCurrentState().Equals("Idle")) { return; } // ---------- Player Win / Lose if (m_playerHealth.value <= 0) { m_stateMachine.SetNextState("PlayerLose"); m_spawnLoseScreen.RaiseEvent(); m_PlayerDiedEvent.RaiseEvent(); } else if (m_AIHealth.value <= 0) { m_stateMachine.SetNextState("PlayerVictory"); m_spawnWinScreen.RaiseEvent(); } // ---------- Player Movement ( only during Idle state ) if (m_bStunned) { m_swipeDirection.Value = 0; m_bTriggerJump = false; return; } if (!m_bButtonMode.value) { PlayerMovement((int)m_swipeComponent.SwipeDirection); } else { PlayerMovement(m_swipeDirection.Value); // Reset Swipe Direction to NONE, to prevent continuous updates m_swipeDirection.Value = 0; } }
/// <summary> /// Set something to happen when its the last instruction /// </summary> public void SetLastInstruction(bool _value) { if (!_value) { return; } // Remove the last instruction if (m_instruction.transform.GetChild(m_instruction.transform.childCount - 1) != null) { m_instruction.transform.GetChild(m_instruction.transform.childCount - 1).gameObject.SetActive(false); } // Set index to be child count m_instructionIndex.Value = m_instruction.transform.childCount; // Spawn any next UI if (m_setMainHUD != null) { m_setMainHUD.RaiseEvent(); } // Set intructions to be inactive gameObject.SetActive(false); }
/// <summary> /// Called when a collider (with isTrigger set to true) exits this collider. /// </summary> /// <param name="collidingObject">Colliding object.</param> public virtual bool OnTriggerExit(Collider collidingObject) { if (tagsToIgnore.Contains(collidingObject.gameObject.tag)) { return(false); } // Check if events are targetted. if (collisionExitEvent != null && targettedBroadcast) { collisionExitEvent.RaiseEvent(collidingObject.gameObject.GetInstanceID()); } else if (collisionEnterEvent != null && !targettedBroadcast) { collisionExitEvent.RaiseEvent(); } return(true); }
public override void OnInspectorGUI() { DrawDefaultInspector(); ES_Event_Abstract gameEvent = (ES_Event_Abstract)target; if (GUILayout.Button("Invoke Event")) { gameEvent.RaiseEvent(); } }
/// <summary> /// Changes the current node to the one at the provided index. /// </summary> /// <param name="index">Zero-based index of the node.</param> public void TraverseTree(int index = 0) { if (index >= 0 && index < currentNode.NextNodes.Length) { previousNode = currentNode; currentNode = currentNode.NextNodes[index]; previousNode.Exit(); currentNode.Enter(); changedNode.RaiseEvent(); if (currentNode.NextNodes.Length == 0) { dialogueEnd.RaiseEvent(); } } }
private void Update() { if (m_count == null) { return; } // If Countdown is done, start game if (m_countDownValue <= 0) { m_startGame.RaiseEvent(true); m_setMainHUD.RaiseEvent(); this.gameObject.SetActive(false); } // After private countdown is done, reduce a value from text m_countDownTime -= Time.deltaTime; if (m_countDownTime <= 0.0f) { // Reduce a count from number on UI SetCountDownValue(m_countDownValue - 1); } }
/// <summary> /// Call this when resetting game scenes /// </summary> public void ResetGame() { m_resetState.RaiseEvent(); m_setSpawner.RaiseEvent(true); m_resetHealth.RaiseEvent(); }