private void OnDrawGizmos() { Vector3 position = transform.position + (Vector3.up * MESH_VERTICAL_OFFSET); Gizmos.color = GIZMO_ARROW_COLOR; Gizmos.DrawMesh(NavigationMarker.GetMarkerMesh(), position, transform.rotation, Vector3.one); Gizmos.color = new Color(this.color.r, this.color.g, this.color.b, 0.5f); Mesh mesh = NavigationMarker.GetMarkerMesh(); for (int i = 0; i < GIZMO_OUTLINE_MESH.Length; ++i) { Gizmos.DrawLine( position + (transform.rotation * mesh.vertices[(int)GIZMO_OUTLINE_MESH[i].x]), position + (transform.rotation * mesh.vertices[(int)GIZMO_OUTLINE_MESH[i].y]) ); } #if UNITY_EDITOR if (LABEL_SHOW) { GUIStyle labelStyle = new GUIStyle(GUI.skin.label); labelStyle.normal.textColor = this.color; Handles.Label(transform.position, this.label, labelStyle); } if (this.stopThreshold > Mathf.Epsilon) { Handles.color = this.color; Handles.DrawWireDisc(position, Vector3.up, this.stopThreshold); } #endif }
// MARKER MESH GENERATOR: ----------------------------------------------------------------- private static Mesh GetMarkerMesh() { if (GIZMO_MESH == null) { GIZMO_MESH = NavigationMarker.GenerateMarkerMesh(); } return(GIZMO_MESH); }
private void GetTarget(Character targetCharacter, GameObject invoker, ref Vector3 cPosition, ref ILocomotionSystem.TargetRotation cRotation, ref float cStopThresh) { cStopThresh = 0.0f; switch (this.moveTo) { case MOVE_TO.Position: cPosition = this.position; break; case MOVE_TO.Transform: cPosition = this.transform.position; break; case MOVE_TO.Marker: cPosition = this.marker.transform.position; cRotation = new ILocomotionSystem.TargetRotation(true, this.marker.transform.forward); cStopThresh = this.marker.stopThreshold; break; case MOVE_TO.Variable: object valueVariable = this.variable.Get(invoker); switch (this.variable.GetVariableDataType()) { case Variable.DataType.GameObject: GameObject variableGo = valueVariable as GameObject; if (variableGo == null) { if (targetCharacter != null) { cPosition = targetCharacter.transform.position; } return; } NavigationMarker varMarker = variableGo.GetComponent <NavigationMarker>(); if (varMarker != null) { cPosition = varMarker.transform.position; cRotation = new ILocomotionSystem.TargetRotation(true, varMarker.transform.forward); cStopThresh = varMarker.stopThreshold; } else { cPosition = variableGo.transform.position; } break; case Variable.DataType.Vector3: cPosition = (Vector3)valueVariable; break; } break; } }