Exemple #1
0
    void UpdateIgnoreColliders()
    {
        Vector3 point1 = (coll.height / 2f) * Vector3.forward;
        Vector3 point2 = (coll.height / 2f) * Vector3.back;

        float jump = (speed * Time.deltaTime);

        RaycastHit[] hits = Physics.CapsuleCastAll(point1, point2, coll.radius, transform.forward, jump, bustLayers);

        if (hits.Length > 0)
        {
            foreach (RaycastHit hit in hits)
            {
                if (hit.collider == coll)
                {
                    continue;
                }

                DC_Avatar_Part part = hit.collider.gameObject.GetComponent <DC_Avatar_Part>();
                if (part && part.broken && !ignoreParts.Contains(part))
                {
                    Physics.IgnoreCollision(hit.collider, coll);
                    ignoreParts.Add(part);
                }
            }
        }
    }
Exemple #2
0
    void OnTriggerEnter(Collider col)
    {
        if (hit)
        {
            return;
        }

        GameObject colO = col.gameObject;

        if (colO && (bustLayers.value | (1 << colO.layer)) == bustLayers.value)
        {
            DC_Avatar_Part part = colO.GetComponent <DC_Avatar_Part>();

            if (part)
            {
                if (!part.broken)
                {
                    part.BoltStrike(this);
                }
                else
                {
                    Debug.Log("Skpping Part: " + col.gameObject.name);
                    return;
                }
            }

            hit = true;

            BustBolt(transform.position);
        }
    }
Exemple #3
0
    [Server] public void FireInstant()
    {
        Ray ray = new Ray(transform.position, transform.forward);

        RaycastHit[] hits;

        if (((hits = Physics.RaycastAll(ray, range, bustLayers)).Length) > 0)
        {
            foreach (RaycastHit hit in hits)
            {
                DC_Avatar_Part part = hit.collider.gameObject.GetComponent <DC_Avatar_Part>();

                if (part && part.broken)
                {
                    continue;
                }
                else if (part)
                {
                    part.BoltStrike(this);
                }

                BustBolt(hit.point);
                break;
            }

            hit = true;
        }

        BustBolt(transform.position + (transform.forward * range));
    }
Exemple #4
0
    // Client-Side Commands
    [ClientRpc] public void RpcSetPartHealth(BodyParts part, int health)
    {
        DC_Avatar_Part p = chest;

        switch (part)
        {
        case BodyParts.Chest:
            p = chest;
            break;

        case BodyParts.Muzzle:
            p = muzzle;
            break;

        case BodyParts.RightPaw:
            p = rightPaw;
            break;

        case BodyParts.LeftPaw:
            p = leftPaw;
            break;
        }

        p.SetHealth(health);
        p.OnServerUpdate();
    }
Exemple #5
0
    [Server] public void BoltStrike(DC_Avatar_Part bodyP, DC_Bolt bolt)
    {
        BodyParts part = bodyP.GetBodyPart();

        switch (part)
        {
        case BodyParts.Chest:
            break;

        case BodyParts.Muzzle:
            break;

        case BodyParts.RightPaw:
            break;

        case BodyParts.LeftPaw:
            break;


        case BodyParts.ChestChord:
            BustAvatar();
            break;

        case BodyParts.MuzzleChord:
            BustAvatar();
            break;
        }

        Debug.Log("Body Part Hit!: " + bodyP.gameObject.name + " : " + bodyP.health);

        if (part != BodyParts.ChestChord && part != BodyParts.MuzzleChord)
        {
            RpcSetPartHealth(part, bodyP.health);
        }
    }
Exemple #6
0
    public void FireInstant()
    {
        rend.enabled = false;

        if (lightAdded)
        {
            RemLight();
        }

        Ray ray = new Ray(transform.position, transform.forward);

        RaycastHit[] hits;

        if (((hits = Physics.RaycastAll(ray, range, bustLayers)).Length) > 0)
        {
            foreach (RaycastHit hit in hits)
            {
                DC_Avatar_Part part = hit.collider.gameObject.GetComponent <DC_Avatar_Part>();

                if (part && part.broken)
                {
                    continue;
                }
                else if (part)
                {
                    Debug.Log("Part Hit!");
                    part.ClientBoltStrike(this);
                }

                BustBolt(hit.point);
                break;
            }

            hit = true;
        }

        BustBolt(transform.position + (transform.forward * range));
    }