Пример #1
0
        private void Fire()
        {
            chargeEffect.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
            charge = false;
            reload = true;
            ProjectileModificators projectileModificators = new ProjectileModificators()
            {
                { ProjectileModifierProperty.PROPERTY_DAMAGE_MULTIPLIER, currentDamageMultiplier }
            };

            Instantiate(projectileSO).SetupProjectile(playerHandler.GetPlayerNumber(), playerHandler.GetPlayerVelocity(), fireTransform, projectileModificators);
        }
Пример #2
0
        public override void SetupProjectile(int playerNumber, float playerVelocity, Transform fireTransform, ProjectileModificators projectileModificators = null)
        {
            base.SetupProjectile(playerNumber, playerVelocity, fireTransform, projectileModificators);

            if (projectileInstance != null)
            {
                Vector3 projectileVelocity;
                if (playerVelocity > 0)
                {
                    projectileVelocity = (startingSpeed + playerVelocity) * fireTransform.forward;
                }
                else
                {
                    projectileVelocity = startingSpeed * fireTransform.forward;
                }
                ProjectileBehaviour projectileBehaviour = projectileInstance.GetComponent <ProjectileBehaviour>();

                projectileBehaviour.SetupProjectileBehaviour(this, projectileVelocity, ProjectileCallback.PROJECTILE_CALLBACK_ON_IMPACT);
            }
        }