예제 #1
0
        private void IncreaseCombo()
        {
            Combo++;
            if (GreatestCombo < Combo)
            {
                GreatestCombo = Combo;
            }

            onComboChange?.Invoke();

            UpdateMultiplier();
        }
예제 #2
0
        public void AddHP(float amount)
        {
            if (Failed)
            {
                return;
            }

            _currentHealth += amount;
            if (_currentHealth >= _maxHealth)
            {
                _currentHealth = _maxHealth;
            }

            onHealthChange?.Invoke();
        }
예제 #3
0
        public override void OnLineStatusChanged(LocalizedLine dialogueLine)
        {
            switch (dialogueLine.Status)
            {
            case LineStatus.Running:
                // No-op; this line is running
                break;

            case LineStatus.Interrupted:
                // The line is now interrupted, and we need to hurry up
                // in our delivery
                finishCurrentLine = true;
                break;

            case LineStatus.Delivered:
                // The line has now finished its delivery across all
                // views, so we can signal call our UnityEvent for it
                onLineFinishDisplaying?.Invoke();
                break;

            case LineStatus.Ended:
                // The line has now Ended. DismissLine will be called
                // shortly.
                onLineEnd?.Invoke();
                break;
            }
        }
예제 #4
0
        /// Show a line of dialogue, gradually
        private IEnumerator DoRunLine(Yarn.Line line, ILineLocalisationProvider localisationProvider, System.Action onComplete)
        {
            onLineStart?.Invoke();

            userRequestedNextLine = false;

            // The final text we'll be showing for this line.
            string text = localisationProvider.GetLocalisedTextForLine(line);

            if (text == null)
            {
                Debug.LogWarning($"Line {line.ID} doesn't have any localised text.");
                text = line.ID;
            }

            if (textSpeed > 0.0f)
            {
                // Display the line one character at a time
                var stringBuilder = new StringBuilder();

                foreach (char c in text)
                {
                    stringBuilder.Append(c);
                    onLineUpdate?.Invoke(stringBuilder.ToString());
                    if (userRequestedNextLine)
                    {
                        // We've requested a skip of the entire line.
                        // Display all of the text immediately.
                        onLineUpdate?.Invoke(text);
                        break;
                    }
                    yield return(new WaitForSeconds(textSpeed));
                }
            }
            else
            {
                // Display the entire line immediately if textSpeed <= 0
                onLineUpdate?.Invoke(text);
            }

            // We're now waiting for the player to move on to the next line
            userRequestedNextLine = false;

            // Indicate to the rest of the game that the line has finished being delivered
            onLineFinishDisplaying?.Invoke();

            while (userRequestedNextLine == false)
            {
                yield return(null);
            }

            // Avoid skipping lines if textSpeed == 0
            yield return(new WaitForEndOfFrame());

            // Hide the text and prompt
            onLineEnd?.Invoke();

            onComplete();
        }
예제 #5
0
 internal void CheckInput(vItem item, UnityEngine.Events.UnityEvent onEquip)
 {
     if (input.GetButtonDown())
     {
         Equip(item);
         onEquip?.Invoke();
     }
 }
예제 #6
0
        public void PlayNextRound()
        {
            onGameplayEvent?.Invoke(new EventTest());

            turnOrder.Clear();
            //iterate though tiles and capture units order
            foreach (var tile in IterateTileFromCenter())
            {
                if (mapTileToUnit.ContainsKey(tile) == false)
                {
                    continue;
                }
                var unit = mapTileToUnit[tile];
                if (unit != null && unit.dead == false)
                {
                    turnOrder.Add(unit);
                }
            }

            foreach (var unit in turnOrder)
            {
                unit.countered = false;
            }

            //foreach unit in the unit order
            foreach (var unit in turnOrder)
            {
                PlayUnitTurn(unit);
            }

            int attackerCount = 0;
            int defenderCount = 0;

            foreach (var unit in turnOrder)
            {
                RemoveDeadUnit(unit);
                if (unit.dead)
                {
                    continue;
                }

                if (unit.attacker)
                {
                    attackerCount++;
                }
                else
                {
                    defenderCount++;
                }
            }

            UpdateReport();
            if (attackerCount == 0 || defenderCount == 0)
            {
                onGameover?.Invoke();
            }
        }
