public void SetAsExitOption()
 {
     optionText.text = "Close";
     optionButton.onClick.AddListener(() => DialogueSystem.Instance.dialoguePanel.SetActive(false));
     optionButton.onClick.AddListener(() => PlayerMovement.cantMove = false);
     optionButton.onClick.AddListener(() => SoundDatabase.PlaySound(21));
 }
 public void Decline()
 {
     SoundDatabase.PlaySound(21);
     Destroy(gameObject);
     DialogueSystem.Instance.ShowQuest = false;
     DialogueSystem.Instance.MakeDialouge(CurrentQuest.DeclineText);
 }
    public void EquipArmor(Item itemToEquip)
    {
        SoundDatabase.PlaySound(0);
        foreach (Transform item in playerArmor.transform)
        {
            Item checkItem = item.GetComponent <ItemHolder>().item;
            if (checkItem.ItemType == itemToEquip.ItemType)
            {
                UnequipArmor(checkItem);
                Destroy(item.gameObject);
            }
        }
        Armor armor = Instantiate(Resources.Load <Armor>("Prefabs/Items/" + itemToEquip.Name));

        armor.transform.SetParent(playerArmor.transform);
        armor.transform.localScale = new Vector3(1, 1, 1);
        //GameObject armor = new GameObject();
        //armor.AddComponent<ItemHolder>();
        //armor.GetComponent<ItemHolder>().item = itemToEquip;
        //armor.AddComponent<SpriteRenderer>();
        //armor.GetComponent<SpriteRenderer>().sprite = Resources.Load<Sprite>("Icons/PlayerEquips/" + itemToEquip.Name);
        //armor.GetComponent<SpriteRenderer>().sortingOrder = 10;
        armor.name = itemToEquip.Name;
        //armor.transform.SetParent(playerArmor.transform);
        armor.transform.localPosition = new Vector3(0, 0, 0);
        //armor.transform.localScale = new Vector3(1, 1, 1);
        //
        itemToEquip.Stats.AddStatsToOther(player.Stats);
        //equippedWeapon = EquippedWeapon.GetComponent<IArmor>();
        //itemToEquip.Stats = itemToEquip.Stats;
        UIEventHandler.ItemEquipped(itemToEquip);
        UIEventHandler.StatsChanged();
    }
Ejemplo n.º 4
0
 void AddCurrentOptionIndex(int amount)
 {
     LeavingCurrentOption();
     CurrentOptionIndex += amount;
     PointAtCurrentOption();
     SoundDatabase.PlaySound(34);
 }
 public void Accept()
 {
     SoundDatabase.PlaySound(9);
     Destroy(gameObject);
     DialogueSystem.Instance.MakeDialouge(CurrentQuest.AcceptText);
     DialogueSystem.Instance.ShowQuest = false;
     UIEventHandler.QuestAccepted(CurrentQuest);
     EventNotifier.Instance.MakeEventNotifier(string.Format("Quest Accepted: {0}", CurrentQuest.Name));
 }
Ejemplo n.º 6
0
    // USED IN PlayerActivesController
    // ALL ACTIVES GO HERE
    public static void GetSkillActiveEffect(int id)
    {
        switch (id)
        {
        case 1: { SkillEvents.OnSkillUse += Meditate; SoundDatabase.PlaySound(10); break; }

        case 2: { Player.OnTakeDamage += ManaGaurd; SoundDatabase.PlaySound(19); break; }
        }
    }
 public void UnequipArmor(Item item)
 {
     SoundDatabase.PlaySound(0);
     item.Stats.RemoveStatsFromOther(player.Stats);
     inventoryController.GiveItem(item);
     Destroy(playerArmor.transform.Find(item.Name).gameObject);
     UIEventHandler.ItemUnequipped(item);
     UIEventHandler.StatsChanged();
     SoundDatabase.PlaySound(0);
 }
    public void HotkeyAssignPress(Transform self)
    {
        SoundDatabase.PlaySound(32);
        int        selfIndex  = self.GetSiblingIndex();
        PanelSkill panelSkill = hotSkillPanel.transform.GetChild(selfIndex).GetComponent <PanelSkill>();

        panelSkill.playerSkill = currentSkill;
        panelSkill.UpdateImage();
        hotkeyAssign.SetActive(!hotkeyAssign.activeInHierarchy);
    }
    public void HotKeyDeletePress(Transform self)
    {
        SoundDatabase.PlaySound(21);
        int        selfIndex  = self.GetSiblingIndex();
        PanelSkill panelSkill = hotSkillPanel.transform.GetChild(selfIndex).GetComponent <PanelSkill>();

        panelSkill.cooldownCircle.fillAmount = 0;
        panelSkill.playerSkill = null;
        panelSkill.UpdateImage();
    }
