예제 #1
0
        public void OnLimbHit(HitboxType type)
        {
            switch (type)
            {
            case HitboxType.HEAD:
                headLimb.DetachLimb();
                break;

            case HitboxType.UPPER_BODY:
                //           upperBodyLimb.DetachLimb();
                break;

            case HitboxType.L_ARM:
                leftArmLimb.DetachLimb();
                break;

            case HitboxType.R_ARM:
                rightArmLimb.DetachLimb();
                break;

            case HitboxType.PROP:
                break;

            case HitboxType.LOWER_BODY:
                lowerBodyLimb.DetachLimb();
                break;
            }
        }
예제 #2
0
 public AdditionalFixtureData(PhysicObj parent, HitboxType type)
 {
     physicParent     = parent;
     this.type        = type;
     isTouching       = false;
     fixInContactList = new List <Fixture>();
 }
예제 #3
0
    public HitType OnHit(Gun gun, RaycastHit raycastHit)
    {
        HitboxType partHit = GetHitboxTypeFromHit(raycastHit);

        step.SendMessage("OnHit", SendMessageOptions.DontRequireReceiver);

        ScenarioLogs.logs.Add(new LoggedHit(this, partHit, gun, raycastHit));
        if (partHit == Goal)
        {
            return(HitType.RIGHT);
        }
        switch (partHit)
        {
        case HitboxType.TargetHead:
        case HitboxType.TargetArmLeft:
        case HitboxType.TargetArmRight:
        case HitboxType.TargetLegLeft:
        case HitboxType.TargetLegRight:
        case HitboxType.TargetHandLeft:
        case HitboxType.TargetHandRight:
        case HitboxType.TargetTorso: return(HitType.UNWANTED);
        }

        return(HitType.MISS);
    }
예제 #4
0
파일: LoggedHit.cs 프로젝트: Ricebal/VRange
 public LoggedHit(IHitable target, HitboxType part, Gun gun, RaycastHit raycastHit) : base()
 {
     this.gun        = gun;
     this.raycastHit = raycastHit;
     this.target     = target;
     this.part       = part;
 }
예제 #5
0
        static public Color COLOR(HitboxType type)
        {
            switch (type)
            {
            case HitboxType.TRIGGER:
                return(new Color(0f, 1f, 1f, 1f));

            case HitboxType.HURT:
                return(new Color(1f, 0.125f, 0f, 1f));

            case HitboxType.GUARD:
                return(new Color(0f, 0f, 1f, 1f));

            case HitboxType.ARMOR:
                return(new Color(1f, 0.5f, 0f, 1f));

            case HitboxType.GRAB:
                return(new Color(1f, 1f, 0f, 1f));

            case HitboxType.TECH:
                return(new Color(0.75f, 0f, 1f, 1f));
            }

            return(Color.black);
        }
 /// <summary>
 /// Recrée l'ActorCollision d'un acteur. Utilisé lorsque celui-ci est ressussité, pour restaurer sa collision.
 /// </summary>
 /// <param name="clone"> L'ActorCollision à récupérer </param>
 public ActorCollision(ActorCollision clone)
 {
     Hitbox      = clone.Hitbox;
     HitboxType  = clone.HitboxType;
     _owner      = clone._owner;
     _collsision = clone._collsision;
     _squares    = SquaresHandler.GetAndUpdateSquares(_owner, Hitbox);
 }
예제 #7
0
파일: IHitable.cs 프로젝트: Ricebal/VRange
 /// <summary>
 /// Retrieves string from enum description
 /// </summary>
 /// <param name="val"></param>
 /// <returns></returns>
 public static string ToDescriptionString(this HitboxType val)
 {
     DescriptionAttribute[] attributes = (DescriptionAttribute[])val
                                         .GetType()
                                         .GetField(val.ToString())
                                         .GetCustomAttributes(typeof(DescriptionAttribute), false);
     return(attributes.Length > 0 ? attributes[0].Description : string.Empty);
 }
