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();
        }
    }
Ejemplo n.º 2
0
 public Bird(Level level,
             Yat yat,
             Texture2D spriteSheet,
             SoundEffectInstance hawk,
             Vector2 frameSize,
             Vector2 position,
             float angle,
             XPManager xpgen,
             Rectangle window)
 {
     this.animationSpeed = 50;
     this.level          = level;
     this.yat            = yat;
     this.spriteSheet    = spriteSheet;
     this.hawk           = hawk;
     this.frameSize      = frameSize;
     this.framesX        = (int)(spriteSheet.Width / frameSize.X);
     this.framesY        = (int)(spriteSheet.Height / frameSize.Y);
     this.Position       = position;
     this.attackAngle    = angle;
     this.xpgen          = xpgen;
     this.window         = window;
     this.Attacking      = false;
     this.gotYat         = false;
 }
Ejemplo n.º 3
0
    public void showTargetFrame(Enemy target)
    {
        targetFrame.SetActive(true);

        healthStat.Initialize(target.MyHealth.MyCurrentValue, target.MyHealth.MyMaxValue);
        targetName.text  = target.MyName;
        targetLevel.text = target.MyLevel.ToString();

        target.healthChanged += new HealthChanged(updateTargetFrame);

        target.characterRemoved += new CharacterRemoved(hideTargetFrame);

        if (target.MyLevel >= Player.MyInstance.MyLevel + 5)
        {
            targetName.color = Color.red;
        }
        else if ((target.MyLevel == Player.MyInstance.MyLevel + 3) || (target.MyLevel == Player.MyInstance.MyLevel + 4))
        {
            targetName.color = new Color32(255, 124, 0, 255);
        }
        else if ((target.MyLevel >= Player.MyInstance.MyLevel - 2) && (target.MyLevel <= Player.MyInstance.MyLevel + 2))
        {
            targetName.color = Color.yellow;
        }
        else if (target.MyLevel <= Player.MyInstance.MyLevel - 3 && target.MyLevel > XPManager.CalculateGrayLevel())
        {
            targetName.color = Color.green;
        }
        else
        {
            targetName.color = Color.gray;
        }
    }
Ejemplo n.º 4
0
    public void ShowTargetFrame(Enemy target)
    {
        targetFrame.SetActive(true);

        healthStat.Initialize(target.MyHealth.MyCurrentValue, target.MyHealth.MyMaxValue);

        portraitFrame.sprite = target.MyPortrait;

        levelTexet.text = target.MyLevel.ToString();

        target.healthChanged += new HealthChanged(UpdateTargetFrame);

        target.characterRemoved += new CharacterRemoved(HideTargetFrame);

        if (target.MyLevel >= Hero.MyInstance.MyLevel + 5)
        {
            levelTexet.color = Color.red;
        }
        else if (target.MyLevel == Hero.MyInstance.MyLevel + 3 || target.MyLevel == Hero.MyInstance.MyLevel + 4)
        {
            levelTexet.color = new Color32(255, 124, 0, 255);
        }
        else if (target.MyLevel >= Hero.MyInstance.MyLevel - 2 && target.MyLevel <= Hero.MyInstance.MyLevel + 2)
        {
            levelTexet.color = Color.yellow;
        }
        else if (target.MyLevel <= Hero.MyInstance.MyLevel - 3 && target.MyLevel > XPManager.CalculateGrayLevel())
        {
            levelTexet.color = Color.green;
        }
        else
        {
            levelTexet.color = Color.grey;
        }
    }
Ejemplo n.º 5
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);
                }
            }
        }
    }
Ejemplo n.º 6
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();
        }
    }
Ejemplo n.º 7
0
        public override void Act(XPManager controller)
        {
            MAIAManager manager = controller as MAIAManager;

            if (manager != null)
            {
                manager.LaunchVictory();
            }
        }
Ejemplo n.º 8
0
        public override void Act(XPManager controller)
        {
            MAIAManager manager = controller as MAIAManager;

            if (manager != null)
            {
                manager.ResetHologram();
            }
        }
Ejemplo n.º 9
0
        public override void Act(XPManager controller)
        {
            MAIAManager manager = controller as MAIAManager;

            if (manager != null)
            {
                manager.StartHologramTubeAnimation();
            }
        }
Ejemplo n.º 10
0
 public BirdFactory(Level level, Yat yat, Texture2D spriteSheet, SoundEffect hawk, XPManager xpgen, Rectangle window)
 {
     this.level       = level;
     this.yat         = yat;
     this.spriteSheet = spriteSheet;
     this.hawk        = hawk;
     this.xpgen       = xpgen;
     this.window      = window;
 }
Ejemplo n.º 11
0
    // Start is called before the first frame update
    void Start()
    {
        xpBeforeGame = XPManager.GetStoredXP();
        xpAfterGame  = xpBeforeGame + XPManager.GetEarnedXP();
        XPManager.StoreEarnedXP();

        round = SessionManager.currentRound;
        SceneManager.sceneLoaded += OnLevelLoad;
        DontDestroyOnLoad(gameObject);
    }
