Esempio n. 1
0
        void Start()
        {
            if (!NetworkServer.active)
            {
                Destroy(this);
            }

            ragdoll     = GetComponent <HumanRagdoll>();
            tileManager = FindObjectOfType <TileManager>();
            Assert.IsNotNull(tileManager);
            origin = tileManager.Origin;
        }
Esempio n. 2
0
        private void OnCollisionEnter(Collision other)
        {
            if (!isServer)
            {
                return;
            }

            HumanRagdoll humanRagdoll = other.transform.root.gameObject.GetComponent <HumanRagdoll>();

            if (humanRagdoll != null && !humanRagdoll.BodyEnabled)
            {
                CleanBodyDictionary();
                if (!slippedBodies.ContainsKey(humanRagdoll))
                {
                    humanRagdoll.KnockDown(knockdownDuration);
                    slippedBodies.Add(humanRagdoll, Time.time);
                }
            }
        }
Esempio n. 3
0
        private void OnCollisionEnter(Collision other)
        {
            if (!isServer)
            {
                return;
            }

            HumanRagdoll humanRagdoll = other.transform.root.gameObject.GetComponent <HumanRagdoll>();

            if (humanRagdoll != null && !humanRagdoll.BodyEnabled)
            {
                CleanBodyDictionary();
                if (!slippedBodies.ContainsKey(humanRagdoll))
                {
                    humanRagdoll.BodyEnabled = true;
                    slippedBodies.Add(humanRagdoll, Time.time);
                    StartCoroutine(DisableBodyCoroutine(humanRagdoll));
                }
            }
        }
Esempio n. 4
0
        // when something touches it
        private void OnCollisionEnter(Collision other)
        {
            if (!isServer)
            {
                return;
            }

            // tries to get the ragdoll manager in the collision that touched it
            HumanRagdoll humanRagdoll = other.transform.root.gameObject.GetComponent <HumanRagdoll>();

            if (humanRagdoll != null && !humanRagdoll.BodyEnabled)
            {
                // Add a threshold for the ragdoll to slip, for example when you use clown shoes you cant slip on bananas
                CleanBodyDictionary();
                if (!slippedBodies.ContainsKey(humanRagdoll))
                {
                    humanRagdoll.KnockDown(knockdownDuration);
                    slippedBodies.Add(humanRagdoll, Time.time);
                }
            }
        }
Esempio n. 5
0
        private IEnumerator DisableBodyCoroutine(HumanRagdoll body)
        {
            yield return(new WaitForSeconds(3));

            body.BodyEnabled = false;
        }