예제 #8
0
        public static Vector3 getTypeColour(HitboxType t)
        {
            switch (t)
            {
            case HitboxType.Typeless: return(new Vector3(0x9f, 0x9f, 0x9f));

            case HitboxType.Head: return(new Vector3(0xff, 0x00, 0x00));

            case HitboxType.Body: return(new Vector3(0xbf, 0x3f, 0x00));

            case HitboxType.Butt: return(new Vector3(0xbf, 0x5f, 0x00));

            case HitboxType.Hand: return(new Vector3(0xff, 0xff, 0x00));

            case HitboxType.Elbow: return(new Vector3(0xff, 0xdf, 0x00));

            case HitboxType.Foot: return(new Vector3(0xff, 0x7f, 0x00));

            case HitboxType.Knee: return(new Vector3(0xff, 0x9f, 0x00));

            case HitboxType.Throwing: return(new Vector3(0xff, 0x00, 0xff));

            case HitboxType.Weapon: return(new Vector3(0xff, 0xbf, 0x7f));

            case HitboxType.Sword: return(new Vector3(0xbf, 0xbf, 0xbf));

            case HitboxType.Hammer: return(new Vector3(0xff, 0x9f, 0x3f));

            case HitboxType.Explosive: return(new Vector3(0xbf, 0x7f, 0x00));

            case HitboxType.Spin: return(new Vector3(0x7f, 0xff, 0x00));

            case HitboxType.Bite: return(new Vector3(0x00, 0xff, 0x7f));

            case HitboxType.Magic: return(new Vector3(0xbf, 0x00, 0xbf));

            case HitboxType.PK: return(new Vector3(0xbf, 0x3f, 0xbf));

            case HitboxType.Bow: return(new Vector3(0xdf, 0xbf, 0x3f));

            case HitboxType.Bat: return(new Vector3(0xaf, 0x8f, 0x1f));

            case HitboxType.Umbrella: return(new Vector3(0xff, 0x7f, 0x7f));

            case HitboxType.Pikmin: return(new Vector3(0x00, 0xbf, 0x00));

            case HitboxType.Water: return(new Vector3(0x3f, 0x3f, 0xff));

            case HitboxType.Whip: return(new Vector3(0xff, 0xdf, 0x7f));

            case HitboxType.Tail: return(new Vector3(0x00, 0xff, 0x00));

            case HitboxType.Energy: return(new Vector3(0x00, 0xff, 0xff));

            default: return(new Vector3(0x7f, 0x7f, 0x7f));
            }
        }
예제 #9
0
    public Hitbox(Rect boundaries, HitboxType hitboxType)
    {
        Type       = hitboxType;
        Position   = Vector3.zero;
        Boundaries = boundaries;

        //Always assume default as rectangle
        Shape = HitboxShape.Rectangle;
    }
예제 #10
0
    public Hitbox(Rect boundaries, HitboxType hitboxType)
    {
        Type = hitboxType;
        Position = Vector3.zero;
        Boundaries = boundaries;

        //Always assume default as rectangle
        Shape = HitboxShape.Rectangle;
    }
        private void CreateParentHitboxHandler(Transform parent, string objectName, HitboxType hitboxType, Transform parentRigidbodyTransform)
        {
            HitboxHandler[] handlers            = GetComponentsInChildren <HitboxHandler>();
            HitboxHandler   hitboxTargetHandler = null;

            foreach (HitboxHandler item in handlers)
            {
                if (item.hitboxType == hitboxType)
                {
                    return;
                }
            }



            GameObject geo = new GameObject();

            geo.transform.SetParent(parent);
            geo.name = objectName;

            geo.transform.localPosition = Vector3.zero;
            geo.transform.localRotation = Quaternion.identity;
            geo.transform.localScale    = Vector3.one;

            hitboxTargetHandler                 = geo.AddComponent <HitboxHandler>();
            hitboxTargetHandler.hitboxType      = hitboxType;
            hitboxTargetHandler.parentRigidbody = parentRigidbodyTransform.GetComponent <Rigidbody>();

            switch (hitboxType)
            {
            case HitboxType.HEAD:
                hitboxTargetHandler.hitboxColliders.Add(CreateHitboxCollider(geo.transform, "HITBOX_HEAD", hitboxTargetHandler, new Vector3(0f, -0.04f, -0.01f), new Vector3(0.19f, 0.27f, 0.21f), Vector3.zero));
                break;

            case HitboxType.UPPER_BODY:
                hitboxTargetHandler.hitboxColliders.Add(CreateHitboxCollider(geo.transform, "HITBOX_UPPER_BODY", hitboxTargetHandler, new Vector3(0.018f, -0.004f, -0.01f), new Vector3(0.19f, 0.27f, 0.21f), Vector3.zero));
                break;

            case HitboxType.L_ARM:
                hitboxTargetHandler.hitboxColliders.Add(CreateHitboxCollider(leftElbow.transform, "HITBOX_L_Elbow", hitboxTargetHandler, new Vector3(-0.066f, 0.01f, 0.009f), new Vector3(0.288f, 0.095f, 0.08f), Vector3.zero));
                hitboxTargetHandler.hitboxColliders.Add(CreateHitboxCollider(leftShoulder.transform, "HITBOX_L_Shoulder", hitboxTargetHandler, new Vector3(-0.093f, 0.001f, -0.0101f), new Vector3(0.328f, 0.134f, 0.094f), Vector3.zero));
                break;

            case HitboxType.R_ARM:
                hitboxTargetHandler.hitboxColliders.Add(CreateHitboxCollider(rightElbow.transform, "HITBOX_R_Elbow", hitboxTargetHandler, new Vector3(0.1f, 0.006f, 0f), new Vector3(0.288f, 0.085f, 0.07f), Vector3.zero));
                hitboxTargetHandler.hitboxColliders.Add(CreateHitboxCollider(rightShoulder.transform, "HITBOX_R_Shoulder", hitboxTargetHandler, new Vector3(0.089f, 0.004f, 0.004f), new Vector3(0.359f, 0.103f, 0.111f), Vector3.zero));
                break;

            case HitboxType.PROP:
                break;

            case HitboxType.LOWER_BODY:
                hitboxTargetHandler.hitboxColliders.Add(CreateHitboxCollider(geo.transform, "HITBOX_Lower_BODY", hitboxTargetHandler, new Vector3(-0.128f, -0.01f, 0.001f), new Vector3(0.39f, 0.33f, 0.20f), Vector3.zero));
                break;
            }
        }
        public static Color GetHitboxColor(HitboxType type)
        {
            Color typeColor;

            if (HitboxTypeColors.TryGetValue(type, out typeColor))
            {
                return(typeColor);
            }
            return(Color.grey);
        }
        void AddHitboxToTargetRagdoll(Transform targetTransform, HitboxType hitboxType)
        {
            HitboxColliderHandler colliderHandler = targetTransform.gameObject.AddComponent <HitboxColliderHandler>();

            HitboxHandler[] allHandlers = GetComponentsInChildren <HitboxHandler>();
            foreach (HitboxHandler item in allHandlers)
            {
                if (item.hitboxType == hitboxType)
                {
                    colliderHandler.parentHandler = item;
                }
            }
        }
예제 #14
0
 public void Feed(Vector2 boxSize, Vector2 boxOffset, HitboxType type,
                  float damage, float strength, Vector2 forceRange, bool isTrigger, float remainTiem, XFSMLite.XFSMState state)
 {
     Type               = type;
     m_Damage           = damage;
     m_Strength         = strength;
     m_Force            = forceRange;
     Collider.size      = boxSize;
     Collider.offset    = boxOffset;
     Collider.isTrigger = isTrigger;
     m_DidHit           = false;
     mRemainTime        = remainTiem;
     mState             = state;
     Collider.enabled   = true;
 }
        public override void Death(HitboxType hitboxType)
        {
            base.Death(hitboxType);
            playerController.tickPlayer.value = false;
            animController.PlayAnimationHash(animController.animData.death01AnimationClass);
            hitboxController.DisableHitboxes();
            animController.animHook.enabled = false;
            inventoryController.DropWeaponToGround(false, inventoryController.currentWeaponItemRuntime);
            playerController.cameraFocusPoint.SetParent(null);
            UI_LevelRestartManager.singleton.ActivateRestartMenu();
            Rigidbody rigid = GetComponent <Rigidbody>();

            rigid.isKinematic = true;
            Destroy(playerController);
        }
예제 #16
0
 public override void Death(HitboxType hitboxType)
 {
     base.Death(hitboxType);
     aiController.aiManager.OnDeadAI(aiController);
     hitboxController.DisableHitboxes();
     limbsController.OnLimbHit(hitboxType);
     animController.PlayAnimationHash(animController.animData.death01AnimationClass);
     movementController.OnDeath();
     animController.animHook.enabled = false;
     inventoryController.DropCurrentInHandWeapon(false);
     doorCollider.SetActive(false);
     notificationCollider.SetActive(false);
     Destroy(aiController.fieldOfViewController);
     Destroy(aiController.searchController);
     Destroy(aiController.notificationHandler);
 }