Ejemplo n.º 12
0
    void OnDisable()
    {
        if (xpManager == null)
        {
            return;
        }
        XPManager xpManagerScript = xpManager.GetComponent <XPManager>();

        xpManagerScript.addXPEvent -= UpdateBar;
    }
Ejemplo n.º 13
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 14
0
 private void Awake()
 {
     if (Instance != null && Instance != this)
     {
         Destroy(gameObject);
     }
     else
     {
         Instance = this;
     }
 }
Ejemplo n.º 15
0
    public static int StoreEarnedXP()
    {
        int x = GetStoredXP();

        x += XPManager.GetEarnedXP();

        PlayerPrefs.SetInt("XP", x);
        PlayerPrefs.Save();

        return(x);
    }
Ejemplo n.º 16
0
    void OnEnable()
    {
        if (xpManager == null)
        {
            Debug.LogWarning($"XPManager not choosen");
            return;
        }
        XPManager xpManagerScript = xpManager.GetComponent <XPManager>();

        xpManagerScript.addXPEvent += UpdateBar;
    }
Ejemplo n.º 17
0
 void Awake()
 {
     if (xpmanager != null)
     {
         Destroy(gameObject);
     }
     else
     {
         xpmanager = this;
         GameObject.DontDestroyOnLoad(gameObject);
     }
 }
Ejemplo n.º 18
0
    public void ShowTargetFrame(Enemy target)
    {
        targetFrame.SetActive(true);

        healthStat.Initialize(target.MyHealth.MyCurrentValue, target.MyHealth.MyMaxValue);

        portraitFrame.sprite = target.MyPortrait;

        levelText.text = target.MyLevel.ToString();

        target.healthChanged += new HealthChanged(UpdateTargetFrame);

        target.characterRemoved += new CharacterRemoved(HideTargetFrame);

        if (target.MyLevel >= Player.MyInstance.MyLevel + 5)
        {
            levelText.color = Color.red;
        }
        else if (target.MyLevel == Player.MyInstance.MyLevel + 3 || target.MyLevel == Player.MyInstance.MyLevel + 4)
        {
            levelText.color = new Color32(255, 124, 0, 255);
        }
        else if (target.MyLevel >= Player.MyInstance.MyLevel - 2 && target.MyLevel <= Player.MyInstance.MyLevel + 2)
        {
            levelText.color = Color.yellow;
        }
        else if (target.MyLevel <= Player.MyInstance.MyLevel - 3 && target.MyLevel > XPManager.CalculateGrayLevel())
        {
            levelText.color = Color.green;
        }
        else
        {
            levelText.color = Color.grey;
        }

        for (int i = 0; i < targetDebuffs.Count; i++)
        {
            Destroy(targetDebuffs[i].gameObject);
        }

        targetDebuffs.Clear();

        foreach (Debuff debuff in target.MyDebuffs)
        {
            TargetDebuff td = Instantiate(targetDebuffPrefab, targetDebuffsTransform);
            td.Initialize(debuff);
            targetDebuffs.Add(td);
        }
    }
Ejemplo n.º 19
0
    /// <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();
        }
    }
Ejemplo n.º 20
0
    public static void OnScore(int amount)
    {
        CashManager.AddCash(amount);

        int preMultiplier = CashManager.Multiplier;

        XPManager.AddXP(amount * preMultiplier);

        CashManager.AddMultiplier();
        if (CashManager.Multiplier != preMultiplier)
        {
            if (OnMultiplierChange != null)
            {
                OnMultiplierChange(CashManager.Multiplier);
            }
        }
    }
Ejemplo n.º 21
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));
                }
            }
        }
    }
Ejemplo n.º 22
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)));
                }
            }
        }
    }
Ejemplo n.º 23
0
 public MushroomFactory(Texture2D spriteSheet,
                        Texture2D fireSheet,
                        Vector2 frameSize,
                        Level level,
                        Yat yat,
                        SoundEffect fire,
                        SoundEffect sound,
                        XPManager xpgen,
                        Rectangle window)
 {
     this.spriteSheet   = spriteSheet;
     this.fireballSheet = fireSheet;
     this.frameSize     = frameSize;
     this.level         = level;
     this.yat           = yat;
     this.fire          = fire;
     this.sound         = sound;
     this.xpgen         = xpgen;
     this.window        = window;
 }
Ejemplo n.º 24
0
    public void ActivateXpPanel()
    {
        int currentLevel = XPManager.CalculateLevel(xpBeforeGame, XPManager.MAP_XP_BOUNDARIES);

        DisplayMapTeaser(currentLevel);

        XpPanel.SetActive(true);
        mapLevel.OnDone    += OnMapLevelUpDone;
        mapLevel.OnLevelUp += DisplayMapTeaser;

        if (xpBeforeGame < XPManager.MAP_LEVEL_CAP)
        {
            Invoke("OnXpPanelActive", 0.4f);
        }
        else
        {
            OnMapLevelUpDone();
        }

        currentLevel = XPManager.CalculateLevel(xpBeforeGame, XPManager.SKIN_XP_BOUNDARIES);
        DisplaySkinTeaser(currentLevel);
    }