Ejemplo n.º 10
0
 public void completedButtonClick()
 {
     if (showingInprogressScroll)
     {
         SoundDatabase.PlaySound(18);
         completedScroll.SetActive(true);
         inProgressScroll.SetActive(false);
         showingInprogressScroll = !showingInprogressScroll;
     }
 }
Ejemplo n.º 11
0
 public virtual void OnHitEffects(Damage dmg)
 {
     if (dmg.DidCrit)
     {
         SoundDatabase.PlaySound(11);
     }
     else
     {
         SoundDatabase.PlaySound(collideSoundID);
     }
 }
 public void HotkeyButton()
 {
     if (currentSkill.skillRank != 0)
     {
         SoundDatabase.PlaySound(18);
         hotkeyAssign.SetActive(!hotkeyAssign.activeInHierarchy);
         hotkeyDesc.text = "Where to assign " + currentSkill.skillName + " to?";
     }
     else
     {
         EventNotifier.Instance.MakeEventNotifier("Skill not yet learned!");
     }
 }
 public void UnequipWeapon(Item item)
 {
     if (EquippedWeapon != null)
     {
         SoundDatabase.PlaySound(0);
         //print("unequipped");
         //print(equippedWeapon.Stats.Physical);
         equippedWeapon.Stats.RemoveStatsFromOther(player.Stats);
         inventoryController.GiveItem(currentlyEquippedItem.Name);
         Destroy(playerHand.transform.GetChild(0).gameObject);
         UIEventHandler.ItemUnequipped(item);
         UIEventHandler.StatsChanged();
     }
 }
 public void RankUpButton()
 {
     if (currentSkill.skillRank == currentSkill.skillMaxRank)
     {
         SoundDatabase.PlaySound(33);
         EventNotifier.Instance.MakeEventNotifier("Skill already at max rank!");
     }
     else if (PlayerSkillController.Instance.RankUpSkill(currentSkill))
     {
         EventNotifier.Instance.MakeEventNotifier(string.Format("{0} rank + 1 ({1}/{2})", currentSkill.skillName, currentSkill.skillRank, currentSkill.skillMaxRank));
         SoundDatabase.PlaySound(20);
         PlayerSkillUpdate.SkillChanged();
     }
 }
Ejemplo n.º 15
0
 public void StartGamePress()
 {
     if (inputName.text.Length != 0)
     {
         SoundDatabase.PlaySound(43);
         player.Name = inputName.text;
         GameManager.Instance.CreateJobSelect();
         Destroy(gameObject);
     }
     else
     {
         SoundDatabase.PlaySound(33);
     }
 }
Ejemplo n.º 16
0
 public virtual void OnHitActivations(Collider2D col)
 {
     //Debug.Log("Hit an Enemy");
     if (!EnemiesHit.Exists(aGameObject => aGameObject == col.gameObject))
     {
         EnemiesHit.Add(col.gameObject);
         Damage calculatedDamage = new Damage(SkillActiveEvents.DamageSkillHitEnemy(Damage));
         SoundDatabase.PlaySound(SoundID);
         Enemy enemy = col.GetComponent <Enemy>();
         enemy.EnemyMovement.inRange = true;
         enemy.TakeDamage(calculatedDamage);
         Explode();
         Extinguish();
     }
 }
Ejemplo n.º 17
0
    IEnumerator WarpPlayer()
    {
        PlayerInteractController.Instance.ShowInteractNotifier(false);
        ScreenFader.img.enabled = true;
        SoundDatabase.PlaySound(16);
        PlayerMovement.cantMove = true;
        yield return(StartCoroutine(ScreenFader.FadeToBlack()));

        CurrentMap.Instance.WarpPlayerToMap(goToMapName);
        yield return(StartCoroutine(ScreenFader.FadeToClear()));

        PlayerMovement.cantMove = false;
        ScreenFader.img.enabled = false;
        Destroy(CurrentMap.Instance.area.GetChild(0).gameObject);
        //PlayerInteractController.Instance.ShowInteractNotifier(false);
    }