예제 #17
0
        public virtual void TakeDamage(int amount, HitboxType hitboxType)
        {
            if (currentHealth < 0)
            {
                return;
            }

            currentHealth -= amount;

            //Debug.Log(gameObject.name + " Took " + amount + " Damage ");

            if (currentHealth <= 0)
            {
                Death(hitboxType);
            }
        }
 /// <summary>
 /// Place l'acteur associé dans le gestionnaire de collisions.
 /// </summary>
 /// <param name="owner"> L'acteur associé </param>
 /// <param name="rectangle"> La taille de la hitbox de l'acteur </param>
 /// <param name="hitboxType"> Le type de hitbox de l'acteur </param>
 /// <param name="collision"> L'éventuel effet déclenché lors de la collision de l'acteur </param>
 public ActorCollision(Actor owner, Rectangle rectangle, HitboxType hitboxType,
                       Action <Actor> collision = null)
 {
     Hitbox     = rectangle;
     HitboxType = hitboxType;
     _owner     = owner;
     if (collision == null)
     {
         _collsision = actor => { };
     }
     else
     {
         _collsision = collision;
     }
     _squares = SquaresHandler.GetAndUpdateSquares(_owner, Hitbox);
 }
예제 #19
0
        public static Color GetHitboxColor(HitboxType type)
        {
            Config.DebugData debugData = Config.Debug;
            switch (type)
            {
            case HitboxType.Offensive:
                return(debugData.OffensiveHitboxColor);

            case HitboxType.Damageable:
                return(debugData.DamageableHitboxColor);

            case HitboxType.Invincible:
                return(debugData.IntangiblHitboxColor);

            case HitboxType.Intangible:
                return(debugData.InvincibleHitboxColor);

            default:
                return(Color.white);
            }
        }
 public override void TakeDamage(int amount, HitboxType hitboxType)
 {
     base.TakeDamage(amount, hitboxType);
 }
예제 #21
0
 public static Vector3 GetTypeColor(HitboxType t)
 {
     switch (t)
     {
         case HitboxType.Typeless: return new Vector3(0x9f, 0x9f, 0x9f);
         case HitboxType.Head: return new Vector3(0xff, 0x00, 0x00);
         case HitboxType.Body: return new Vector3(0xbf, 0x3f, 0x00);
         case HitboxType.Butt: return new Vector3(0xbf, 0x5f, 0x00);
         case HitboxType.Hand: return new Vector3(0xff, 0xff, 0x00);
         case HitboxType.Elbow: return new Vector3(0xff, 0xdf, 0x00);
         case HitboxType.Foot: return new Vector3(0xff, 0x7f, 0x00);
         case HitboxType.Knee: return new Vector3(0xff, 0x9f, 0x00);
         case HitboxType.Throwing: return new Vector3(0xff, 0x00, 0xff);
         case HitboxType.Weapon: return new Vector3(0xff, 0xbf, 0x7f);
         case HitboxType.Sword: return new Vector3(0xbf, 0xbf, 0xbf);
         case HitboxType.Hammer: return new Vector3(0xff, 0x9f, 0x3f);
         case HitboxType.Explosive: return new Vector3(0xbf, 0x7f, 0x00);
         case HitboxType.Spin: return new Vector3(0x7f, 0xff, 0x00);
         case HitboxType.Bite: return new Vector3(0x00, 0xff, 0x7f);
         case HitboxType.Magic: return new Vector3(0xbf, 0x00, 0xbf);
         case HitboxType.PK: return new Vector3(0xbf, 0x3f, 0xbf);
         case HitboxType.Bow: return new Vector3(0xdf, 0xbf, 0x3f);
         case HitboxType.Bat: return new Vector3(0xaf, 0x8f, 0x1f);
         case HitboxType.Umbrella: return new Vector3(0xff, 0x7f, 0x7f);
         case HitboxType.Pikmin: return new Vector3(0x00, 0xbf, 0x00);
         case HitboxType.Water: return new Vector3(0x3f, 0x3f, 0xff);
         case HitboxType.Whip: return new Vector3(0xff, 0xdf, 0x7f);
         case HitboxType.Tail: return new Vector3(0x00, 0xff, 0x00);
         case HitboxType.Energy: return new Vector3(0x00, 0xff, 0xff);
         default: return new Vector3(0x7f, 0x7f, 0x7f);
     }
 }
