private void OnTriggerEnter(Collider other)
    {
        RagDoll ragDoll = other.gameObject.GetComponentInParent <RagDoll>();

        if (ragDoll != null)
        {
            ragDoll.RagdollOn = true;
        }
    }
    private void DestroyRagDolls()
    {
        foreach (GameObject go in gameObject.scene.GetRootGameObjects())
        {
            RagDoll ragDoll = go.GetComponent <RagDoll>();
            if (!ragDoll)
            {
                continue;
            }

            Destroy(ragDoll.gameObject);
        }
    }
Beispiel #3
0
 void Start()
 {
     transform.GetChild(0).localPosition = new Vector3(0, -1, 0);
     gobject         = GetComponent <GObject>();
     ragdoll         = GetComponentInChildren <RagDoll>();
     dieprocessed    = false;
     agenttarget     = null;
     animator        = GetComponent <Animator>();
     animator.avatar = GetComponentsInChildren <Animator>()[1].avatar;
     Destroy(GetComponentsInChildren <Animator>()[1]);
     gameObject.AddComponent(GameData.Instance.ZombieTypeTypes[(int)zombietype]);
     isDie     = false;
     tempitems = new List <int>();
     StartCoroutine(CheckRoutine());
     agentspeed  = agent.speed;
     audiosource = GetComponent <AudioSource>();
     StartCoroutine(RandomSound());
 }
    void ShootLaser()
    {
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Input.GetMouseButtonDown(0))
        {
            Physics.Raycast(ray, out hit, lasserRayCaseDist);

            GameObject go;
            RagDoll    rd = null;

            Vector3[] linePoints = new Vector3[2];
            linePoints[0] = transform.position;

            if (hit.transform != null)
            {
                go            = hit.transform.gameObject;
                linePoints[1] = hit.point;

                if ((rd = go.GetComponentInParent <RagDoll>()) != null)
                {
                    if (rd.RagdollOn == false)
                    {
                        rd.RagdollOn = true;
                    }
                }

                if (go.GetComponent <Rigidbody>())
                {
                    go.GetComponent <Rigidbody>().AddForce(ray.direction * hitForce);
                }
            }
            else
            {
                linePoints[1] = Camera.main.ScreenToWorldPoint(Input.mousePosition) + ray.direction * lasserRayCaseDist;
            }

            LR.positionCount = 2;
            LR.SetPositions(linePoints);

            m_elapsedLaserTime = 0;
        }
    }
        public void SpawnRagdoll(ref IndexedVector3 startOffset,StreamWriter streamWriter)
        {
	        RagDoll ragDoll = new RagDoll (this,m_dynamicsWorld, ref startOffset,streamWriter);
	        m_ragdolls.Add(ragDoll);
        }	
        public void SpawnRagdoll(ref IndexedVector3 startOffset, StreamWriter streamWriter)
        {
            RagDoll ragDoll = new RagDoll(this, m_dynamicsWorld, ref startOffset, streamWriter);

            m_ragdolls.Add(ragDoll);
        }