Пример #1
0
        /// <summary>
        /// Waits some time until the super attack can start.
        /// </summary>
        /// <param name="time">The time to wait until starting the super attack.</param>
        /// <returns>The time which is being waited.</returns>
        private IEnumerator superAttackCharginTime(float time)
        {
            // snail is rolling only
            animation["Super Attack Rolling"].speed = 2f;
            animation["Super Attack Rolling"].wrapMode = WrapMode.Loop;

            // snail can't be hit
            state = INVINCIBLE;
            this.gameObject.playAnimationIfExists("Super Attack Rolling");
            this.gameObject.rigidbody.velocity = transform.forward * 100f;

            const float EFFECT_X_POSITION = 5f;
            const float EFFECT_Y_POSITION = 3f;

            // Position of the Flames
            Vector3 explosionPosition = new Vector3(
                this.gameObject.transform.position.x + EFFECT_X_POSITION,
                this.gameObject.transform.position.y + EFFECT_Y_POSITION,
                this.gameObject.transform.position.z + this.gameObject.transform.localScale.z / 2);

            // Flames of the out of the Garry While doing Super Attack
            garyRollingEffect = (GameObject)Instantiate(GaryRollingEffect, explosionPosition, this.gameObject.transform.rotation);
            garyRollingEffect.rigidbody.velocity = this.gameObject.rigidbody.velocity;

            yield return new WaitForSeconds(time);

            // stop superattack after a time
            gameObject.animation.Stop();
            this.gameObject.playAnimationIfExists("Super Attack Out");
            state = READY;
            Destroy(this.gameObject.GetComponent<SnailSuperAttack>());
            snailSuperAttack = null;
        }
Пример #2
0
        /// <summary>
        /// Initializes the super attack (rolling on the ground).
        /// </summary>
        public override void superAttack()
        {
            // Delaytime for loading of other routines
            const float LOAD_FACTOR = 4f;

            this.state = ATTACKING;
            snailSuperAttack = this.gameObject.AddComponent<SnailSuperAttack>();
            snailSuperAttack.init(this.playerID, 0, 0.8f);
            snailSuperAttack.setDirection(movingLeft);
            snailSuperAttack.attacker = this;
            this.attack = snailSuperAttack;
            this.attack.ownerID = this.playerID;

            // start loading the superAttack
            // Coroutine will also starts the other animationcoroutines for the superattack
            StartCoroutine(loadSuperAttack(LOAD_FACTOR));
        }