void FixedUpdate() { if (shootingBlockState == ShootingBlockState.NotStarted) { // Increase Block Mass while shooting ScaleMass(); startTime = Time.time; shootingBlockState = ShootingBlockState.Shooting; Debug.Log("Shooting Block - shooting"); } if (shootingBlockState == ShootingBlockState.Shooting) { if ((rigidbody.velocity.sqrMagnitude < 0.01 && Time.time - startTime > 1) || Time.time - startTime > maxTimeForShot) { rigidbody.mass = initMass; rigidbody.drag = initDrag; shootingBlockState = ShootingBlockState.Finished; finishedTime = Time.time; Debug.Log("Shooting Block - finished"); } } }
void Start() { shootingBlockState = ShootingBlockState.NotStarted; }