private void FixedUpdate() { Debug.Log(ValidHands()); if (TrackHands) { if (!ValidHands()) { HandsShakeTimer = 0; } else { HandsShakeTimer += Time.deltaTime; } } if (HandsShakeTimer > 2) { if (SnowMoundBehavior.canSpawnSnowball) { SnowballBehavior b = Instantiate(vrHands.SnowballPrefab).GetComponent <SnowballBehavior>(); b.SetOVRGrabberFollow(GetOVRGrabber(true)); } else { Snowfall.ActiveSnowball().ScaleUp(LeftHandPositionDerivative + RightHandPositionDerivative); Debug.Log("Add to snowball" + (LeftHandPositionDerivative + RightHandPositionDerivative)); } } }
public MainWindow() { InitializeComponent(); //1. Default instance //Snowfall snow = new Snowfall(DrawingCanvas); //snow.Start(); //2. SnowfallColor.Default //Snowfall snow = Snowfall.Create(DrawingCanvas, SnowfallColor.Default); //snow.Start(); //3. SnowfallColor.White //Snowfall snow = Snowfall.Create(DrawingCanvas, SnowfallColor.White); //snow.Start(); //4. SnowfallColor.Blue //Snowfall snow = Snowfall.Create(DrawingCanvas, SnowfallColor.Blue); //snow.Start(); //4. SnowfallColor.Gray //Snowfall snow = Snowfall.Create(DrawingCanvas, SnowfallColor.Gray); //snow.Start(); //5. SnowfallColor.Mix Snowfall snow = Snowfall.Create(DrawingCanvas, SnowfallColor.Mix); snow.Start(); }
public static IEnumerator SufficientHandMovement(float threshold, float seconds) { float t = 0; while (ValidHands(threshold) && t < seconds) { t += 1; yield return(new WaitForSeconds(1)); if (t > seconds) { break; } } if (t >= seconds) { if (SnowMoundBehavior.canSpawnSnowball) { SnowballBehavior b = Instantiate(vrHands.SnowballPrefab).GetComponent <SnowballBehavior>(); b.SetOVRGrabberFollow(GetOVRGrabber(true)); Debug.Log("Sufficient Hand Movement, spawn snowball"); } else { Snowfall.ActiveSnowball().ScaleUp(LeftHandPositionDerivative + RightHandPositionDerivative); Debug.Log("Add to snowball" + (LeftHandPositionDerivative + RightHandPositionDerivative)); } } else { yield return(vrHands.StartCoroutine(SufficientHandMovement(threshold, seconds))); } }
private void Awake() { if (snowfall == null) { snowfall = this; } else { Destroy(this); } activeSnowballs = new List <SnowballBehavior>(); TimeRemaining = 250f; snowFallParticle = GetComponentInChildren <ParticleSystem>(); Debug.Log("Obtained reference to Snowfall Particle System"); RateOfIncrease = 0.1f; activeSnowballs.Capacity = 1; }