private void Start() { _activeTextures = new List <Texture2D>(); randomizeTeleportDirection(); _lifeMask = renderer.material.GetTexture("_DisplacementMask"); _lifeShrink = renderer.material.GetFloat("_DefaultShrink"); _lifeNormalPush = renderer.material.GetFloat("_NormalPush"); _lifeShrinkFacesAmplitude = renderer.material.GetFloat("_Shrink_Faces_Amplitude"); _state = Enum.GetValues(typeof(TeleportingState)).Random <TeleportingState>(); if (_state == TeleportingState.Invisible) { TransitionToInvisible(); } else if (_state == TeleportingState.Visible) { TransitionToVisible(); } else if (_state == TeleportingState.Growing) { TransitionToGrowing(); } else if (_state == TeleportingState.Shrinking) { TransitionToShrinking(); } if (_state == TeleportingState.Teleport || _state == TeleportingState.TeleportVisible) { TransitionToTeleportVisible(); } if (_state == TeleportingState.TeleportBack || _state == TeleportingState.TeleportBackVisible) { TransitionToTeleportBackVisible(); } _t = (float)Rng.Dbl(); }
private void Start() { _lifeMask = renderer.material.GetTexture("_DisplacementMask"); _lifeShrink = renderer.material.GetFloat("_DefaultShrink"); _lifeNormalPush = renderer.material.GetFloat("_NormalPush"); _lifeShrinkFacesAmplitude = renderer.material.GetFloat("_Shrink_Faces_Amplitude"); _state = Enum.GetValues(typeof(BlinkingState)).Random <BlinkingState>(); if (_state == BlinkingState.Invisible) { TransitionToInvisible(); } else if (_state == BlinkingState.Visible) { TransitionToVisible(); } else if (_state == BlinkingState.Growing) { TransitionToGrowing(); } else if (_state == BlinkingState.Shrinking) { TransitionToShrinking(); } _t = (float)Rng.Dbl(); }
private void ComplainIfImpatient() { if (Patience.Value < 10 && Patience.Value > 0 && Patience.Value % 3 == 0) { Complain(); } if (Patience.Value == 0 && Rng.Dbl() < 0.5) { AnnouceHangingUp(); } }
public Optional <bool> Value(double chanceOfTrue = 0.5d) { if (CanBeTrue && CanBeFalse) { return(new Optional <bool>(Rng.Dbl() < chanceOfTrue)); } if (CanBeTrue) { return(new Optional <bool>(true)); } if (CanBeFalse) { return(new Optional <bool>(false)); } return(new Optional <bool>()); }
private void Start() => _direction = new Vector3((float)Rng.Dbl() * 2 - 1, (float)Rng.Dbl() * 2 - 1, (float)Rng.Dbl() * 2 - 1);
public override bool Condition() { return(Rng.Dbl() <= _chance); }