Пример #1
0
        public void Fire(float explosionSize)
        {
            Anim.SetTrigger("Shoot");
            InParticles.Stop(true, ParticleSystemStopBehavior.StopEmitting);
            foreach (var part in LongParticles)
            {
                part.Stop(true, ParticleSystemStopBehavior.StopEmitting);
            }

            timer = timeToDespawnAfterFire;

            if (explosionSize > 0)
            {
                Vector3 pos = endPos;
                ExplosionEffectManager.Spawn(pos, explosionSize);
            }
        }
        private void Update()
        {
            var pos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

            pos.y = 0;

            if (Input.GetKeyDown(KeyCode.Space))
            {
                ExplosionEffectManager.Spawn(pos, 12);
            }

            if (Input.GetKeyDown(KeyCode.Mouse0))
            {
                posA = pos;
            }

            if (Input.GetKeyDown(KeyCode.Mouse1))
            {
                posB = pos;
            }

            if (Input.GetKeyDown(KeyCode.S))
            {
                lastRailgun = RailgunEffectManager.Spawn(posA, posB);
            }

            if (Input.GetKeyDown(KeyCode.F))
            {
                lastRailgun?.Fire(12);
            }

            if (Input.GetKeyDown(KeyCode.A))
            {
                Visible = !Visible;
            }

            ExplosionEffectManager.Tick(Visible);
            RailgunEffectManager.Tick(Visible);
        }