Example #1
0
        /// <summary>
        /// If current attack can be canceled
        /// </summary>
        /// <param name="atkInfo"></param>
        /// <param name="delayFrames"></param>
        /// <returns></returns>
        bool CanCancelAttack(BehaviorAttack atkInfo, int delayFrames)
        {
            float currentFrame = model.currentFrame;

            int cancelFrames = (int)(atkInfo.frameInfo.startFrame + atkInfo.cancelDelay);

            return((currentFrame >= cancelFrames / model.objectTimeScale && model.HitConfirm) || currentFrame >= (cancelFrames + delayFrames) / model.objectTimeScale);
        }
Example #2
0
        /// <summary>
        /// Victim will Get Hit based on the tag
        /// </summary>
        /// <param name="col"></param>
        /// <param name="tag">The tag that give to the Collider GameObject </param>
        void HitByTag(Collider col, string tag)
        {
            if (col.transform.root.CompareTag(tag))
            {
                if (col.gameObject.layer == LayerMask.NameToLayer("HurtBox"))
                {
                    ActorController victim     = col.transform.root.GetComponent <ActorController>();
                    HurtBox         hurtBox    = victim.model.hurtBox;
                    BehaviorAttack  currentAtk = model.GetCurrentAttack();
                    if (currentAtk != null)
                    {
                        hurtBox.hitPoint = new Vector3(victim.transform.position.x, transform.position.y, victim.model.hurtBox.transform.position.z);

                        hurtBox.GetHit(model, transform, currentAtk);
                        if (currentAtk.singleTarget)
                        {
                            currentAtk.DeactiveHitBox(model);
                        }
                    }
                }
            }
        }