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); } }
[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)); }