Beispiel #1
0
 //Assigns their hotkey to my skill that's being swapped
 private void AssignDraggedToMine(SkillTreePiece skillTreePieceOfDragged, Skill thisSlotsSkills)
 {
     skillTreePieceOfDragged.setSkill(thisSlotsSkills);
     skillTreePieceOfDragged.getSkill().SlotAssignedTo = (gameObject);
     skillTreePieceOfDragged.getSkill().Hotkey         = new SkillHotkey(DraggableSlot.originalSlot.GetComponent <Slot>().key, thisSlotsSkills);
     DraggableSlot.originalSlot.GetComponent <Image>().sprite = GetComponent <Image>().sprite;
     DraggableSlot.originalParent.GetChild(0).GetComponent <Image>().sprite = GetComponent <Image>().sprite;
 }
    private IEnumerator setParent()
    {
        yield return(new WaitForSeconds(.5f));

        parentSkillTreePiece = GetComponentInParent <SkillTreePiece>();
        currentPlayer        = GameObject.Find("Player").GetComponent <PlayerController>();
        sm = GameObject.Find("Player").GetComponent <StatsManager>();
    }
Beispiel #3
0
    //Assigns my hotkey to the skill being dragged over
    private void AssignMineToDragged(SkillTreePiece skillTreePieceOfDragged, Skill thisSlotsSkills)
    {
        Skill  dragged = DraggableSlot.skillBeingDragged;
        Sprite img     = DraggableSlot.imgBeingDragged;

        thisSlotsSkills.SlotAssignedTo   = (DraggableSlot.originalSlot.gameObject);
        GetComponent <Image>().sprite    = img;
        bg.GetComponent <Image>().sprite = img;
        GetComponent <SkillTreePiece>().setSkill(dragged);
        GetComponent <SkillTreePiece>().getSkill().Hotkey = new SkillHotkey(key, dragged);
    }
Beispiel #4
0
 //Populates the 'treepieces' list to refrence all of the skills within the skill tree
 private void fillTreePiecesList()
 {
     toggles    = new List <Toggle>();
     treePieces = new List <SkillTreePiece>();
     foreach (Transform child in transform.GetChild(0).transform)
     {
         if (child.gameObject.GetComponentInChildren <SkillTreePiece> () != null)
         {
             piece = child.gameObject.GetComponentInChildren <SkillTreePiece> ();
             toggles.Add(child.GetComponent <Toggle>());
             child.gameObject.GetComponent <Toggle>().interactable = false;
             treePieces.Add(piece);
         }
     }
 }
Beispiel #5
0
    private void SwapSlots()
    {
        //Swap the two skills
        Skill dragged = DraggableSlot.skillBeingDragged;

        DraggableSlot.foundTarget = true;
        if (GetComponent <SkillTreePiece>().getSkill() != null)
        {
            Skill thisSlotsSkills = GetComponent <SkillTreePiece>().getSkill();
            if (dragged != null && thisSlotsSkills.Cooldown >= thisSlotsSkills.Cooldown)
            {
                SkillTreePiece skillTreePieceOfDragged = DraggableSlot.originalSlot.GetComponent <SkillTreePiece> ();
                AssignDraggedToMine(skillTreePieceOfDragged, thisSlotsSkills);
                AssignMineToDragged(skillTreePieceOfDragged, thisSlotsSkills);
            }
        }
    }