private void CreateSprayRotation(float sprayMultiplier) { Vector2 dirDiflection = UnityEngine.Random.insideUnitCircle; Vector3 dirDisplacementVector = new Vector3(dirDiflection.x, dirDiflection.y, 0); var randomMultiplier = RandomFromDistribution.RandomFromStandardNormalDistribution(); //we use standardDistribution to simulate real-shooting var absInputMultyplier = (Mathf.Abs(playerInput.Hinput) + 1) * (Mathf.Abs(playerInput.Vinput) + 1); absInputMultyplier = Mathf.Clamp(absInputMultyplier, absInputMultyplier, 2); //clamp input to make spray independent from moving direction dirDisplacementVector *= randomMultiplier * absInputMultyplier * sprayMultiplier; shootingPoint.transform.Rotate(dirDisplacementVector.x, dirDisplacementVector.y, 0); //take current rotation and change it based on offset vec }
/* Immigration */ void ResetCitizenSpawnCooldown() { TravelerCooldown = 4f; // Cooldown Minimum TravelerCooldown += Mathf.Abs(RandomFromDistribution.RandomFromStandardNormalDistribution()) * 2.0f; // Random contributon, typically close to 1.0f TravelerCooldown += Threat * 5.0f; // Spawn less often when threat is high }