コード例 #1
0
        /// <summary>
        /// The player can attack his enemy with a standard attack
        /// </summary>
        public void standardAttack()
        {
            GameObject sA = (GameObject)Instantiate(simpleAttack, this.transform.position, this.gameObject.transform.rotation);
            this.attack = (SimpleAttack)sA.GetComponent(typeof(SimpleAttack));
            this.attack.init(playerID, STANDARD_ATTACK_FORCE, STANDARD_ATTACK_DAMAGE);
            this.attack.setDirection(movingLeft);
            this.attack.attacker = this;

            this.gameObject.playAnimationIfExists("Simple Attack");
            this.gameObject.playSoundIfExists(simpleMeleeAttackSound, 1f);
        }
コード例 #2
0
        /// <summary>
        /// Throws the enemy.
        /// </summary>
        public void throwEnemy()
        {
            this.gameObject.playSoundIfExists(throwAttackSound, 0.8f);
            GameObject tossRange = (GameObject)Instantiate(simpleAttack, this.transform.position, this.gameObject.transform.rotation);
            Destroy(tossRange.GetComponent<SimpleAttack>());
            this.attack = (Throw)tossRange.AddComponent("Throw");
            this.attack.init(playerID, 0, 0);
            this.attack.setDirection(movingLeft);
            this.attack.attacker = this;

            this.gameObject.playAnimationIfExists("Throw Attack");
        }
コード例 #3
0
        /// <summary>
        /// The player can attack his enemy with a Big Melee Attack
        /// </summary>
        public void bigMeleeAttack()
        {
            const int ATTACK_DELAY = 1;

            GameObject bMA = (GameObject)Instantiate(bMeleeAttack, this.transform.position, this.gameObject.transform.rotation);
            this.attack = (BigMeleeAttack)bMA.GetComponent(typeof(BigMeleeAttack));
            this.attack.init(playerID, STANDARD_ATTACK_FORCE, STANDARD_ATTACK_DAMAGE, ATTACK_DELAY);
            this.attack.setDirection(movingLeft);
            this.attack.attacker = this;

            this.gameObject.playAnimationIfExists("Big Melee Attack");
            this.gameObject.playSoundIfExists(bigMeleeAttackSound, 0.3f);
        }