示例#1
0
    public void DoDamage(Vector3 point, Quaternion rot, float damage, string bodyPartName)
    {
        GameObject   correctPS = null;
        GlobalLoader GLo       = GameObject.FindObjectOfType <GlobalLoader> ();

        switch (bt)
        {
        case BodyType.Soldier:
            correctPS = GLo.bloodParticleSystem;
            break;
        }

        GameObject ps        = (GameObject)Instantiate(correctPS, point, rot);
        float      intDamage = damage * DamageMultiplyer;

        if (this.transform.root.GetComponent <ObjectHealth>() != null)
        {
            if (this.transform.root.GetComponent <ObjectHealth>().alive)
            {
                this.transform.root.GetComponent <ObjectHealth> ().TakeDamage((int)intDamage, bodyPartName, point);
            }
            else
            {
                this.transform.root.GetComponent <ObjectHealth> ().MoveOnly(bodyPartName, point);
            }
        }
    }
示例#2
0
        public Bootstrap(IRepository repository, IScriptLoader scriptLoader, IErrorCache errorCache)
        {
            Repository   = repository;
            ScriptLoader = scriptLoader;
            ErrorCache   = errorCache;

            globalLoader = new GlobalLoader(errorCache);
            cache        = new PackageCache(errorCache);
        }
示例#3
0
    void OnTriggerEnter(Collider c)
    {
        if (c.gameObject.GetComponent <VehicleColliders>() != null)
        {
            Vehicle v = c.gameObject.transform.root.GetComponent <Vehicle>();

            if (v.GetComponent <Rigidbody>().velocity.magnitude > 4.5f)
            {
                this.Health      -= 100;
                this.contactPoint = this.transform.position;
                partName          = "b_Hips";

                AudioSource.PlayClipAtPoint(v.bump, this.transform.position);

                GlobalLoader GLo       = GameObject.FindObjectOfType <GlobalLoader> ();
                GameObject   correctPS = GLo.bloodParticleSystem;
                GameObject   ps        = (GameObject)Instantiate(correctPS, contactPoint, this.transform.rotation);
            }
        }
    }