Exemple #1
0
        /// <summary>
        /// Real Fire function, for use with: UpdateManager.SetTimeout
        /// </summary>
        protected virtual void _Fire()
        {
            // select projectile
            ProjectileCfg p = projectiles[currentIndex++];

            // reach the end -> reset, do this fast :)
            if (currentIndex == projectiles.Count)
            {
                currentIndex = 0;
            }

            // TODO REVIEW if Facing.None -> Facing.Left
            int dir = (int)character.faceDir;

            if (dir == 0)
            {
                dir = -1;
            }

            Vector3 offset = (Vector3)p.offset;

            offset.x *= dir;

            // unlesh hell
            Projectile new_p =
                p.projectile.Fire(character.transform.position + offset);

            new_p.velocity.x *= dir;
        }
Exemple #2
0
        /// <summary>
        /// Fire projectiles, regardless the cooldown,
        /// Call it after all checks
        /// </summary>
        public virtual void Fire()
        {
            if (fireMode)
            {
                for (int i = 0; i < projectiles.Count; ++i)
                {
                    UpdateManager.SetTimeout(_Fire, projectiles[i].delay);
                }
            }
            else
            {
                ProjectileCfg p = projectiles[currentIndex];
                p.delay = 0; // force no delay
                _Fire();
            }

            if (onFire != null)
            {
                onFire();
            }
        }