Ejemplo n.º 25
0
    public void ShowTargetFrame(Enemy target)
    {
        targetFrame.SetActive(true);
        heathStat.Initialize(target.Health.MyCurrentValue, target.Health.MyMaxValue);
        portraitFrame.sprite = target.MyPortrait;
        levelText.text       = target.MyLevel.ToString();

        //적의 체력이 변경시에 실행하는 함수
        target.healthChanged += new HealthChanged(UpdateTargetFrame);
        //적이 죽거나 다른 몹으로 타겟팅시 실행하는 함수
        target.characterRemoved += new CharacterRemoved(HideTargetFrame);

        //적 레벨이 5이상 높을경우
        if (target.MyLevel >= Player.instance.MyLevel + 5)
        {
            levelText.color = Color.red;
        }
        //적 레벨이 3, 4이상 높을경우
        else if (target.MyLevel == Player.instance.MyLevel + 3 || target.MyLevel == Player.instance.MyLevel + 4)
        {
            levelText.color = new Color32(255, 124, 0, 255);
        }
        // 적 레벨과 플레이어레벨이 -2 ~ + 2 인경우
        else if (target.MyLevel >= Player.instance.MyLevel - 2 && target.MyLevel <= Player.instance.MyLevel + 2)
        {
            levelText.color = Color.yellow;
        }
        // 적 레벨이 플레이어보다 3이상 낮은경우 또는 플레이어 레벨이 몬스터 레벨보다 너무 낮지 않은 경우
        else if (target.MyLevel <= Player.instance.MyLevel - 3 && target.MyLevel > XPManager.CalculateGrayLevel())
        {
            levelText.color = Color.green;
        }
        //더 낮은경우
        else
        {
            levelText.color = Color.grey;
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        switch (progressionType)
        {
        case XpTypes.Maps:
            boundary = XPManager.MAP_XP_BOUNDARIES;
            break;

        case XpTypes.Skins:
            boundary = XPManager.SKIN_XP_BOUNDARIES;
            break;
        }

        int level = XPManager.CalculateLevel(XPManager.GetStoredXP(), boundary);

        for (int i = 0; i < progression.Length; ++i)
        {
            progression[i].item.gameObject.SetActive(level >= i);
            if (progression[i].lockedPlaceholder != null)
            {
                progression[i].lockedPlaceholder.gameObject.SetActive(level < i);
            }
        }
    }
Ejemplo n.º 27
0
 public Mushroom(Texture2D spriteSheet,
                 Vector2 frameSize,
                 Vector2 position,
                 Level level,
                 Yat yat,
                 Fireball fireball,
                 SoundEffectInstance sound,
                 XPManager xpgen,
                 Rectangle window)
 {
     this.animationSpeed = 10;
     this.spriteSheet    = spriteSheet;
     this.frameSize      = frameSize;
     this.Position       = position;
     this.framesX        = (int)(spriteSheet.Width / frameSize.X);
     this.framesY        = (int)(spriteSheet.Height / frameSize.Y);
     this.level          = level;
     this.yat            = yat;
     this.fireball       = fireball;
     this.sound          = sound;
     this.xpgen          = xpgen;
     this.Window         = window;
     this.Visible        = true;
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Adapte la couleur du niveau en fonction de celui du joueur
 /// </summary>
 /// <param name="target">Cible du joueur</param>
 private void SetColorLevelText(Enemy target)
 {
     // Adapte la couleur du niveau en fonction de celui du joueur
     if (target.MyLevel >= Player.MyInstance.MyLevel + 5)
     {
         levelText.color = Color.red;
     }
     else if (target.MyLevel == Player.MyInstance.MyLevel + 3 || target.MyLevel == Player.MyInstance.MyLevel + 4)
     {
         levelText.color = new Color32(255, 160, 0, 255);
     }
     else if (target.MyLevel >= Player.MyInstance.MyLevel - 2 && target.MyLevel <= Player.MyInstance.MyLevel + 2)
     {
         levelText.color = Color.yellow;
     }
     else if (target.MyLevel <= Player.MyInstance.MyLevel - 3 && target.MyLevel > XPManager.CalculateGrayLevel())
     {
         levelText.color = Color.green;
     }
     else
     {
         levelText.color = Color.grey;
     }
 }
Ejemplo n.º 29
0
 public override void OnInit(XPManager manager, int randomSeed)
 {
     base.OnInit(manager, randomSeed);
     Init((MAIAManager)manager);
 }
Ejemplo n.º 30
0
 // Start is called before the first frame update
 void Start()
 {
     xpm_obj = GameObject.Find("XP Manager");
     xpm     = xpm_obj.GetComponent <XPManager>();
 }