Beispiel #1
0
        public void AddAether(CheckpointView checkpointView, PlayerView playerView, int aetherCount)
        {
            ParticleTargetRequest particleTargetRequest = new ParticleTargetRequest()
            {
                particleSystem     = checkpointView.AetherAward,
                particleCount      = aetherCount,
                targetTime         = settings.aetherTargetTime,
                targetTransform    = playerView.transform,
                particleTargetType = ParticleTargetType.Aether,
                playerView         = playerView,
            };

            checkpointView.ParticleTargetView.Target(particleTargetRequest);
        }
        public void Target(ParticleTargetRequest particleTargetRequest)
        {
            ParticleSystem particleSystem = particleTargetRequest.particleSystem;

            if (!targetMapping.ContainsKey(particleSystem))
            {
                targetMapping.Add(particleSystem, new ParticleTargetFulfillment()
                {
                    tweening = false
                });
            }

            ParticleTargetFulfillment particleTargetFulfillment = targetMapping[particleSystem];

            if (particleTargetFulfillment.tweening)
            {
                return;
            }

            particleTargetFulfillment = new ParticleTargetFulfillment()
            {
                tweening               = true,
                particles              = new ParticleSystem.Particle[particleTargetRequest.particleCount],
                particleCount          = particleTargetRequest.particleCount,
                fulfilledParticleCount = 0,
                targetTransform        = particleTargetRequest.targetTransform,
                particleTargetType     = particleTargetRequest.particleTargetType,
                playerView             = particleTargetRequest.playerView,
                playerFacade           = particleTargetRequest.playerFacade,
                itemType               = particleTargetRequest.itemType,
            };

            particleSystem.Emit(particleTargetRequest.particleCount);
            particleSystem.GetParticles(particleTargetFulfillment.particles);

            targetMapping[particleSystem] = particleTargetFulfillment;

            targetHashtable["time"]     = particleTargetRequest.targetTime;
            targetHashtable["onupdate"] = (Action <object>)(attractionForce => {
                OnAttractParticles(particleSystem, (float)attractionForce);
            });
            targetHashtable["oncompleteparams"] = particleSystem;

            iTween.ValueTo(gameObject, targetHashtable);
        }
Beispiel #3
0
        public void Respawn(PlayerFacade playerFacade)
        {
            if (!playerDeaths[playerFacade])
            {
                return;
            }

            PlayerView playerView     = playerFacade.PlayerView;
            Transform  spawnTransform = spawnManager.CurrentSpawnView.SpawnTransform(playerFacade.Input.DeviceNum);

            ParticleTargetRequest particleTargetRequest = new ParticleTargetRequest()
            {
                particleSystem     = playerView.Respawn,
                particleCount      = 1,
                targetTime         = Mathf.Sqrt((playerView.Position - spawnTransform.position).magnitude) * settings.respawnTargetFactor,
                targetTransform    = spawnTransform,
                particleTargetType = ParticleTargetType.Respawn,
                playerFacade       = playerFacade,
            };

            spawnManager.CurrentSpawnView.ParticleTargetView.Target(particleTargetRequest);
        }