private void GenerateDestination() { Grid grid = LevelGenerator.LevelGenerator.INSTANCE.Grid; float halfWidth = grid.Width / 2f; float halfHeight = grid.Height / 2f; while (!destination.HasValue || !grid.IsWalkable(destination.Value.x, destination.Value.z)) { destination = new Vector3(PRNG.GetFloatNumber(-halfWidth, halfWidth), 0, PRNG.GetFloatNumber(-halfHeight, halfHeight)); } interpolation = 0f; // Calculate the total time to walk the distance float time = PersonManager.INSTANCE.TimePerSquare; float distanceTime = Vector3.Distance(position, destination.Value) * (time < 0f ? 0.5f : time); speed = 1f / distanceTime; startPosition = position; timeSinceLast = 0f; //Debug.DrawLine(destination.Value, destination.Value + Vector3.up, Color.red, 3, false); }
protected Person() { if (!PRNG.IsInitialized) { PRNG.ChangeSeed(0); } // Generate some random values gender = (Gender)PRNG.GetNumber(0, 1); hearing = PRNG.GetFloatNumber(0, 1); scared = PRNG.GetFloatNumber(0, 1); buying = PRNG.GetFloatNumber(0, 1); angry = PRNG.GetFloatNumber(0, 1); sad = PRNG.GetFloatNumber(0, 1); speed = PRNG.GetFloatNumber(5, 10); voice = gender == Gender.Male ? PRNG.GetFloatNumber(0.90f, 1.00f) : PRNG.GetFloatNumber(1.05f, 1.15f); walking = false; paranoid = false; robbed = false; running = false; walkingInterval = PRNG.GetFloatNumber(0.5f, 0.9f); stepPitch = PRNG.GetFloatNumber(1f, 1.2f, 3); hasPosition = false; timePassed = 0f; // Generate a random name GenerateRandomName(); }
public virtual void Update() { timePassed += Time.deltaTime; if (timePassed >= walkingInterval) { //walkingSource.pitch = PRNG.GetFloatNumber(stepPitch - 0.1f, stepPitch + 0.1f); //walkingSource.Play(); float pitch = PRNG.GetFloatNumber(stepPitch - 0.1f, stepPitch + 0.1f); sourceManager.PlaySound(AudioManager.GetFragment("footstep"), pitch); timePassed = 0f; } }
public Talker(Person original) : base(original) { conversationDuration = PRNG.GetFloatNumber(5, 15); timePassed = 0; }