Exemplo n.º 1
0
        public void OnAttractParticles(ParticleSystem particleSystem, float attractionForce)
        {
            ParticleTargetFulfillment particleTargetFulfillment = targetMapping[particleSystem];

            int particleCount = particleTargetFulfillment.particleCount;

            ParticleSystem.Particle[] particles          = particleTargetFulfillment.particles;
            ParticleTargetType        particleTargetType = particleTargetFulfillment.particleTargetType;
            Transform    targetTransform = particleTargetFulfillment.targetTransform;
            PlayerView   playerView      = particleTargetFulfillment.playerView;
            PlayerFacade playerFacade    = particleTargetFulfillment.playerFacade;

            for (int i = 0; i < particleCount; ++i)
            {
                particles[i].position += attractionForce * (targetTransform.position - particles[i].position).normalized + ((1f - (attractionForce / targetAttraction)) * particles[i].velocity * Time.deltaTime);
            }

            switch (particleTargetType)
            {
            case ParticleTargetType.Aether:
                OnAttractAether(particleSystem, particles, particleCount, targetTransform, playerView);
                break;

            case ParticleTargetType.Respawn:
                OnAttractRespawn(particles, particleCount, targetTransform, playerFacade);
                break;
            }

            particleSystem.SetParticles(particles, particles.Length);
        }
Exemplo n.º 2
0
        public void OnTargetEnd(ParticleSystem particleSystem)
        {
            ParticleTargetFulfillment particleTargetFulfillment = targetMapping[particleSystem];

            targetMapping[particleSystem] = new ParticleTargetFulfillment()
            {
                tweening = false
            };
            particleSystem.Clear();

            ParticleTargetType particleTargetType = particleTargetFulfillment.particleTargetType;
            int particleCount          = particleTargetFulfillment.particleCount;
            int fulfilledParticleCount = particleTargetFulfillment.fulfilledParticleCount;

            switch (particleTargetType)
            {
            case ParticleTargetType.Aether:
                OnAetherEnd(particleTargetFulfillment.playerView, particleCount - fulfilledParticleCount);
                break;

            case ParticleTargetType.Respawn:
                OnRespawnEnd(particleTargetFulfillment.playerFacade);
                break;
            }
        }