Ejemplo n.º 18
0
 public bool RankUpSkill(Skill skill)
 {
     if (player.SkillPoints > 0)
     {
         player.SkillPoints -= 1;
         skill.skillRank    += 1;
         SkillPassiveEffects.ApplyRankUpBonus(skill.skillID);
         return(true);
     }
     else
     {
         SoundDatabase.PlaySound(33);
         EventNotifier.Instance.MakeEventNotifier("Not enough skill points!");
         return(false);
     }
 }
Ejemplo n.º 19
0
 public void MageSelect()
 {
     SoundDatabase.PlaySound(43);
     player.Stats = new Mage();
     PlayerSkillController.Instance.LearnSkill(SkillDatabase.Instance.GetSkill("Fireball"));
     PlayerSkillController.Instance.LearnSkill(SkillDatabase.Instance.GetSkill(1));
     PlayerSkillController.Instance.LearnSkill(2);
     PlayerSkillController.Instance.LearnSkill(3);
     PlayerSkillController.Instance.LearnSkill(4);
     StatusBar.Instance.gameObject.SetActive(true);
     GameManager.Instance.characterPanel.SetActive(true);
     GameManager.Instance.InIntro = false;
     PlayerMovement.cantMove      = false;
     player.StartCoroutine(player.Regenerate());
     Destroy(gameObject);
     SoundDatabase.PlayMusic(0);
 }
Ejemplo n.º 20
0
 public void LevelUp()
 {
     SoundDatabase.PlaySound(47);
     EventNotifier.Instance.MakeEventNotifier(string.Format("Leveled Up! {0} -> {1}", Level, Level + 1));
     Level += 1;
     if (Level % 5 == 0)
     {
         player.SkillPoints += 2;
     }
     else
     {
         player.SkillPoints += 1;
     }
     player.StatsUpdate();
     player.HealFullHP();
     player.HealFullMP();
 }
    public static void ApplySkillEffect(int id)
    {
        Skill skill = PlayerSkillController.Instance.GetSkill(id);

        switch (id)
        {
        case 4:
        {
            SoundDatabase.PlaySound(14);
            int amount = skill.extras[0] + (int)((player.Stats.MaxHealth - player.CurrentHealth) * (skill.extras[1] / 100f));
            player.AddHealth(amount);
            FloatingText text = FloatingTextController.CreateFloatingText(amount.ToString(), player.transform);
            text.SetTextColor(Color.red);
            break;
        }
        }
    }
 public void EquipWeapon(Item itemToEquip)
 {
     UnequipWeapon(itemToEquip);
     EquippedWeapon = Instantiate(Resources.Load <GameObject>("Prefabs/Items/" + itemToEquip.Name), playerHand.transform);
     if (EquippedWeapon.GetComponent <IProjectileWeapon>() != null)
     {
         EquippedWeapon.GetComponent <IProjectileWeapon>().ProjectileSpawn = spawnProjectile;
     }
     itemToEquip.Stats.AddStatsToOther(player.Stats);
     equippedWeapon        = EquippedWeapon.GetComponent <Weapon>();
     equippedWeapon.Stats  = itemToEquip.Stats;
     currentlyEquippedItem = itemToEquip;
     EquippedWeapon.transform.SetParent(playerHand.transform);
     //EquippedWeapon.transform.localScale = new Vector3(1, 1, 1);
     equippedWeapon.playerSkillController = playerSkillController;
     equippedWeapon.player = player.Stats;
     equippedWeapon.SetAttackSpeed(player.Stats.AttackSpeed);
     SoundDatabase.PlaySound(0);
     UIEventHandler.ItemEquipped(itemToEquip);
     UIEventHandler.StatsChanged();
 }