예제 #22
0
 public virtual void Death(HitboxType hitboxType)
 {
     isDead = true;
 }
예제 #23
0
        public override void Death(HitboxType hitboxType)
        {
            base.Death(hitboxType);

            Destroy(gameObject);
        }
예제 #24
0
파일: Enemy.cs 프로젝트: Ricebal/VRange
    public HitType OnHit(Gun gun, RaycastHit raycastHit)
    {
        HitboxType partHit = GetHitboxTypeFromHit(raycastHit);

        hitCorrectPart = false;

        //raycastHit.transform.position()
        ScenarioLogs.logs.Add(new LoggedHit(this, partHit, gun, raycastHit));

        switch (partHit)         // add sth related to the part hit if we will need it
        {
        case HitboxType.HumanHead:
            if (!IsDead)
            {
                Die();
            }
            break;

        case HitboxType.HumanNeck: if (!IsDead)
            {
                Die();
            }
            hitCorrectPart = false; break;

        case HitboxType.HumanPelvis: Torso(); hitCorrectPart = true;  break;

        case HitboxType.HumanSpine1: Torso(); hitCorrectPart = true; break;

        case HitboxType.HumanSpine2: Torso(); hitCorrectPart = true; break;

        case HitboxType.HumanSpine3: Torso(); hitCorrectPart = true; break;

        case HitboxType.HumanThighLeft: LeftLegHit(); hitCorrectPart = false; break;

        case HitboxType.HumanCalfLeft: LeftLegHit(); hitCorrectPart = false; break;

        case HitboxType.HumanThighRight: RightLegHit(); hitCorrectPart = false; break;

        case HitboxType.HumanCalfRight: RightLegHit(); hitCorrectPart = false; break;

        case HitboxType.HumanFootLeft: health -= Random.Range(1, 20); hitCorrectPart = false; break;

        case HitboxType.HumanFootRight: health -= Random.Range(1, 20); hitCorrectPart = false; break;

        case HitboxType.HumanLowerArmLeft: LeftShoulderHit(); hitCorrectPart = false; break;

        case HitboxType.HumanHandLeft: LeftShoulderHit(); hitCorrectPart = false; break;

        case HitboxType.HumanUpperArmLeft: LeftShoulderHit(); hitCorrectPart = false; break;

        case HitboxType.HumanLowerArmRight: RightShoulderHit(); hitCorrectPart = false; break;

        case HitboxType.HumanHandRight: RightShoulderHit(); hitCorrectPart = false; break;

        case HitboxType.HumanUpperArmRight: RightShoulderHit(); hitCorrectPart = false; break;
        }
        if (isAgressive == false || hitCorrectPart == false)
        {
            return(HitType.UNWANTED);
        }
        else
        {
            return(HitType.RIGHT);
        }
    }
예제 #25
0
 public static void DrawHitbox(Collider hitbox, HitboxType type)
 {
     DrawCollider3D(hitbox, Game.GetHitboxColor(type));
 }
예제 #26
0
 public static void DrawHitboxes(IEnumerable <Collider> hitboxes, HitboxType type, Predicate <Collider> filter = null)
 {
     DrawColliders3D(hitboxes, Game.GetHitboxColor(type), true, filter);
 }
예제 #27
0
 public static void DrawHitboxes(IEnumerable<Collider> hitboxes, HitboxType type, Predicate<Collider> filter = null)
 {
     DrawColliders3D(hitboxes, Game.GetHitboxColor(type), true, filter);
 }
예제 #28
0
 public HitboxData(Collider2D collider, HitboxType hitboxType)
 {
     this.collider   = collider;
     this.hitboxType = hitboxType;
 }
예제 #29
0
 public static void DrawHitbox(Collider hitbox, HitboxType type)
 {
     DrawCollider3D(hitbox, Game.GetHitboxColor(type));
 }
 public HitboxBuilder WithType(HitboxType type)
 {
     Hitbox.Type = type;
     return(this);
 }