コード例 #1
0
        public override GameObject FireAmmo(IDamager damager, Ray damageRay, LayerMask layerMask, float damageMultiplier)
        {
            Impaler impaler = Impaler.pool.GetPrefabInstance(impalerPrefab);

            System.Action <PhysicsHit> onHitReach = (physicsHit) => {
            };

            List <PhysicsHit> hits = impaler.ShootImpaler(velocity, hitObjectVelocityMultiplier, zMovementLimit, damageRay, maxDistance, layerMask, impalerRadius, kinematicOnReach, useColliderOnReach, lifeTime, onHitReach);

            for (int i = 0; i < hits.Count; i++)
            {
                Damageable damageable = hits[i].hitElements[0].rigidbody.GetComponent <Damageable>();
                if (damageable)
                {
                    damageable.SendDamage(new DamageMessage(damager, baseDamage * damageMultiplier, 0));
                }
            }
            return(impaler.gameObject);
        }
コード例 #2
0
        void OnDeath(Damageable damageable, DamageMessage damageMessage)
        {
            // if (damageable != null) {

            //     RagdollTransform damagedBone = null;

            //     if ( ragdollController.ragdoll.Transform2HumanBone (damageable.transform, out damagedBone) ) {

            //         // set bone decay for the hit bone, so the physics will affect it
            //         // (slightly lower for neighbor bones)
            //         float mainDecay = 1;
            //         float neighborMultiplier = .75f;
            //         ragdollController.AddBoneDecay(damagedBone.bone.bone, mainDecay, neighborMultiplier);
            //     }
            // }

            //make it go ragdoll
            ragdollController.GoRagdoll("death");

            ragdollController.disableGetUp = true;
        }
コード例 #3
0
        IEnumerator ShootBullet(Game.Combat.IDamager damager, Ray damageRay, LayerMask layerMask, float damageMultiplier)
        {
            yield return(new WaitForFixedUpdate());

            RaycastHit hit;

            if (Physics.Raycast(damageRay, out hit, maxDistance, layerMask, QueryTriggerInteraction.Ignore))
            {
                Damageable damageable = hit.transform.GetComponent <Damageable>();
                if (damageable)
                {
                    damageable.SendDamage(new DamageMessage(damager, baseDamage * damageMultiplier, severity));
                }

                Rigidbody rb = hit.transform.GetComponent <Rigidbody>();
                if (rb)
                {
                    rb.AddForceAtPosition(damageRay.direction.normalized * force, hit.point, ForceMode.VelocityChange);
                }
            }
        }
コード例 #4
0
        public override GameObject FireAmmo(IDamager damager, Ray damageRay, LayerMask layerMask, float damageMultiplier)
        {
            Spear spear = Spear.pool.GetPrefabInstance(spearPrefab);

            System.Action <PhysicsHit, bool> onHitReach = (physicsHit, isImpaled) => {
            };

            List <PhysicsHit> hits = spear.ShootSpear(velocity, damageRay, maxDistance, layerMask, lifeTime, skewerSeperation, minSpaceFromWall, skeweredVelocityMultiplier, onHitReach);

            for (int i = 0; i < hits.Count; i++)
            {
                Damageable damageable = hits[i].hitElements[0].rigidbody.GetComponent <Damageable>();
                if (damageable)
                {
                    damageable.SendDamage(new DamageMessage(damager, baseDamage * damageMultiplier, 0));
                }
            }


            return(spear.gameObject);
        }