Beispiel #1
0
        public void HasHit(Character target)
        {
            target.PlaySound(attackBehavior.OnHitSound);
            //user.SetTarget(target);
            user.HitConfirm();
            if (attackBehavior.OnHitCombo != null)
                user.Action(attackBehavior.OnHitCombo);
            if (attackBehavior.UserKnockbackX != 0 || attackBehavior.UserKnockbackZ != 0)
            {
                user.SetSpeed(attackBehavior.UserKnockbackX * -direction, 0);
                user.Jump(attackBehavior.UserKnockbackZ);
            }

            //Feedback
            if (attackBehavior.OnHitAnimation != null)
                Instantiate(attackBehavior.OnHitAnimation, target.ParticlePoint.position, Quaternion.identity);
            if (attackBehavior.HitStopGlobal == false && attackBehavior.HitStop > 0) 
            {
                target.SetCharacterMotionSpeed(0, attackBehavior.HitStop);
                if(attackBehavior.HitStopUser == true)
                    user.SetCharacterMotionSpeed(0, attackBehavior.HitStop);
                else if (attackBehavior.HitStopProjectile == true)
                {
                    AttackMotionSpeed(0);
                    StartCoroutine(MotionSpeedCoroutine(attackBehavior.HitStop));
                }
            }

            if (attackBehavior.ThrowState == true)
            {
                target.Throw(user.ThrowPoint, direction, user.SpriteRenderer.transform.localScale.x);
                user.SetCharacterToThrow(target);
            }
            if (attackBehavior.IsMultiHit == false)
            {
                ActionEnd();
            }
            else
            {
                ActionUnactive();
            }
        }