public void Awake() { _networkLocomotionComponentViewRPC = FindReplicationViewForComponent <NetworkLocomotionComponent>(); _locomotion = GetComponent <LocomotionComponentAPP>(); _rvoController = GetComponent <RVOController>(); _isCurrentlyLocal = AmILocal(); _currentOwnerId = _networkLocomotionComponentViewRPC.ownerId; }
// start the swivel private void StartSwivel(Vector3 dir) { LocomotionComponentAPP loco = player.GetComponent <LocomotionComponentAPP>(); if (null != loco) { loco.LookAtPosition(player.transform.position + dir, true); } }
static public void OrientFacing(GameObject orient, GameObject lookAt) { if (null != orient && null != lookAt) { LocomotionComponentAPP loco = orient.GetComponent <LocomotionComponentAPP>(); if (null != loco) { loco.LookAtPosition(lookAt.transform.position, true); Interaction activeInteraction = Dialogue.GetActiveInteraction(); if (null != activeInteraction) { activeInteraction.LockCharacterRotation(loco); } } } }
// lock a character's rotation public void LockCharacterRotation(LocomotionComponentAPP loco) { if (null != loco) { int index = _charactersInfo.FindIndex(charInfo => charInfo.gameObj == loco.gameObject); if (index < 0 || index >= _charactersInfo.Count) // out of range { _charactersInfo.Add(new InteractionCharacterInfo(loco.gameObject, loco)); } else if (loco != _charactersInfo[index].loco) // update existing entry { InteractionCharacterInfo info = _charactersInfo[index]; info.loco = loco; _charactersInfo[index] = info; } loco.ExclusivelyRotate(true); } }
//public NPCStatsComponent stats; public InteractionCharacterInfo(GameObject gameObj, LocomotionComponentAPP loco) { this.gameObj = gameObj; this.loco = loco; }