public void CompleteQuest()
    {
        if (selectedQuest.IsComplete)
        {
            for (int i = 0; i < questGiver.MyQuests.Length; i++)
            {
                if (selectedQuest == questGiver.MyQuests[i])
                {
                    questGiver.MyCompletedQuest.Add(selectedQuest.MyTitle);
                    questGiver.MyQuests[i] = null;
                    selectedQuest.MyQuestGiver.UpdateQuestStatus();
                }
            }

            foreach (CollectObjective objective in selectedQuest.MyCollectObjectives)
            {
                InventoryScript.MyInstance.itemCountChangedEvent -= new ItemCountChanged(objective.UpdateItemCount);
                objective.Complete();
            }

            foreach (KillObjective objective in selectedQuest.MyKillObjectives)
            {
                GameManager.MyInstance.killConfirmedEvent -= new KillConfirmed(objective.UpdateKillCount);
            }

            Player.MyInstance.GainXp(XPManager.CalculateXP(selectedQuest));

            QuestLog.MyInstance.RemoveQuest(selectedQuest.MyQuestScript);
            Back();
        }
    }
Exemplo n.º 2
0
    public void CompleteQuest()
    {
        //퀘스트를 클리어시 NPC의 퀘스트들중에 찾아서 비활성화
        if (selectedQuest.IsComplete)
        {
            for (int i = 0; i < questGiver.MyQuests.Length; i++)
            {
                if (selectedQuest == questGiver.MyQuests[i])
                {
                    questGiver.MyCompltedQuests.Add(selectedQuest.MyTitle);
                    questGiver.MyQuests[i] = null;
                    selectedQuest.MyQuestGiver.UpdateQuestStatus();
                }
            }
            foreach (CollectObjective o in selectedQuest.MyCollectObjectives)
            {
                InventoryScript.instance.itemCountChangedEvent -= new ItemCountChanged(o.UpdateItemCount);
                o.Complete();
            }

            foreach (KillObjective o in selectedQuest.MyKillObjectives)
            {
                GameManager.instance.killConfirmedEvent -= new KillConfirmed(o.UpdateKillCount);
            }

            //함수 오버로딩 ->퀘스트와 몹변수를 받을 수 있음
            Player.instance.GainXP(XPManager.CalculateXP((selectedQuest)));
            Questlog.instance.RemoveQuest(selectedQuest.MyQuestScript);
            Back();
        }
    }
Exemplo n.º 3
0
    // protected override void FixedUpdate()
    // {
    //     base.FixedUpdate();
    // }
    public IEnumerator TakeDamage(float playerDamage)
    {
        if (!isDead)
        {
            health.MyCurrentValue -= playerDamage;
            CombatTextManager.MyInstance.CreateText(transform.position, playerDamage.ToString(), SCTTYPE.DAMAGE, false);
            if (health.MyCurrentValue <= 0)
            {
                isDead = true;
                animator.SetTrigger("Dead");
                hitBox.size    = new Vector2(0, 0);
                canvas.enabled = false;
                GameManager.MyInstance.OnKillConfirmed(this);
                // if (this is Enemy)
                Eeola.MyInstance.GainXp(XPManager.CalculateXP(this as Enemy));
                yield return(new WaitForSeconds(1));

                //gameObject.GetComponent<SpriteRenderer>().enabled = false;
                // Destroy(gameObject);
                if (TakeDamageCoroutine != null)
                {
                    StopCoroutine(TakeDamageCoroutine);
                }
            }
        }
    }
    /// <summary>
    /// Clic sur le bouton Terminer : Termine la quête
    /// </summary>
    public void CompleteQuest()
    {
        // Si la quête sélectionnée est "Terminée"
        if (selected.IsComplete)
        {
            // Pour chaque quête
            for (int i = 0; i < questGiver.MyQuests.Length; i++)
            {
                // Si la quête sélectionnée est la même que celle du donneur de quêtes
                if (selected == questGiver.MyQuests[i])
                {
                    // Retire la quête de la liste
                    questGiver.MyQuests[i] = null;

                    // Ajoute la quête dans le liste des complètes
                    questGiver.MyCompletedQuests.Add(selected.MyTitle);

                    // Actualise le statut de la quête
                    selected.MyQuestGiver.UpdateQuestStatus();
                }
            }

            // Pour chacun des objectifs de collecte de la quête
            foreach (CollectObjective collectObjective in selected.MyCollectObjectives)
            {
                // Désabonnement sur l'évènement de mise à jour du nombre d'élements de l'item
                InventoryScript.MyInstance.ItemCountChangedEvent -= new ItemCountChanged(collectObjective.UpdateItemCount);

                // Complète l'objectif de collecte
                collectObjective.Complete();
            }

            // Pour chacun des objectifs d'ennemi de la quête
            foreach (KillObjective killObjective in selected.MyKillObjectives)
            {
                // Désabonnement sur l'évènement de la mort d'un personnage
                GameManager.MyInstance.KillConfirmedEvent -= new KillConfirmed(killObjective.UpdateKillCount);
            }

            // Gagne l'expérience calculée
            Player.MyInstance.GainXP(XPManager.CalculateXP(selected));

            // Retire la quête
            QuestWindow.MyInstance.RemoveQuest(selected.MyQuestScript);

            // Retourne à la liste des quêtes
            Back();
        }
    }
Exemplo n.º 5
0
    public override void DamageTakenStun(float damage, Transform source)
    {
        if (!(currentState is EvadeState))
        {
            if (IsAlive)
            {
                SetTarget(source);

                base.DamageTakenStun(damage, source);

                OnHealthChanged(health.MyCurrentValue);

                if (gameObject.tag == "Boss")
                {
                    BossVoice.MyInstance.BossAttackedVoice();
                }

                else if (gameObject.tag == "Enemy")
                {
                    EnemyVoice.MyInstance.EnemyAttacked();
                }

                if (!IsAlive)
                {
                    if (gameObject.tag == "Enemy")
                    {
                        EnemyVoice.MyInstance.EnemyDeath();
                    }

                    if (gameObject.tag == "Boss")
                    {
                        BossVoice.MyInstance.BossDeath();
                    }

                    enemySprite.sortingOrder = -1;
                    enemyCC2D.isTrigger      = true;
                    Player.MyInstance.MyAttackers.Remove(this);
                    Player.MyInstance.GainXp(XPManager.CalculateXP(this as Enemy));
                    Player.MyInstance.StartCoroutine(Player.MyInstance.GainGold(goldValue));
                }
            }
        }
    }
Exemplo n.º 6
0
    /// <summary>
    /// Makes the enemy take damage when hit
    /// </summary>
    /// <param name="damage"></param>
    public override void TakeDamage(float damage, Character source)
    {
        if (!(currentState is EvadeState))
        {
            if (IsAlive)
            {
                SetTarget(source);

                base.TakeDamage(damage, source);

                OnHealthChanged(health.MyCurrentValue);

                if (!IsAlive)
                {
                    source.RemoveAttacker(this);
                    Player.MyInstance.GainXP(XPManager.CalculateXP((this as Enemy)));
                }
            }
        }
    }