/// <summary> /// Highlight the given object. /// </summary> public void Highlight(SmartObject obj) { if (obj is SmartCrowd) { IEnumerable<SmartObject> objects = ((SmartCrowd)obj).GetObjects(); foreach (SmartObject o in objects) { Highlight(o); } return; } //Preferrably use improved highlighting system, but use old one as fallback Highlight highlight = obj.GetComponent<Highlight>(); if (highlight != null) { highlight.SelectOn(); currentHighlights.Add(highlight); } else { HaloHighlight halo = GetHalo(currentIndex++); halo.TargetTransform = obj.gameObject.transform; halo.haloEnabled = true; } }
private void CleanupOrientation(SmartObject user) { user.GetComponent<CharacterMecanim>().NavOrientBehavior(OrientationBehavior.LookForward); character.NavOrientBehavior(OrientationBehavior.LookForward); }
/// <summary> /// Gets the desired camera rotation depending on the given SmartObject /// as a lookat target and the type of rotation. /// </summary> public Quaternion GetDesiredRotation(SmartObject lookAt) { if (RotationType == CameraRotationType.Fixed) { return FixedRotation; } else { Animator animator = lookAt.GetComponent<Animator>(); Vector3 target = animator == null ? lookAt.transform.position : animator.GetBoneTransform(HumanBodyBones.Head).position; return Quaternion.LookRotation(target - Camera.main.transform.position); } }