Exemplo n.º 1
0
        void SetupRagdoll()
        {
            int layerMask = GetLayerFromLayerMask.GetInt(limbsData.limbsRagdollMask.value);

            upperBodyRigidBody.gameObject.layer = layerMask;
            headRigidbody.gameObject.layer      = layerMask;
            centreRigidbody.gameObject.layer    = layerMask;

            for (int i = 0; i < leftArmRigidbodies.Count; i++)
            {
                leftArmRigidbodies[i].gameObject.layer = layerMask;
            }
            for (int i = 0; i < rightArmRigidbodies.Count; i++)
            {
                rightArmRigidbodies[i].gameObject.layer = layerMask;
            }
            for (int i = 0; i < leftLegRigidbodies.Count; i++)
            {
                leftLegRigidbodies[i].gameObject.layer = layerMask;
            }
            for (int i = 0; i < rightLegRigidbodies.Count; i++)
            {
                rightLegRigidbodies[i].gameObject.layer = layerMask;
            }
        }
Exemplo n.º 2
0
        void UpdateTransformLayer()
        {
            ScriptableLayerMask enemyLayerMask = Resources.Load("LayerMasks/LayerMask_Enemy") as ScriptableLayerMask;
            int layerMaskNumber = GetLayerFromLayerMask.GetInt(enemyLayerMask.value);

            gameObject.layer = layerMaskNumber;
        }
Exemplo n.º 3
0
        public override void Init()
        {
            SubLimbController[] allSubLimbs = GetComponentsInChildren <SubLimbController>();
            foreach (SubLimbController item in allSubLimbs)
            {
                switch (item.limbType)
                {
                case HitboxType.HEAD:
                    headLimb = item;
                    break;

                case HitboxType.UPPER_BODY:
                    upperBodyLimb = item;
                    break;

                case HitboxType.L_ARM:
                    leftArmLimb = item;
                    break;

                case HitboxType.R_ARM:
                    rightArmLimb = item;
                    break;

                case HitboxType.PROP:
                    break;

                case HitboxType.LOWER_BODY:
                    lowerBodyLimb = item;
                    break;
                }

                item.Init();
            }

            ScriptableLayerMask ragdollLayer = Resources.Load("LayerMasks/LayerMask_Ragdoll") as ScriptableLayerMask;
            int layerMaskNumber = GetLayerFromLayerMask.GetInt(ragdollLayer.value);

            RagdollComponentController[] allRagdollComponents = GetComponentsInChildren <RagdollComponentController>();
            foreach (RagdollComponentController item in allRagdollComponents)
            {
                ragdollComponentControllers.Add(item);
                item.Init();
                item.gameObject.layer = layerMaskNumber;
            }
        }
Exemplo n.º 4
0
        public override void Init()
        {
            hitboxController = GetComponentInParent <HitboxController>();
            collision        = GetComponent <BoxCollider>();

            PlayerController playerController = GetComponentInParent <PlayerController>();

            if (playerController != null)
            {
                ScriptableLayerMask playerLayerMask = Resources.Load("LayerMasks/LayerMask_PlayerHitbox") as ScriptableLayerMask;
                gameObject.layer = GetLayerFromLayerMask.GetInt(playerLayerMask.value);
            }
            else
            {
                ScriptableLayerMask enemyLayerMask = Resources.Load("LayerMasks/LayerMask_EnemyHitbox") as ScriptableLayerMask;
                gameObject.layer = GetLayerFromLayerMask.GetInt(enemyLayerMask.value);
            }
        }
Exemplo n.º 5
0
        void AssignLayerToColliders()
        {
            int layerNumber = 0;

            if(isPlayer == true)
            {
                ScriptableLayerMask playerLayerMask = Resources.Load("LayerMasks/LayerMask_PlayerHitbox") as ScriptableLayerMask;
                layerNumber = GetLayerFromLayerMask.GetInt(playerLayerMask.value);
            }
            else
            {
                ScriptableLayerMask enemyLayerMask = Resources.Load("LayerMasks/LayerMask_EnemyHitbox") as ScriptableLayerMask;
                layerNumber = GetLayerFromLayerMask.GetInt(enemyLayerMask.value);
            }
            

            headHitboxHandler.AssignLayerMask(layerNumber);
            torsoHitboxHandler.AssignLayerMask(layerNumber);
            leftArmHitboxHandler.AssignLayerMask(layerNumber);
            rightArmHitboxHandler.AssignLayerMask(layerNumber);
            leftLegHitboxHandler.AssignLayerMask(layerNumber);
            rightLegHitboxHandler.AssignLayerMask(layerNumber);
        }
 public void SetLayerMask(ScriptableLayerMask Layer)
 {
     //      currentGameObject.layer = LayerMask.NameToLayer(layerName.Value);
     gameObject.layer = GetLayerFromLayerMask.GetInt(Layer.value);
 }