// PUBLIC METHODS: ------------------------------------------------------------------------ public CharacterHeadTrack GetHeadTracker() { if (this.headTrack == null) { this.headTrack = gameObject.GetComponentInChildren <CharacterHeadTrack>(); if (this.headTrack == null && this.animator != null && this.animator.isHuman) { this.headTrack = this.animator.gameObject.AddComponent <CharacterHeadTrack>(); } } return(this.headTrack); }
// EXECUTABLE: ---------------------------------------------------------------------------- public override bool InstantExecute(GameObject target, IAction[] actions, int index) { Character sourceCharacter = this.character.GetCharacter(target); if (sourceCharacter != null) { CharacterHeadTrack headTrack = sourceCharacter.GetHeadTracker(); if (headTrack != null) { switch (this.trackState) { case TRACK_STATE.TrackTarget: headTrack.Track(this.trackTarget.GetTransform(target)); break; case TRACK_STATE.Untrack: headTrack.Untrack(); break; } } } return(true); }