private SymbolDecal GetClosestDecal() { // Most of the time only 1 decal will be tracked. if (decals.Count == 1) { return decals[0]; } var minDistance = float.MaxValue; var position = transform.position; SymbolDecal closest = null; foreach (var decal in decals) { var distance = Vector3.Distance( position, decal.transform.position ); if (distance < minDistance) { minDistance = distance; closest = decal; } } return closest; }
private void Highlight(SymbolDecal decal) { decal.Highlight(); SetActiveHologram(true); SetActiveLight(true); onEnterSymbolDecal.Invoke(); }
private void ClearHighlight(SymbolDecal decal) { decal.ClearHighlight(); SetActiveHologram(false); SetActiveLight(false); onExitSymbolDecal.Invoke(); }
private bool IsInSight(SymbolDecal decal) { var intersects = Physics.Linecast( transform.position, decal.transform.position, out var hit, layerMask ); return intersects && hit.collider.gameObject == decal.gameObject; }
private void Target(SymbolDecal decal = null) { if (target != null && target != decal && target.Highlighted) { ClearHighlight(target); } if (decal != null && !decal.Highlighted) { Highlight(decal); } target = decal; }