public void enteredDetectionRange(AirStream stream) { if (!isInDetectionRange) { //user is not in detection range yet, so entering detection range detectedAirStream = stream; } else if (!isInAirstream && detectedAirStream != stream) { if (stream.isClostestAirstream(this, stream, detectedAirStream)) { //user detected an airstream that is closest. user is not in an airstream detectedAirStream = stream; } else { //user detected an airstream but it is NOT closest. user is not in an airstream } } if (isInAirstream && !detectedAirStreams.Contains(stream) && stream != detectedAirStream) { //user is in an airstream and detected by another airstream stream.enterParticleStream(this, stream.getOtherPoint(detectedAirStream.ps.transform)); } detectedAirStreams.Add(stream); stream.inDetectionRange.Add(this); detectedAirstreamsCount++; }
/// <summary> /// Frame when Deltaflyer entered an airstream /// </summary> /// <param name="movingDirection"></param> public void enteredAirstream(AirStream stream) { Debug.Log("entered an airstream"); stream.inAirstream.Add(this); currentAirStream = stream; detectedAirStream = stream; Transform movingDir = stream.getMovingToPoint(this); foreach (AirStream tempStream in detectedAirStreams) { tempStream.enterParticleStream(this, stream.getOtherPoint(movingDir)); } detectedAirStream.enterParticleStream(this, movingDir); inputMngr.velocity *= 2; foreach (ContactPoint cp in contactPoints) { cp.force = 40; } //foreach (AirStream tmpAs in detectedAirStreams) //{ // tmpAs.notifyParticles.gameObject.SetActive(true); //} }