Ejemplo n.º 23
0
 public void ContinueDialogue()
 {
     if (canContinueDialouge)
     {
         SoundDatabase.PlaySound(34);
         if (dialogueIndex < dialogueLines.Count - 1)
         {
             dialogueIndex += 1;
             string text = dialogueLines[dialogueIndex];
             dialogueText.text = text;
             if (ShowQuest && dialogueLines.Count - 1 == dialogueIndex)
             {
                 PlayerQuestController.Instance.CreateQuestAgreement(CurrentQuest);
                 canContinueDialouge = false;
             }
         }
         else
         {
             PlayerMovement.cantMove = false;
             dialoguePanel.SetActive(false);
         }
     }
 }
Ejemplo n.º 24
0
 public void UpdateClick()
 {
     SoundDatabase.PlaySound(21);
     PlayerQuestController.Instance.questPanel.CurrentQuest = quest;
     PlayerQuestController.Instance.UpdateQuestPanelDesc(quest);
 }
Ejemplo n.º 25
0
 public override void Interact()
 {
     SoundDatabase.PlaySound(16);
     Pickup();
     PlayerInteractController.Instance.ShowInteractNotifier(false);
 }
Ejemplo n.º 26
0
 public override void Interact()
 {
     SoundDatabase.PlaySound(34);
     computer.gameObject.SetActive(false);
     PlayerMovement.cantMove = false;
 }
 public void UpdateText(Quest quest)
 {
     optionText.text = quest.Name;
     optionButton.onClick.AddListener(() => QuestTalk(quest));
     optionButton.onClick.AddListener(() => SoundDatabase.PlaySound(21));
 }
Ejemplo n.º 28
0
 void UpdateRunning()
 {
     if (!cantMove && Input.GetKey(KeyCode.LeftShift))
     {
         if ((Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.DownArrow)))
         {
             if (timeRunning > 1f)
             {
                 if (!IsRunning)
                 {
                     SoundDatabase.PlaySound(54);
                     IsRunning = true;
                 }
             }
             else
             {
                 timeRunning += Time.deltaTime;
                 BaseSpeedX   = 1.25f + Mathf.Round((0.5f * timeRunning / 0.75f) * 100f) / 100f;
                 BaseSpeedY   = 1.1f + Mathf.Round((0.2f * timeRunning / 0.75f) * 100f) / 100f;
                 IsRunning    = false;
             }
         }
         else
         {
             IsRunning = false;
         }
     }
     else
     {
         IsRunning = false;
     }
     if (Input.GetKeyUp(KeyCode.LeftShift) ||
         (Input.GetKey(KeyCode.LeftShift) && (Input.GetKeyUp(KeyCode.LeftArrow) || Input.GetKeyUp(KeyCode.RightArrow) || Input.GetKeyUp(KeyCode.UpArrow) || Input.GetKeyUp(KeyCode.DownArrow))))
     {
         timeRunning = 0f;
         BaseSpeedX  = 1f;
         BaseSpeedY  = 1f;
     }
     if (!cantMove && !stun.Stunned)
     {
         float inputX = Input.GetAxisRaw("Horizontal");
         float inputY = Input.GetAxisRaw("Vertical");
         rbody.velocity = new Vector2(inputX * BaseSpeedX * moveSpeedX, inputY * BaseSpeedY * moveSpeedY);
         if (inputX == -1)
         {
             player.transform.localScale = new Vector3(-1, 1, 1);
         }
         else if (inputX == 1)
         {
             player.transform.localScale = new Vector3(1, 1, 1);
         }
         if (inputX != 0 || inputY != 0)
         {
             anim.SetBool("isWalking", true);
             if (inputX != 0)
             {
                 anim.SetFloat("input_x", inputX);
             }
         }
         else
         {
             anim.SetBool("isWalking", false);
         }
     }
     else
     {
         rbody.velocity = new Vector2(0, 0);
         anim.SetBool("isWalking", false);
     }
 }
 public void SetAsTalkOption()
 {
     optionText.text = "Talk";
     optionButton.onClick.AddListener(() => DialogueSystem.Instance.MakeDialouge(DialogueSystem.Instance.CurrentNPC.TalkText));
     optionButton.onClick.AddListener(() => SoundDatabase.PlaySound(21));
 }
Ejemplo n.º 30
0
 void OnTriggerEnter2D(Collider2D player)
 {
     SoundDatabase.PlaySound(26);
     //StatusBar.UpdateSliders();
 }