예제 #7
0
 private void CancelButtonTimer()
 {
     DebugAction("Cancel Action ");
     triggerAction.OnCancelActionInput.Invoke();
     _currentInputDelay = triggerAction.inputDelay;
     triggerAction.UpdateButtonTimer(0);
     OnCancelAction.Invoke();
     ResetActionState();
     ResetTriggerSettings();
 }
 private void OpenDesk()
 {
     m_bIsOpen = true;
     if (m_onOpen != null)
     {
         m_onOpen.Invoke();
     }
     EnableIncludeObject();
     m_bIsAblePulling = true;
 }
        public void SelectWorker(TaskWorkerAI worker)
        {
            DeselectWorker();

            SelectedWorker = worker;

            UpdateInformation();

            onSelectEvent?.Invoke();
        }
예제 #10
0
        private void OnCollisionEnter(Collision collision)
        {
            if (collision.gameObject.CompareTag(playerTag))
            {
                // Take player back to hell
                onCaughtPlayer?.Invoke();

                chasingPlayer = false;
            }
        }
예제 #11
0
        /// Called when the dialogue system has finished running.
        public override void DialogueComplete()
        {
            onDialogueEnd?.Invoke();

            // Hide the dialogue interface.
            if (dialogueContainer != null)
            {
                dialogueContainer.SetActive(false);
            }
        }
예제 #12
0
        /* ======================================== *\
         *           GETTERS AND SETTERS            *
        \* ======================================== */

        #endregion

        #region Functions 

        /* ======================================== *\
         *                FUNCTIONS                 *
        \* ======================================== */
        private void Update()
        {
            if(enemyController.CharacterStatController.Scratch > 10f)
            {
                unityEvent.Invoke();
                Destroy(this.gameObject);

            }

        }
예제 #13
0
        public virtual void SetAmount(int value)
        {
            currentThrowObject += value;
            if (ui)
            {
                ui.UpdateCount(this);
            }

            onCollectObject.Invoke();
        }
예제 #14
0
        /// Called when the dialogue system has finished running.
        /// <inheritdoc/>
        public override void DialogueComplete()
        {
            onDialogueEnd?.Invoke();

            // Fade out the dialogue box
            if (dialogueContainer != null)
            {
                Hide();
            }
        }
        public virtual IEnumerator DestroyActionDelay(vTriggerGenericAction triggerAction)
        {
            var _triggerAction = triggerAction;

            yield return(new WaitForSeconds(_triggerAction.destroyDelay));

            OnEndAction.Invoke();
            ResetTriggerSettings();
            Destroy(_triggerAction.gameObject);
        }
예제 #16
0
 public void Victory()
 {
     switch (Manager.GameStatus)
     {
     case GameStatus.Playing:
         Manager.SetGameStatus(GameStatus.Victory);
         VictoryEvent.Invoke();
         break;
     }
 }
예제 #17
0
        /// Called when the dialogue system has started running.
        public override void DialogueStarted()
        {
            // Enable the dialogue controls.
            if (dialogueContainer != null)
            {
                dialogueContainer.SetActive(true);
            }

            onDialogueStart?.Invoke();
        }
예제 #18
0
        /// Called when the dialogue system has started running.
        public override void DialogueStarted()
        {
            Debug.Log("Play opening animation");
            // Enable the dialogue controls.
            if (dialogueContainer != null)
            {
                dialogueContainer.SetActive(true);
            }

            onDialogueStart?.Invoke();
        }
예제 #19
0
 virtual public void ExitGame()
 {
     Debug.LogWarning("ExitGame()");
     if (f_ExitGame)
     {
         return;
     }
     f_ExitGame = true;
     m_ExitGameEvent?.Invoke();
     StartCoroutine(ExitGameCoroutine());
 }
예제 #20
0
 public void EndCinematic()
 {
     unityEvent.Invoke();
     enemyManager.ResetQueue();
     jill.InterruptBehavior();
     chris.InterruptBehavior();
     enemyManager.ShowHealthBars(true);
     cameraLock.transform.SetParent(null);
     cameraLock.enabled = true;
     Destroy(this.gameObject);
 }
