Beispiel #1
0
    //change the character panel stats base on equip armor
    public void ChangeStatsCharacterPanel(CharButton equipment)
    {
        healthStat_characerPanel.MyMaxValue     += equipment.MyEquippedArmor.MyHealth;
        healthStat_characerPanel.MyCurrentValue += equipment.MyEquippedArmor.MyHealth;

        magicStat_characerPanel.MyMaxValue     += equipment.MyEquippedArmor.MyMagic;
        magicStat_characerPanel.MyCurrentValue += equipment.MyEquippedArmor.MyMagic;

        movementSpeedStat.MyMaxValue     += equipment.MyEquippedArmor.MySpeed;
        movementSpeedStat.MyCurrentValue += equipment.MyEquippedArmor.MySpeed;

        resistanceStat_characterPanel.MyMaxValue     += equipment.MyEquippedArmor.MyResistance;
        resistanceStat_characterPanel.MyCurrentValue += equipment.MyEquippedArmor.MyResistance;

        magicRegenerationStat_characterPanel.MyMaxValue     += equipment.MyEquippedArmor.MyMagicRecovery;
        magicRegenerationStat_characterPanel.MyCurrentValue += equipment.MyEquippedArmor.MyMagicRecovery;

        healthRegenerationStat_characterPanel.MyMaxValue     += equipment.MyEquippedArmor.MyHealthRecovery;
        healthRegenerationStat_characterPanel.MyCurrentValue += equipment.MyEquippedArmor.MyHealthRecovery;

        physicalStrengthStat_characterPanel.MyMaxValue     += equipment.MyEquippedArmor.MyphsicalDamage;
        physicalStrengthStat_characterPanel.MyCurrentValue += equipment.MyEquippedArmor.MyphsicalDamage;


        magicStrengthStat_characterPanel.MyMaxValue     += equipment.MyEquippedArmor.myMagicDamage;
        magicStrengthStat_characterPanel.MyCurrentValue += equipment.MyEquippedArmor.myMagicDamage;
    }
Beispiel #2
0
 private void LoadEquipment(SaveData data)
 {
     foreach (EquipmentData equipmentData in data.MyEquipmentData)
     {
         CharButton cb = Array.Find(equipment, x => x.name == equipmentData.MyType);
         cb.EquipArmor(Array.Find(items, x => x.MyTitle == equipmentData.MyTitle) as Armor);
     }
 }
Beispiel #3
0
 private void Awake()
 {
     this.weapon     = weapon.GetComponent <CharButton>();
     this.outfit     = outfit.GetComponent <CharButton>();
     this.accessory1 = accessory1.GetComponent <CharButton>();
     this.accessory2 = accessory2.GetComponent <CharButton>();
     this.accessory3 = accessory3.GetComponent <CharButton>();
 }
Beispiel #4
0
    private void LoadEquipment(SaveData data)
    {
        foreach (EquipmenntData equipmenntData in data.MyEquipmentData)
        {
            CharButton cb = Array.Find(equipment, x => x.name == equipmenntData.MyType);         //Looking after the Character Buttons

            cb.EquipArmor(Array.Find(items, x => x.MyTitle == equipmenntData.MyTitle) as Armor); //After finding it, equiping it to the armor place
        }
    }
 private void LoadEquipment(SaveData data)
 {
     foreach (EquipmentData equipmentData in data.MyEquipmentData)
     {
         //이름을 통해 어떠한 장비창인지 찾음
         CharButton cb = Array.Find(equipment, x => x.name == equipmentData.MyType);
         //장비창에 장비의 이름을 찾아 장착
         cb.EquipArmor(Array.Find(items, x => x.MyTitle == equipmentData.MyTitle) as Armor);
     }
 }
Beispiel #6
0
    //change the Player health/magic ui stats base on equip armor
    public void ChangeStatFrame(CharButton equipment)
    {
        //player health/magic UI
        healthStat.MyMaxValue            += equipment.MyEquippedArmor.MyHealth;
        healthStat.MyCurrentValue        += equipment.MyEquippedArmor.MyHealth;
        healthStat.MyRegenearationAmount += equipment.MyEquippedArmor.MyHealthRecovery;

        //player health/magic UI
        magicStat_Frame.MyMaxValue            += equipment.MyEquippedArmor.MyMagic;
        magicStat_Frame.MyCurrentValue        += equipment.MyEquippedArmor.MyMagic;
        magicStat_Frame.MyRegenearationAmount += equipment.MyEquippedArmor.MyMagicRecovery;
    }
