Пример #1
0
        private void AttackVolumeHitEventHandler(object sender, AttackVolumeEventArgs args)
        {
            BrawlerAction currentAction = Brawler.CurrentAction;

            currentAction.DidHit  = true;
            Brawler.CurrentAction = currentAction;
        }
Пример #2
0
        public bool Damage(Game.Actors.DamageData damageData)
        {
            if (ActionHandler.IsDead)
            {
                return(false);
            }

            Actors.DamageData dd = (Actors.DamageData)damageData;

            // did we block the damage?
            if (!dd.AttackData.Unblockable && Brawler.CurrentAction.IsBlocking && _blockVolume.Intersects(dd.Bounds))
            {
                if (BrawlerAction.ActionType.Parry == Brawler.CurrentAction.Type)
                {
                    Debug.Log($"TODO: Brawler {Owner.Id} can parry");
                }

                if (GameManager.Instance.DebugBrawlers)
                {
                    DisplayDebugText($"Blocked damage for {dd.AttackData.DamageAmount} (took {dd.AttackData.BlockDamageAmount})", Color.blue);
                }

                if (null != dd.SourceBrawlerActionHandler)
                {
                    BrawlerAction currentAction = Brawler.CurrentAction;
                    currentAction.WasBlocked = true;
                    Brawler.CurrentAction    = currentAction;
                }

                if (DoDamage(dd, true))
                {
                    return(true);
                }

                //_blockAudioEffectTriggerComponent.AudioClip = dd.AttackData.BlockAudioCip;
                _blockEffectTrigger.Trigger();

                ActionHandler.ClearActionBuffer();
                ActionHandler.OnHit(true);

                return(false);
            }

            if (GameManager.Instance.DebugBrawlers)
            {
                DisplayDebugText($"Damage: {dd.AttackData.DamageAmount}", Color.red);
            }

            CancelActions(false);

            DoDamage(dd, false);

            return(true);
        }
Пример #3
0
        private void HitAnimationEvent(TrackEntry trackEntry, Spine.Event evt)
        {
            BrawlerAction action = Brawler.CurrentAction;

            if (Brawler.BrawlerData.HitImpactEvent == evt.Data.Name)
            {
                // TODO: what do we do with this?
            }
            else if (Brawler.BrawlerData.HitStunEvent == evt.Data.Name)
            {
                action.IsStunned = true;
            }
            else if (Brawler.BrawlerData.HitImmunityEvent == evt.Data.Name)
            {
                action.IsImmune = true;
            }
            else
            {
                Debug.LogWarning($"Unhandled hit end event: {evt.Data.Name}");
            }

            Brawler.CurrentAction = action;
        }
Пример #4
0
        private void BlockBeginAnimationEvent(TrackEntry trackEntry, Spine.Event evt)
        {
            BrawlerAction action = Brawler.CurrentAction;

            if (Brawler.BrawlerData.BlockVolumeSpawnEvent == evt.Data.Name)
            {
                _blockVolume.EnableVolume(true);
            }
            else if (Brawler.BrawlerData.ParryWindowOpenEvent == evt.Data.Name)
            {
                action.Type = BrawlerAction.ActionType.Parry;
            }
            else if (Brawler.BrawlerData.ParryWindowCloseEvent == evt.Data.Name)
            {
                action.Type = BrawlerAction.ActionType.Block;
            }
            else
            {
                Debug.LogWarning($"Unhandled block begin event: {evt.Data.Name}");
            }

            Brawler.CurrentAction = action;
        }
Пример #5
0
            public IComboEntry NextEntry(CharacterBehaviorComponent.CharacterBehaviorAction action, IComboEntry previousMove, BrawlerAction currentAction)
            {
                if (action is DashBehaviorComponent.DashAction)
                {
                    foreach (IComboEntry comboEntry in comboEntries)
                    {
                        if (ComboMove.ComboMoveType.Dash == comboEntry.Move.Type)
                        {
                            return(comboEntry);
                        }
                    }
                }
                else if (action is AttackBehaviorComponent.AttackAction attackAction)
                {
                    foreach (IComboEntry comboEntry in comboEntries)
                    {
                        if (comboEntry.Move.Equals(attackAction) && (null == previousMove || !Move.RequireHit || !previousMove.Move.IsAttack || currentAction.DidHit))
                        {
                            return(comboEntry);
                        }
                    }

                    // if we failed and this is the opener
                    // we'll be kind and fall back on the directionless attack
                    if (null == previousMove)
                    {
                        if (GameManager.Instance.DebugBrawlers)
                        {
                            Debug.Log($"Fallback on directionless attack");
                        }

                        foreach (IComboEntry comboEntry in comboEntries)
                        {
                            if (comboEntry.Move.IsDirectionlessAttack)
                            {
                                return(comboEntry);
                            }
                        }
                    }
                }

                return(null);
            }