예제 #21
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Enemy"))
     {
         collision.GetComponent <ShootBehavior>().enabled = true;
     }
     else if (collision.CompareTag("Chunk"))
     {
         _OnChunkEnter.Invoke();
     }
 }
예제 #22
0
        public void StartGame()
        {
            if (gameStarted == true)
            {
                return;
            }

            onStart?.Invoke();

            gameStarted = true;
        }
 public void OpenCloseInventory(bool value)
 {
     if (value)
     {
         onOpen.Invoke();
     }
     else
     {
         onClose.Invoke();
     }
 }
예제 #24
0
        /// Called when the dialogue system has finished running.
        public override void DialogueComplete()
        {
            Debug.Log("Play close animation");
            onDialogueEnd?.Invoke();

            // Hide the dialogue interface.
            if (dialogueContainer != null)
            {
                dialogueContainer.SetActive(false);
            }
        }
예제 #25
0
 protected virtual void CheckItem(vItemManager itemManager)
 {
     if (getItemByName)
     {
         // VERIFY IF YOU HAVE A SPECIFIC ITEM IN YOUR INVENTORY
         if (itemManager.ContainItem(itemName))
         {
             // AUTOMATICALLY EQUIP THE ITEM IF YOU HAVE IT
             //
             // - vItem can be access using the itemManager.GetItem(itemName)
             // - indexArea is the equipmentArea that you want to equip the item, for example 0 is RightArm, 1 is LeftArm, 2 is Consumable.
             // - Immediate is true to instantly equip the weapon or false to trigger the equip animation.
             itemManager.AutoEquipItem(itemManager.GetItem(itemName), 0, false);
             // trigger OnContains Event
             onContains.Invoke();
         }
         else
         {
             onNotContains.Invoke();
         }
     }
     else
     {
         // VERIFY IF YOU HAVE A SPECIFIC ITEM IN YOUR INVENTORY
         if (itemManager.ContainItem(itemID))
         {
             // AUTOMATICALLY EQUIP THE ITEM IF YOU HAVE IT
             //
             // - vItem can be access using the itemManager.GetItem(itemName)
             // - indexArea is the equipmentArea that you want to equip the item, for example 0 is RightArm, 1 is LeftArm, 2 is Consumable.
             // - Immediate is true to instantly equip the weapon or false to trigger the equip animation.
             itemManager.AutoEquipItem(itemManager.GetItem(itemID), 0, false);
             // trigger OnContains Event
             onContains.Invoke();
         }
         else
         {
             onNotContains.Invoke();
         }
     }
 }
예제 #26
0
        IEnumerator ShootEffect()
        {
            yield return(new WaitForSeconds(delayToSpringAfterShot));

            if (weapon.isAiming)
            {
                if (weapon.ammoCount > 0)
                {
                    OnFinishShot.Invoke();
                }
            }
        }
예제 #27
0
 private void Update()
 {
     if (IsPossessed && !possessionEventRan && eventEnabled)
     {
         e.Invoke();
         possessionEventRan = true;
     }
     else if (IsPossessed)
     {
         RatAnim();
     }
 }
예제 #28
0
        private void InvokeCallbackEnd()
        {
            if (null != _finishEvent)
            {
                _finishEvent.Invoke();
            }

            if (null != _eventEnd)
            {
                _eventEnd.Invoke();
            }
        }
예제 #29
0
 private void OnTriggerStay(Collider other)
 {
     if (/*button.GetButtonDown() ||*/ !pressButtonToChange)
     {
         var weaponManager = other.GetComponentInParent <vFPSWeaponManager>();
         if (weaponManager)
         {
             weaponManager.EquipWeapon(targetWeaponName);
             onChangeWeapon.Invoke();
         }
     }
 }
 void OnCollisionEnter(Collision c)
 {
     if (c.gameObject.tag == "Player" || wakeUpWithOtherObjects)
     {
         WakeUp();
         if (onTouched != null)
         {
             onTouched.Invoke();
         }
     }
     // collision = true;
 }