public void InitPed(Vector3 position, List <Vector3> pedSpawnerTargets, int seed) { FixedUpdateManager = SimulatorManager.Instance.FixedUpdateManager; RandomGenerator = new System.Random(seed); Path = new NavMeshPath(); agent = GetComponent <NavMeshAgent>(); anim = GetComponentInChildren <Animator>(); distributedAnimator = anim.GetComponent <DistributedAnimator>(); rb = GetComponent <Rigidbody>(); targets = pedSpawnerTargets; Name = transform.GetChild(0).name; if (RandomGenerator.Next(2) == 0) { targets.Reverse(); } agent.avoidancePriority = RandomGenerator.Next(1, 100); // set to 0 for no avoidance agent.updatePosition = false; agent.updateRotation = false; agent.Warp(position); agent.transform.rotation = Quaternion.identity; }
public void InitManual(Vector3 position, Quaternion rotation, int seed) { FixedUpdateManager = SimulatorManager.Instance.FixedUpdateManager; RandomGenerator = new System.Random(seed); Path = new NavMeshPath(); agent = GetComponent <NavMeshAgent>(); anim = GetComponentInChildren <Animator>(); distributedAnimator = anim.GetComponent <DistributedAnimator>(); rb = GetComponent <Rigidbody>(); Name = transform.GetChild(0).name; agent.avoidancePriority = 0; agent.updatePosition = false; agent.updateRotation = false; agent.Warp(position); agent.transform.rotation = rotation; thisPedState = PedestrianState.None; Control = ControlType.Manual; }