Stagger and Oscillate OnValidate

In this section I was having trouble because stagger should be able to be enabled without oscillate, but oscillate should not be enabled UNLESS stagger is on. After having a think, it appears that you can just comment out or delete the (!oscillate) part and this fixes that problem.

private void OnValidate() 
    {
        if (oscillate) { stagger = true; }
        //if (!oscillate) { stagger = false; } 
        if (projectilesPerBurst < 1) {projectilesPerBurst = 1; }
        if (projectilesPerBurst < 1) {burstCount = 1; }
        if (timeBetweenBursts < 0.1f) {timeBetweenBursts = 0.1f; }
        if (restTime < 0.1f) {restTime = 0.1f; }
        if (startingDistance < 0.1f) {startingDistance = 0.1f; }
        if (angleSpread == 0) {projectilesPerBurst = 1; }
        if (bulletMoveSpeed <= 0) { bulletMoveSpeed = 0.1f; }
    }

Yes, I did something similar myself. Well done!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms