public override void Activate(PlayerHero hero)
 {
     base.Activate(hero);
     this.knight = (KnightHero)hero;
     stunArea.Init(hero.player, StunEnemy);
     knight.OnKnightShieldHit += ExecuteAreaAttack;
 }
 public override void Activate(PlayerHero hero)
 {
     base.Activate(hero);
     this.knight = (KnightHero)hero;
     knight.player.OnPlayerDamaged += AbsorbDamage;
     StartCoroutine(ChargeRoutine());
     ActivateShield();
 }
Beispiel #3
0
 public override void Activate(PlayerHero hero)
 {
     base.Activate(hero);
     knight = (KnightHero)hero;
     knight.OnKnightShieldHit += Charge;
     // Initialize the new ability
     areaAttackAbility.Init(hero.player, DamageEnemy);
 }
 public override void Activate(PlayerHero hero)
 {
     base.Activate(hero);
     knight = (KnightHero)hero;
     // Set hero event listeners
     knight.OnKnightShieldHit    += AddSword;
     knight.OnKnightRushHitEnemy += AttackSword;
     // Set animation frame listeners
     addSword.Init(hero.player, ADD_SWORD_FRAME);
     attackSword.Init(hero.player, ATTACK_SWORD_FRAME);
     addSword.onFrameReached    += HandleOnAddSwordFrameReached;
     attackSword.onFrameReached += HandleOnAttackSwordFrameReached;
     // Set powerup properties
     percentActivated = 0;
 }
    private IEnumerator TutorialScene()
    {
        // Get data from GameManager
        Pawn          pawn  = gm.selectedPawn;
        SoundManager  sound = SoundManager.instance;
        CameraControl cam   = CameraControl.instance;

        // Initialize components
        map.chosenMap = mapType;
        map.GenerateMap();
        player.Init(pawn);
        knight             = (KnightHero)player.hero;
        enemyManager.level = 1;

        SoundManager.instance.PlayMusicLoop(map.data.musicLoop, map.data.musicIntro);

        gm.OnSceneLoaded -= Init;           // Remove the listener because it is only run once per scene


        // Step -2: Swipe
        DisableTap();
        DisableSpecialAbility();
        tutorialTaskView.Init("Swipe to use your Rush Ability", false);

        knight.OnKnightRush += IncrementRushCount;
        while (knightRushCount < 1)
        {
            yield return(null);
        }
        tutorialTaskView.SetCompleted(true);
        sound.PlayUISound(taskCompleteSound);
        yield return(new WaitForSeconds(TASK_DELAY_INTERVAL));

        knightRushCount = 0;

        // Step -1: Learn swipe controls
        tutorialTaskView.SetCompleted(false);
        while (knightRushCount < 3)
        {
            tutorialTaskView.SetText(string.Format("Use your Rush Ability 3 times ({0}/3)", knightRushCount));
            yield return(null);
        }
        tutorialTaskView.Init("Use your Rush Ability 3 times (3/3)", true);
        sound.PlayUISound(taskCompleteSound);
        yield return(new WaitForSeconds(TASK_DELAY_INTERVAL));

        knightRushCount = 0;
        abilitiesBar.abilityIcons[0].StopFlashHighlight();
        knight.OnKnightRush -= IncrementRushCount;

        // Step 0: Learn tap controls
        tutorialTaskView.SetCompleted(false);
        PlayKnightCharDialogue(0);
        yield return(new WaitUntil(() => !dialogueView.dialoguePlaying));

        cam.ResetFocus();

        tutorialTaskView.Init("Use your Shield Ability 2 times (0/2)", false);
        //controlPointer.gameObject.SetActive(true);
        //controlPointer.CrossFade("Tap", 0f);
        //abilitiesBar.abilityIcons[1].FlashHighlight(Color.white);
        EnableTap();

        knight.OnKnightShield += IncrementShieldCount;

        // Tip about cooldown timers
        while (knightShieldCount < 1)
        {
            yield return(null);
        }
        yield return(new WaitForSecondsRealtime(1.0f));

        highlighter.Highlight(abilitiesBar.abilityIcons[1].image.rectTransform.position,
                              abilitiesBar.abilityIcons[1].image.rectTransform.sizeDelta);
        tipText.text = "Keep an eye on your cooldown timers. You can't use an ability while it is cooling down!";
        while (highlighter.gameObject.activeInHierarchy)
        {
            yield return(null);
        }

        while (knightShieldCount < 2)
        {
            tutorialTaskView.SetText(string.Format("Use your Shield Ability 2 times ({0}/2)", knightShieldCount));
            yield return(null);
        }
        tutorialTaskView.Init("Use your Shield Ability 2 times (2/2)", true);
        sound.PlayUISound(taskCompleteSound);
        yield return(new WaitForSeconds(TASK_DELAY_INTERVAL));

        abilitiesBar.abilityIcons[1].StopFlashHighlight();
        //controlPointer.gameObject.SetActive(false);
        knightShieldCount      = 0;
        knight.OnKnightShield -= IncrementShieldCount;

        // Step 1: Attacking a dummy
        PlayKnightCharDialogue(1);
        yield return(new WaitUntil(() => !dialogueView.dialoguePlaying));

        cam.ResetFocus();

        tutorialTaskView.Init("Destroy the dummy", false);
        GameObject trainingDummy      = enemyManager.SpawnEnemy(trainingDummyPrefab, map.CenterPosition);
        Enemy      trainingDummyEnemy = trainingDummy.GetComponentInChildren <Enemy>();

        trainingDummyEnemy.OnEnemyDamaged += SetOuchText;
        ouchText.GetComponent <UIFollow>().Init(trainingDummy.transform, trainingDummyEnemy.healthBarOffset * 1.5f);
        while (trainingDummy.gameObject.activeInHierarchy)
        {
            yield return(null);
        }
        tutorialTaskView.SetCompleted(true);
        sound.PlayUISound(taskCompleteSound);
        yield return(new WaitForSeconds(TASK_DELAY_INTERVAL));

        // Step 2: Learn the parry
        PlayKnightCharDialogue(2);
        yield return(new WaitUntil(() => !dialogueView.dialoguePlaying));

        cam.ResetFocus();

        //tutorialTaskView.Init("Parry 5 times (0/5)", false);
        Enemy attackingDummy = enemyManager.SpawnEnemy(attackingDummyPrefab, map.CenterPosition + (Vector3.right * 2f)).GetComponentInChildren <Enemy>();

        attackingDummy.invincible = true;
        knight.onParry           += IncrementParryCount;
        tutorialTaskView.SetCompleted(false);
        while (parryCount < 5)
        {
            tutorialTaskView.SetText(string.Format("Parry 5 times ({0}/5)", parryCount));
            yield return(null);
        }
        tutorialTaskView.Init("Parry 5 times (5/5)", true);
        sound.PlayUISound(taskCompleteSound);
        yield return(new WaitForSeconds(TASK_DELAY_INTERVAL));

        attackingDummy.invincible = false;
        attackingDummy.GetComponentInChildren <Enemy>().Damage(999);
        parryCount      = 0;
        knight.onParry -= IncrementParryCount;

        // Step 3: Finish tutorial
        PlayKnightCharDialogue(3);
        yield return(new WaitUntil(() => !dialogueView.dialoguePlaying));

        yield return(new WaitForSeconds(1.0f));

        GameManager.instance.GoToScene("Tutorial2");
    }
Beispiel #6
0
    private IEnumerator TutorialScene()
    {
        // Get data from GameManager
        Pawn          pawn  = gm.selectedPawn;
        SoundManager  sound = SoundManager.instance;
        CameraControl cam   = CameraControl.instance;

        // Initialize components
        map.chosenMap = mapType;
        map.GenerateMap();
        player.Init(pawn);
        knight             = (KnightHero)player.hero;
        enemyManager.level = 1;

        gm.OnSceneLoaded -= Init;           // Remove the listener because it is only run once per scene

        /*yield return new WaitForSeconds(TASK_DELAY_INTERVAL);
         * player.input.isInputEnabled = false;
         * // Step 0: Congratulations
         * PlayKnightCharDialogue(0);
         * yield return new WaitUntil(() => !dialogueView.dialoguePlaying);
         *
         * // Step 1: What's going on?
         * cam.StartShake(3.0f, 0.05f, true, true);
         * yield return new WaitForSeconds(3.0f);
         * PlayKnightCharDialogue(1);
         * while (dialogueView.dialoguePlaying)
         * {
         *      cam.StartShake(0.1f, 0.05f, true, true);
         *      yield return new WaitForSeconds(0.1f);
         * }
         *
         * cam.SetFocus(darkLordCharacter.transform);
         * yield return new WaitForSeconds(1.0f);
         * cam.StartFlashColor(Color.white, 1, 0, 0, 1);
         * darkLordCharacter.gameObject.SetActive(true);
         * darkLordCharacter.Play();
         * yield return new WaitForSeconds(2.0f);
         *
         * // Step 2: Dark Lord appears!
         * PlayDarkLordCharDialogue(2);
         * yield return new WaitUntil(() => !dialogueView.dialoguePlaying);
         * cam.SetFocus(knightPropsCenterFocusPoint.transform);
         * yield return new WaitForSeconds(1.0f);
         * cam.StartFlashColor(Color.white, 1, 0, 0, 1);
         * foreach(GameObject o in knightPropCharacters)
         * {
         *      o.SetActive(false);
         *      enemyManager.SpawnEnemy(trappedHeroShardPrefab, o.transform.position);
         * }
         * yield return new WaitForSeconds(2.0f);
         *
         * // Step 3: Dark Lord hahahaha!
         * PlayDarkLordCharDialogue(3);
         * yield return new WaitUntil(() => !dialogueView.dialoguePlaying);
         * yield return new WaitForSeconds(0.5f);
         * cam.ResetFocus();
         * yield return new WaitForSeconds(1.0f);
         *
         * // Step 4: Hmm that usually works on all heroes; anyways, farewell
         * PlayDarkLordCharDialogue(4);
         * yield return new WaitUntil(() => !dialogueView.dialoguePlaying);
         * cam.StartFlashColor(Color.white, 1, 0, 0, 1);
         * darkLordCharacter.gameObject.SetActive(false);
         * yield return new WaitForSeconds(1.0f);
         *
         * // Step 5: Knight - Dark Lord is weak, so he can't have gone far
         * PlayKnightCharDialogue(5);
         * yield return new WaitUntil(() => !dialogueView.dialoguePlaying);
         * cam.StartShake(3.0f, 0.02f, true, true);
         * yield return new WaitForSeconds(3.0f);
         *
         * // Step 6: Enemies coming, defend the trapped heroes
         * PlayKnightCharDialogue(6);
         * while (dialogueView.dialoguePlaying)
         * {
         *      cam.StartShake(0.1f, 0.02f, true, true);
         *      yield return new WaitForSeconds(0.1f);
         * }
         * cam.StartShake(1.5f, 0.01f, true, true);
         * yield return new WaitForSeconds(1.0f);
         * player.input.isInputEnabled = true;*/

        cam.StartFlashColor(Color.white, 1, 0, 0, 1);
        knightCharacter.gameObject.SetActive(false);
        yield return(new WaitForSeconds(0.5f));

        StartCoroutine(EnemySpawningRoutine());
    }