Beispiel #7
0
 private void AI()
 {
     if (curChar == null)
     {
         var characters = FindObjectsOfType <CharButton>();
         curChar = characters[Mathf.FloorToInt(Random.Range(0, characters.Length - Mathf.Epsilon))];
     }
     transform.position = Vector2.MoveTowards(transform.position, curChar.transform.position, speed * Time.deltaTime);
     if (transform.position == curChar.transform.position)
     {
         SelectedChar = curChar;
         FindObjectOfType <CSS>().CheckSelected();
     }
 }
Beispiel #8
0
 public void OnTriggerExit2D(Collider2D collision)
 {
     curChar    = null;
     selectable = false;
 }
Beispiel #9
0
 public void OnTriggerEnter2D(Collider2D collision)
 {
     curChar    = collision.GetComponent <CharButton>();
     selectable = true;
 }
Beispiel #10
0
    //Listen to the players input
    private void getInput()
    {
        direction = Vector3.zero;


        // Detect if we want to start a conversation
        if (Input.GetKeyDown(KeyCode.E))
        {
            CheckForNearbyNPC();
        }

        //direction and control exit points
        if (Input.GetKey(KeybindManager.MyInstance.Keybinds["UP"]))
        {
            exitIndex     = 0;
            direction    += new Vector3(0, 1);
            lastDirection = Vector3.up;

            minimapIcon.eulerAngles = new Vector3(0, 0, 0);
        }
        if (Input.GetKey(KeybindManager.MyInstance.Keybinds["LEFT"]))
        {
            exitIndex     = 3;
            direction    += new Vector3(-1, 0);
            lastDirection = Vector3.left;

            if (direction.y == 0)
            {
                minimapIcon.eulerAngles = new Vector3(0, 0, 90);
            }
        }

        if (Input.GetKey(KeybindManager.MyInstance.Keybinds["DOWN"]))
        {
            exitIndex     = 2;
            direction    += new Vector3(0, -1);
            lastDirection = Vector3.down;


            minimapIcon.eulerAngles = new Vector3(0, 0, 180);
        }

        if (Input.GetKey(KeybindManager.MyInstance.Keybinds["RIGHT"]))
        {
            exitIndex     = 1;
            direction    += new Vector3(1, 0);
            lastDirection = Vector3.right;

            if (direction.y == 0)
            {
                minimapIcon.eulerAngles = new Vector3(0, 0, 270);
            }
        }


        if (Input.GetKeyDown(KeyCode.Space))
        {
            //manage player dash
            isDashDownButton = true;
        }


        foreach (string action in KeybindManager.MyInstance.ActionBinds.Keys)
        {
            if (Input.GetKeyDown(KeybindManager.MyInstance.ActionBinds[action]))
            {
                UIManager.MyInstance.ClickActionButton(action);
            }
        }

        //weapons attack
        if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject()) //check to see if not over an ui
        {
            if (!MyIsAttack_Basic && !MyIsAttacking_Spells)
            {
                //the mouse click position
                RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity, 512);

                //if the mouse pointer isn't over pickupable item
                if (!hit || hit.collider.tag == "Enemy")
                {
                    try
                    {
                        //check to see if we have a weapon in hand
                        CharButton weapon = this.weapon;

                        //check to see if there's a weapon equipped
                        if (weapon.MyEquippedArmor.MyTitle != null)
                        {
                            //change the character direction base on the mouse pointer direction
                            CheckMouseDir();
                        }

                        playerWeaponAttack = true;
                    }
                    catch (NullReferenceException ex)
                    {
                        Debug.Log("Can't attack " + ex);
                    }
                }
            }
        }



        //test code
        if (Input.GetKeyDown(KeyCode.P))
        {
            InMemoryVariableStorage.MyInstance.SetValue("$open_Chest", true);
            healthStat.MyCurrentValue      -= 10;
            magicStat_Frame.MyCurrentValue -= 20;
        }
        if (Input.GetKeyDown(KeyCode.O))
        {
            healthStat.MyCurrentValue      += 10;
            magicStat_Frame.MyCurrentValue += 20;
        }
        //test code
    }