public RandomRotationSpeed(IKeyValueCollection keyValues) { if (keyValues.ContainsKey("m_nFieldOutput")) { fieldOutput = (ParticleField)keyValues.GetIntegerProperty("m_nFieldOutput"); } if (keyValues.ContainsKey("m_bRandomlyFlipDirection")) { randomlyFlipDirection = keyValues.GetProperty <bool>("m_bRandomlyFlipDirection"); } if (keyValues.ContainsKey("m_flDegrees")) { degrees = keyValues.GetFloatProperty("m_flDegrees"); } if (keyValues.ContainsKey("m_flDegreesMin")) { degreesMin = keyValues.GetFloatProperty("m_flDegreesMin"); } if (keyValues.ContainsKey("m_flDegreesMax")) { degreesMax = keyValues.GetFloatProperty("m_flDegreesMax"); } }
void CleanupAnimation() { mRootView.RemoveView(mDrawingView); mDrawingView = null; mRootView.PostInvalidate(); mParticles.AddRange(mActiveParticles); }
public static Vector3 GetVector(this Particle particle, ParticleField field) { switch (field) { case ParticleField.Position: return(particle.Position); case ParticleField.PositionPrevious: return(particle.PositionPrevious); } return(Vector3.Zero); }
public static float GetScalar(this Particle particle, ParticleField field) { switch (field) { case ParticleField.Alpha: return(particle.Alpha); case ParticleField.AlphaAlternate: return(particle.AlphaAlternate); case ParticleField.Radius: return(particle.Radius); } return(0f); }
private void StartEmiting(int particlesPerSecond, int emitingTime) { mActivatedParticles = 0; mParticlesPerMilisecond = particlesPerSecond / 1000f; // Add a full size view to the parent view mDrawingView = new ParticleField(mRootView.Context); mRootView.AddView(mDrawingView); mDrawingView.Particles = mActiveParticles; UpdateParticlesBeforeStartTime(particlesPerSecond); mEmitingTime = emitingTime; StartAnimator(new LinearInterpolator(), emitingTime + mTimeToLive); }
void StartEmiting(int particlesPerSecond) { mActivatedParticles = 0; mParticlesPerMilisecond = particlesPerSecond / 1000f; // Add a full size view to the parent view mDrawingView = new ParticleField(mRootView.Context); mRootView.AddView(mDrawingView); mEmitingTime = -1; // Meaning infinite mDrawingView.Particles = mActiveParticles; UpdateParticlesBeforeStartTime(particlesPerSecond); //mTimer = new Timer(); mHandler = new Handler(); mHandler.PostDelayed(() => { OnUpdate(CurrentTime); CurrentTime += TIMERTASK_INTERVAL; }, TIMERTASK_INTERVAL); }
public void OneShot(View emiter, int numParticles, IInterpolator interpolator) { ConfigureEmiter(emiter, GravityFlags.Center); mActivatedParticles = 0; mEmitingTime = mTimeToLive; // We create particles based in the parameters for (int i = 0; i < numParticles && i < mMaxParticles; i++) { ActivateParticle(0); } // Add a full size view to the parent view mDrawingView = new ParticleField(mRootView.Context); mRootView.AddView(mDrawingView); mDrawingView.Particles = mActiveParticles; // We start a property animator that will call us to do the update // Animate from 0 to timeToLiveMax StartAnimator(interpolator, mTimeToLive); }
public OscillateScalar(IKeyValueCollection keyValues) { if (keyValues.ContainsKey("m_nField")) { outputField = (ParticleField)keyValues.GetIntegerProperty("m_nField"); } if (keyValues.ContainsKey("m_RateMin")) { rateMin = keyValues.GetFloatProperty("m_RateMin"); } if (keyValues.ContainsKey("m_RateMax")) { rateMax = keyValues.GetFloatProperty("m_RateMax"); } if (keyValues.ContainsKey("m_FrequencyMin")) { frequencyMin = keyValues.GetFloatProperty("m_FrequencyMin"); } if (keyValues.ContainsKey("m_FrequencyMax")) { frequencyMax = keyValues.GetFloatProperty("m_FrequencyMax"); } if (keyValues.ContainsKey("m_flOscMult")) { oscillationMultiplier = keyValues.GetFloatProperty("m_flOscMult"); } if (keyValues.ContainsKey("m_flOscAdd")) { oscillationOffset = keyValues.GetFloatProperty("m_flOscAdd"); } if (keyValues.ContainsKey("m_bProportionalOp")) { proportional = keyValues.GetProperty <bool>("m_bProportionalOp"); } random = new Random(); }
public OffsetVectorToVector(IKeyValueCollection keyValues) { if (keyValues.ContainsKey("m_nFieldInput")) { inputField = (ParticleField)keyValues.GetIntegerProperty("m_nFieldInput"); } if (keyValues.ContainsKey("m_nFieldOutput")) { outputField = (ParticleField)keyValues.GetIntegerProperty("m_nFieldOutput"); } if (keyValues.ContainsKey("m_vecOutputMin")) { var vectorValues = keyValues.GetArray <double>("m_vecOutputMin"); offsetMin = new Vector3((float)vectorValues[0], (float)vectorValues[1], (float)vectorValues[2]); } if (keyValues.ContainsKey("m_vecOutputMax")) { var vectorValues = keyValues.GetArray <double>("m_vecOutputMax"); offsetMax = new Vector3((float)vectorValues[0], (float)vectorValues[1], (float)vectorValues[2]); } }
internal ParticleFieldAccessor(ParticleField field) { offset = field.Offset; }
internal ParticleFieldAccessor(ParticleField field) { offset = field.Offset; unitSize = field.Size; }
// ResultReporter reporter; // Use this for initialization void Start() { levelQueueSize = 4; loadedLevels = new Queue<DataLevel>(); masterLevelList = new Queue<string>(); loader = GetComponent<LevelLoader>(); loader.SetWidth(1000); loader.SetHeight(325); currentLevel = null; isInitalized = false; peeField = transform.parent.gameObject.GetComponent<ParticleField>(); StartCoroutine(Initialize()); }